Skip to content


Subversion checkout URL

You can clone with
Download ZIP


New feature for ReadmeAnyFromPod - specify the file to use as content source #2

merged 3 commits into from

2 participants


I'm writing a command-line app and want the contents of the README to come from the POD in the actual script file - not the 'main module' of the dist. So I added that functionality to ReadmeAnyFromPod.

Its default behavior is unchanged, but if in your dist.ini you specify the the path to a file for the option 'from_filename', it will use the POD in the specified file instead of the POD in the main module.

[ReadmeAnyFromPod / MarkdownInRoot]
from_filename = bin/foo


Ok, I'd like to merge this. The one problem is that the documentation and code don't match. The property is called "from_filename", but is documented as "from_module". Which one did you intend?

@DarwinAwardWinner DarwinAwardWinner merged commit 1ff9227 into DarwinAwardWinner:master

I merged this and renamed the POD to match the code. I'll add some tests for this before I release it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 26, 2012
  1. @hercynium

    Merge pull request #1 from DarwinAwardWinner/master

    hercynium authored
    Options to generate plaintext, markdown, and pod readmes, and specify filenames
  2. @hercynium
  3. @hercynium
This page is out of date. Refresh to see the latest.
Showing with 22 additions and 1 deletion.
  1. +22 −1 lib/Dist/Zilla/Plugin/
23 lib/Dist/Zilla/Plugin/
@@ -108,6 +108,19 @@ has filename => (
default => sub { $_types->{$_[0]->type}->{filename}; }
+=attr from_module
+The file from which to extract POD for the content of the README.
+The default is the file of the main module of the dist.
+has from_filename => (
+ ro, lazy,
+ isa => 'Str',
+ default => sub { shift->zilla->main_module->name; },
=attr location
Where to put the generated README file. Choices are:
@@ -198,6 +211,14 @@ sub setup_installer {
+sub _file_from_filename {
+ my ($self, $filename) = @_;
+ for my $file ($self->zilla->files->flatten) {
+ return $file if $file->name eq $filename;
+ }
+ return; # let moose throw exception if nothing found
=method get_readme_content
Get the content of the README in the desired format.
@@ -206,7 +227,7 @@ Get the content of the README in the desired format.
sub get_readme_content {
my ($self) = shift;
- my $mmcontent = $self->zilla->main_module->content;
+ my $mmcontent = $self->_file_from_filename($self->from_filename)->content;
my $parser = $_types->{$self->type}->{parser};
my $readme_content = $parser->($mmcontent);
Something went wrong with that request. Please try again.