| Module-Install-ReadmeFromPod documentation | Contained in the Module-Install-ReadmeFromPod distribution. |
Module::Install::ReadmeFromPod - A Module::Install extension to automatically convert POD to a README
# In Makefile.PL use inc::Module::Install; author 'Vestan Pants'; license 'perl'; readme_from 'lib/Some/Module.pm';
A README file will be generated from the POD of the indicated module file.
Note that the author will need to make sure
Module::Install::ReadmeFromPod is installed
before running the Makefile.PL. (The extension will be bundled
into the user-side distribution).
Module::Install::ReadmeFromPod is a Module::Install extension that generates a README file
automatically from an indicated file containing POD, whenever the author runs Makefile.PL.
This plugin adds the following Module::Install command:
readme_fromDoes nothing on the user-side. On the author-side it will generate a README file using Pod::Text from
the POD in the file passed as a parameter.
readme_from 'lib/Some/Module.pm';
If a second parameter is set to a true value then the README will be removed at make distclean.
readme_from 'lib/Some/Module.pm' => 'clean';
If you use the all_from command, readme_from will default to that value.
all_from 'lib/Some/Module.pm'; readme_from; # Create README from lib/Some/Module.pm readme_from '','clean'; # Put a empty string before 'clean'
Chris BinGOs Williams
Copyright © Chris Williams
This module may be used, modified, and distributed under the same terms as Perl itself. Please see the license that came with your Perl distribution for details.
| Module-Install-ReadmeFromPod documentation | Contained in the Module-Install-ReadmeFromPod distribution. |
package Module::Install::ReadmeFromPod; use 5.006; use strict; use warnings; use base qw(Module::Install::Base); use vars qw($VERSION); $VERSION = '0.12'; sub readme_from { my $self = shift; return unless $self->is_admin; my $file = shift || $self->_all_from or die "Can't determine file to make readme_from"; my $clean = shift; print "Writing README from $file\n"; require Pod::Text; my $parser = Pod::Text->new(); open README, '> README' or die "$!\n"; $parser->output_fh( *README ); $parser->parse_file( $file ); if ($clean) { $self->clean_files('README'); } return 1; } sub _all_from { my $self = shift; return unless $self->admin->{extensions}; my ($metadata) = grep { ref($_) eq 'Module::Install::Metadata'; } @{$self->admin->{extensions}}; return unless $metadata; return $metadata->{values}{all_from} || ''; } 'Readme!'; __END__