From e41d738e54e3a7c193b804daffab90bc7cb70b06 Mon Sep 17 00:00:00 2001 From: Tudor Constantin Date: Sun, 5 Apr 2015 22:49:28 +0300 Subject: [PATCH 1/6] generate the README.md at build time based on POD from CPAN::Mini::Inject.pm --- Build.PL | 2 + MANIFEST | 1 + README.md | 207 +++++++++++++++++++++++++++++++++++++++++++++++ inc/MyBuilder.pm | 28 +++++++ 4 files changed, 238 insertions(+) create mode 100644 README.md diff --git a/Build.PL b/Build.PL index 11d0503..e5ec0be 100644 --- a/Build.PL +++ b/Build.PL @@ -38,10 +38,12 @@ my $builder = MyBuilder->new( 'IO::Zlib' => 0, 'LWP::Simple' => 0, 'Pod::Usage' => 0, + 'Pod::Markdown' => 0, 'Test::More' => 0, 'YAML' => 0, 'File::Slurp' => 0, 'File::Temp' => 0, + 'FindBin' => 0, }, add_to_cleanup => [ 'CPAN-Mini-Inject-*', 't/local/WRITEREPO', 't/local/MYCPAN' ], diff --git a/MANIFEST b/MANIFEST index 9eb22d9..19ad55c 100644 --- a/MANIFEST +++ b/MANIFEST @@ -8,6 +8,7 @@ MANIFEST META.json META.yml README +README.md t/.mcpani/config t/.mcpani/config_with_whitespaces t/.mcpani/config_bad diff --git a/README.md b/README.md new file mode 100644 index 0000000..073e56e --- /dev/null +++ b/README.md @@ -0,0 +1,207 @@ +# NAME + +CPAN::Mini::Inject - Inject modules into a CPAN::Mini mirror. + +# VERSION + +Version 0.33 + +# Synopsis + +If you're not going to customize the way CPAN::Mini::Inject works you +probably want to look at the [mcpani](https://metacpan.org/pod/mcpani) command instead. + + use CPAN::Mini::Inject; + + $mcpi=CPAN::Mini::Inject->new; + $mcpi->parsecfg('t/.mcpani/config'); + + $mcpi->add( module => 'CPAN::Mini::Inject', + authorid => 'SSORICHE', + version => ' 0.01', + file => 'mymodules/CPAN-Mini-Inject-0.01.tar.gz' ) + + $mcpi->writelist; + $mcpi->update_mirror; + $mcpi->inject; + +# DESCRIPTION + +CPAN::Mini::Inject uses CPAN::Mini to build or update a local CPAN mirror +then adds modules from your repository to it, allowing the inclusion +of private modules in a minimal CPAN mirror. + +# METHODS + +Each method in CPAN::Mini::Inject returns a CPAN::Mini::Inject object which +allows method chaining. For example: + + my $mcpi=CPAN::Mini::Inject->new; + $mcpi->parsecfg + ->update_mirror + ->inject; + +A `CPAN::Mini::Inject` ISA [CPAN::Mini](https://metacpan.org/pod/CPAN::Mini). Refer to the +[documentation](https://metacpan.org/pod/CPAN::Mini) for that module for details of the interface +`CPAN::Mini::Inject` inherits from it. + +## `new` + +Create a new CPAN::Mini::Inject object. + +## `config_class( [CLASS] )` + +Returns the name of the class handling the configuration. + +With an argument, it sets the name of the class to handle +the config. To use that, you'll have to call it before you +load the configuration. + +## `config` + +Returns the configuration object. This object should be from +the class returned by `config_class` unless you've done something +weird. + +## `loadcfg( [FILENAME] )` + +This is a bridge to CPAN::Mini::Inject::Config's loadconfig. It sets the +filename for the configuration, or uses one of the defaults. + +## `parsecfg()` + +This is a bridge to CPAN::Mini::Inject::Config's parseconfig. + +## `site( [SITE] )` + +Returns the CPAN site that CPAN::Mini::Inject chose from the +list specified in the `remote` directive. + +## `testremote` + +Test each site listed in the remote parameter of the config file by performing +a get on each site in order for authors/01mailrc.txt.gz. The first site to +respond successfully is set as the instance variable site. + + print "$mcpi->{site}\n"; # ftp://ftp.cpan.org/pub/CPAN + +`testremote` accepts an optional parameter to enable verbose mode. + +## `update_mirror` + +This is a subclass of CPAN::Mini. + +## `add` + +Add a new module to the repository. The add method copies the module +file into the repository with the same structure as a CPAN site. For +example CPAN-Mini-Inject-0.01.tar.gz is copied to +MYCPAN/authors/id/S/SS/SSORICHE. add creates the required directory +structure below the repository. + +Packages found in the distribution will be added to the module list +(for example both `CPAN::Mini::Inject` and `CPAN::Mini::Inject::Config` +will be added to the `modules/02packages.details.txt.gz` file). + +Packages will be looked for in the `provides` key of the META file if present, +otherwise the files in the dist will be searched. +See [Dist::Metadata](https://metacpan.org/pod/Dist::Metadata) for more information. + +- module + + The name of the module to add. + The distribution file will be searched for modules + but you can specify the main one explicitly. + +- authorid + + CPAN author id. This does not have to be a real author id. + +- version + + The modules version number. + Module names and versions will be determined, + but you can specify one explicitly. + +- file + + The tar.gz of the module. + +### Example + + add( module => 'Module::Name', + authorid => 'AUTHOR', + version => 0.01, + file => './Module-Name-0.01.tar.gz' ); + +## `added_modules` + +Returns a list of hash references describing the modules added by this instance. +Each hashref will contain `file`, `authorid`, and `modules`. +The `modules` entry is a hashref of module names and versions included in the `file`. + +The list is cumulative. +There will be one entry for each time ["add"](#add) was called. + +This functionality is mostly provided for the included [mcpani](https://metacpan.org/pod/mcpani) script +to be able to verbosely print all the modules added. + +## `inject` + +Insert modules from the repository into the local CPAN::Mini mirror. inject +copies each module into the appropriate directory in the CPAN::Mini mirror +and updates the CHECKSUMS file. + +Passing a value to `inject` enables verbose mode, which lists each module +as it's injected. + +## `updpackages` + +Update the CPAN::Mini mirror's modules/02packages.details.txt.gz with the +injected module information. + +## `updauthors` + +Update the CPAN::Mini mirror's authors/01mailrc.txt.gz with +stub information should the author not actually exist on CPAN + +## `readlist` + +Load the repository's modulelist. + +## `writelist` + +Write to the repository modulelist. + +# See Also + +[CPAN::Mini](https://metacpan.org/pod/CPAN::Mini) + +# Current Maintainer + +Christian Walde `` + +# Original Author + +Shawn Sorichetti, `` + +# Acknowledgements + +Special thanks to David Bartle, for bringing this module up +to date, and resolving the reported bugs. + +Thanks to Jozef Kutej for numerous patches. + +# Bugs + +Please report any bugs or feature requests to +`bug-cpan-mini-inject@rt.cpan.org`, or through the web interface at +[http://rt.cpan.org](http://rt.cpan.org). I will be notified, and then you'll automatically +be notified of progress on your bug as I make changes. + +# Copyright & License + +Copyright 2008-2009 Shawn Sorichetti, Andy Armstrong, All Rights Reserved. + +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. diff --git a/inc/MyBuilder.pm b/inc/MyBuilder.pm index 301ce34..f4c337f 100644 --- a/inc/MyBuilder.pm +++ b/inc/MyBuilder.pm @@ -1,7 +1,14 @@ package MyBuilder; +use strict; use base qw( Module::Build ); +use FindBin; +use Cwd qw(realpath); +use File::Spec::Functions; + +use Pod::Markdown; + sub create_build_script { my ( $self, @args ) = @_; $self->_auto_mm; @@ -85,4 +92,25 @@ sub ACTION_tidy { } } +sub ACTION_docs { + + my $self = shift; + + my $inject_pm = catfile($FindBin::Bin, "lib", "CPAN", "Mini", "Inject.pm"); + my $readme_md = catfile($FindBin::Bin, "README.md"); + + my $parser = Pod::Markdown->new( perldoc_url_prefix => 'metacpan' ); + + open my $in_file, "<", $inject_pm or die "Failed to open '$inject_pm': $!\n"; + open my $out_file, ">", $readme_md or die "Failed to open '$readme_md': $!\n"; + + $parser->output_fh($out_file); + $parser->parse_file($in_file); + + close $out_file; + close $in_file; + + return $self->SUPER::ACTION_docs; +} + 1; From 42c0cdb50f3ca11505c465455df16e662d8e454e Mon Sep 17 00:00:00 2001 From: Tudor Constantin Date: Mon, 6 Apr 2015 17:50:15 +0300 Subject: [PATCH 2/6] added links to the metacpan --- README.md | 174 ++++++++++++++++++++++------------------ lib/CPAN/Mini/Inject.pm | 34 ++++---- 2 files changed, 114 insertions(+), 94 deletions(-) diff --git a/README.md b/README.md index 073e56e..58e44af 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # NAME -CPAN::Mini::Inject - Inject modules into a CPAN::Mini mirror. +[CPAN::Mini::Inject](https://metacpan.org/pod/CPAN::Mini::Inject) - Inject modules into a [CPAN::Mini](https://metacpan.org/pod/CPAN::Mini) mirror. # VERSION @@ -27,7 +27,7 @@ probably want to look at the [mcpani](https://metacpan.org/pod/mcpani) command i # DESCRIPTION -CPAN::Mini::Inject uses CPAN::Mini to build or update a local CPAN mirror +[CPAN::Mini::Inject](https://metacpan.org/pod/CPAN::Mini::Inject) uses [CPAN::Mini](https://metacpan.org/pod/CPAN::Mini) to build or update a local CPAN mirror then adds modules from your repository to it, allowing the inclusion of private modules in a minimal CPAN mirror. @@ -45,87 +45,87 @@ A `CPAN::Mini::Inject` ISA [CPAN::Mini](https://metacpan.org/pod/CPAN::Mini). Re [documentation](https://metacpan.org/pod/CPAN::Mini) for that module for details of the interface `CPAN::Mini::Inject` inherits from it. -## `new` +- `new` -Create a new CPAN::Mini::Inject object. + Create a new CPAN::Mini::Inject object. -## `config_class( [CLASS] )` +- `config_class( [CLASS] )` -Returns the name of the class handling the configuration. + Returns the name of the class handling the configuration. -With an argument, it sets the name of the class to handle -the config. To use that, you'll have to call it before you -load the configuration. + With an argument, it sets the name of the class to handle + the config. To use that, you'll have to call it before you + load the configuration. -## `config` +- `config` -Returns the configuration object. This object should be from -the class returned by `config_class` unless you've done something -weird. + Returns the configuration object. This object should be from + the class returned by `config_class` unless you've done something + weird. -## `loadcfg( [FILENAME] )` +- `loadcfg( [FILENAME] )` -This is a bridge to CPAN::Mini::Inject::Config's loadconfig. It sets the -filename for the configuration, or uses one of the defaults. + This is a bridge to CPAN::Mini::Inject::Config's loadconfig. It sets the + filename for the configuration, or uses one of the defaults. -## `parsecfg()` +- `parsecfg()` -This is a bridge to CPAN::Mini::Inject::Config's parseconfig. + This is a bridge to CPAN::Mini::Inject::Config's parseconfig. -## `site( [SITE] )` +- `site( [SITE] )` -Returns the CPAN site that CPAN::Mini::Inject chose from the -list specified in the `remote` directive. + Returns the CPAN site that CPAN::Mini::Inject chose from the + list specified in the `remote` directive. -## `testremote` +- `testremote` -Test each site listed in the remote parameter of the config file by performing -a get on each site in order for authors/01mailrc.txt.gz. The first site to -respond successfully is set as the instance variable site. + Test each site listed in the remote parameter of the config file by performing + a get on each site in order for authors/01mailrc.txt.gz. The first site to + respond successfully is set as the instance variable site. - print "$mcpi->{site}\n"; # ftp://ftp.cpan.org/pub/CPAN + print "$mcpi->{site}\n"; # ftp://ftp.cpan.org/pub/CPAN -`testremote` accepts an optional parameter to enable verbose mode. + `testremote` accepts an optional parameter to enable verbose mode. -## `update_mirror` +- `update_mirror` -This is a subclass of CPAN::Mini. + This is a subclass of CPAN::Mini. -## `add` +- `add` -Add a new module to the repository. The add method copies the module -file into the repository with the same structure as a CPAN site. For -example CPAN-Mini-Inject-0.01.tar.gz is copied to -MYCPAN/authors/id/S/SS/SSORICHE. add creates the required directory -structure below the repository. + Add a new module to the repository. The add method copies the module + file into the repository with the same structure as a CPAN site. For + example CPAN-Mini-Inject-0.01.tar.gz is copied to + MYCPAN/authors/id/S/SS/SSORICHE. add creates the required directory + structure below the repository. -Packages found in the distribution will be added to the module list -(for example both `CPAN::Mini::Inject` and `CPAN::Mini::Inject::Config` -will be added to the `modules/02packages.details.txt.gz` file). + Packages found in the distribution will be added to the module list + (for example both `CPAN::Mini::Inject` and `CPAN::Mini::Inject::Config` + will be added to the `modules/02packages.details.txt.gz` file). -Packages will be looked for in the `provides` key of the META file if present, -otherwise the files in the dist will be searched. -See [Dist::Metadata](https://metacpan.org/pod/Dist::Metadata) for more information. + Packages will be looked for in the `provides` key of the META file if present, + otherwise the files in the dist will be searched. + See [Dist::Metadata](https://metacpan.org/pod/Dist::Metadata) for more information. -- module + - module - The name of the module to add. - The distribution file will be searched for modules - but you can specify the main one explicitly. + The name of the module to add. + The distribution file will be searched for modules + but you can specify the main one explicitly. -- authorid + - authorid - CPAN author id. This does not have to be a real author id. + CPAN author id. This does not have to be a real author id. -- version + - version - The modules version number. - Module names and versions will be determined, - but you can specify one explicitly. + The modules version number. + Module names and versions will be determined, + but you can specify one explicitly. -- file + - file - The tar.gz of the module. + The tar.gz of the module. ### Example @@ -134,44 +134,44 @@ See [Dist::Metadata](https://metacpan.org/pod/Dist::Metadata) for more informati version => 0.01, file => './Module-Name-0.01.tar.gz' ); -## `added_modules` +- `added_modules` -Returns a list of hash references describing the modules added by this instance. -Each hashref will contain `file`, `authorid`, and `modules`. -The `modules` entry is a hashref of module names and versions included in the `file`. + Returns a list of hash references describing the modules added by this instance. + Each hashref will contain `file`, `authorid`, and `modules`. + The `modules` entry is a hashref of module names and versions included in the `file`. -The list is cumulative. -There will be one entry for each time ["add"](#add) was called. + The list is cumulative. + There will be one entry for each time ["add"](#add) was called. -This functionality is mostly provided for the included [mcpani](https://metacpan.org/pod/mcpani) script -to be able to verbosely print all the modules added. + This functionality is mostly provided for the included [mcpani](https://metacpan.org/pod/mcpani) script + to be able to verbosely print all the modules added. -## `inject` +- `inject` -Insert modules from the repository into the local CPAN::Mini mirror. inject -copies each module into the appropriate directory in the CPAN::Mini mirror -and updates the CHECKSUMS file. + Insert modules from the repository into the local CPAN::Mini mirror. inject + copies each module into the appropriate directory in the CPAN::Mini mirror + and updates the CHECKSUMS file. -Passing a value to `inject` enables verbose mode, which lists each module -as it's injected. + Passing a value to `inject` enables verbose mode, which lists each module + as it's injected. -## `updpackages` +- `updpackages` -Update the CPAN::Mini mirror's modules/02packages.details.txt.gz with the -injected module information. + Update the CPAN::Mini mirror's modules/02packages.details.txt.gz with the + injected module information. -## `updauthors` +- `updauthors` -Update the CPAN::Mini mirror's authors/01mailrc.txt.gz with -stub information should the author not actually exist on CPAN + Update the CPAN::Mini mirror's authors/01mailrc.txt.gz with + stub information should the author not actually exist on CPAN -## `readlist` +- `readlist` -Load the repository's modulelist. + Load the repository's modulelist. -## `writelist` +- `writelist` -Write to the repository modulelist. + Write to the repository modulelist. # See Also @@ -205,3 +205,23 @@ Copyright 2008-2009 Shawn Sorichetti, Andy Armstrong, All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. + +# POD ERRORS + +Hey! **The above document had some coding errors, which are explained below:** + +- Around line 71: + + '=item' outside of any '=over' + +- Around line 279: + + You forgot a '=back' before '=head3' + +- Around line 365: + + '=item' outside of any '=over' + +- Around line 712: + + You forgot a '=back' before '=head1' diff --git a/lib/CPAN/Mini/Inject.pm b/lib/CPAN/Mini/Inject.pm index 6dd59cd..a941f88 100644 --- a/lib/CPAN/Mini/Inject.pm +++ b/lib/CPAN/Mini/Inject.pm @@ -18,7 +18,7 @@ use Dist::Metadata (); =head1 NAME -CPAN::Mini::Inject - Inject modules into a CPAN::Mini mirror. +L - Inject modules into a L mirror. =head1 VERSION @@ -50,7 +50,7 @@ probably want to look at the L command instead. =head1 DESCRIPTION -CPAN::Mini::Inject uses CPAN::Mini to build or update a local CPAN mirror +L uses L to build or update a local CPAN mirror then adds modules from your repository to it, allowing the inclusion of private modules in a minimal CPAN mirror. @@ -68,7 +68,7 @@ A C ISA L. Refer to the L for that module for details of the interface C inherits from it. -=head2 C +=item C Create a new CPAN::Mini::Inject object. @@ -80,7 +80,7 @@ sub new { $_[0]; } -=head2 C<< config_class( [CLASS] ) >> +=item C<< config_class( [CLASS] ) >> Returns the name of the class handling the configuration. @@ -98,7 +98,7 @@ sub config_class { $self->{config_class}; } -=head2 C<< config >> +=item C<< config >> Returns the configuration object. This object should be from the class returned by C unless you've done something @@ -114,7 +114,7 @@ sub config { $self->{config}; } -=head2 C<< loadcfg( [FILENAME] ) >> +=item C<< loadcfg( [FILENAME] ) >> This is a bridge to CPAN::Mini::Inject::Config's loadconfig. It sets the @@ -134,7 +134,7 @@ sub loadcfg { return $self; } -=head2 C<< parsecfg() >> +=item C<< parsecfg() >> This is a bridge to CPAN::Mini::Inject::Config's parseconfig. @@ -152,7 +152,7 @@ sub parsecfg { return $self; } -=head2 C<< site( [SITE] ) >> +=item C<< site( [SITE] ) >> Returns the CPAN site that CPAN::Mini::Inject chose from the list specified in the C directive. @@ -168,7 +168,7 @@ sub site { $self->{site} || ''; } -=head2 C +=item C Test each site listed in the remote parameter of the config file by performing a get on each site in order for authors/01mailrc.txt.gz. The first site to @@ -207,7 +207,7 @@ sub testremote { return $self; } -=head2 C +=item C This is a subclass of CPAN::Mini. @@ -236,7 +236,7 @@ sub update_mirror { CPAN::Mini->update_mirror( %options ); } -=head2 C +=item C Add a new module to the repository. The add method copies the module file into the repository with the same structure as a CPAN site. For @@ -362,7 +362,7 @@ sub add { return $self; } -=head2 C +=item C Returns a list of hash references describing the modules added by this instance. Each hashref will contain C, C, and C. @@ -381,7 +381,7 @@ sub added_modules { return @{ $self->{added_modules} ||= [] }; } -=head2 C +=item C Insert modules from the repository into the local CPAN::Mini mirror. inject copies each module into the appropriate directory in the CPAN::Mini mirror @@ -436,7 +436,7 @@ sub inject { return $self; } -=head2 C +=item C Update the CPAN::Mini mirror's modules/02packages.details.txt.gz with the injected module information. @@ -460,7 +460,7 @@ sub updpackages { $self->_writepkgs( [ sort values %packages ] ); } -=head2 C +=item C Update the CPAN::Mini mirror's authors/01mailrc.txt.gz with stub information should the author not actually exist on CPAN @@ -499,7 +499,7 @@ sub updauthors { } -=head2 C +=item C Load the repository's modulelist. @@ -529,7 +529,7 @@ sub readlist { return $self; } -=head2 C +=item C Write to the repository modulelist. From 1a87c028e30f70d11afd92f01b96dd9aa06988bf Mon Sep 17 00:00:00 2001 From: Tudor Constantin Date: Mon, 6 Apr 2015 17:58:13 +0300 Subject: [PATCH 3/6] trying to fix POD errors --- README.md | 8 ++++---- lib/CPAN/Mini/Inject.pm | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 58e44af..6d11bbf 100644 --- a/README.md +++ b/README.md @@ -210,18 +210,18 @@ under the same terms as Perl itself. Hey! **The above document had some coding errors, which are explained below:** -- Around line 71: +- Around line 72: '=item' outside of any '=over' -- Around line 279: +- Around line 280: You forgot a '=back' before '=head3' -- Around line 365: +- Around line 366: '=item' outside of any '=over' -- Around line 712: +- Around line 713: You forgot a '=back' before '=head1' diff --git a/lib/CPAN/Mini/Inject.pm b/lib/CPAN/Mini/Inject.pm index a941f88..1a7b1eb 100644 --- a/lib/CPAN/Mini/Inject.pm +++ b/lib/CPAN/Mini/Inject.pm @@ -67,6 +67,7 @@ allows method chaining. For example: A C ISA L. Refer to the L for that module for details of the interface C inherits from it. +=cut =item C From 7fa4d7007d8d470e3c47129e2a23437787c7fa5d Mon Sep 17 00:00:00 2001 From: Tudor Constantin Date: Mon, 6 Apr 2015 18:02:50 +0300 Subject: [PATCH 4/6] fixed POD errors --- README.md | 20 -------------------- lib/CPAN/Mini/Inject.pm | 8 ++++++++ 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 6d11bbf..5171319 100644 --- a/README.md +++ b/README.md @@ -205,23 +205,3 @@ Copyright 2008-2009 Shawn Sorichetti, Andy Armstrong, All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. - -# POD ERRORS - -Hey! **The above document had some coding errors, which are explained below:** - -- Around line 72: - - '=item' outside of any '=over' - -- Around line 280: - - You forgot a '=back' before '=head3' - -- Around line 366: - - '=item' outside of any '=over' - -- Around line 713: - - You forgot a '=back' before '=head1' diff --git a/lib/CPAN/Mini/Inject.pm b/lib/CPAN/Mini/Inject.pm index 1a7b1eb..9de8207 100644 --- a/lib/CPAN/Mini/Inject.pm +++ b/lib/CPAN/Mini/Inject.pm @@ -69,6 +69,8 @@ L for that module for details of the interface C inherits from it. =cut +=over 4 + =item C Create a new CPAN::Mini::Inject object. @@ -277,6 +279,8 @@ The tar.gz of the module. =back +=back + =head3 Example add( module => 'Module::Name', @@ -363,6 +367,8 @@ sub add { return $self; } +=over 4 + =item C Returns a list of hash references describing the modules added by this instance. @@ -710,6 +716,8 @@ sub _fmtdate { return "$date[0], $date[2] $date[1] $date[4] $date[3] GMT"; } +=back + =head1 See Also L From 1d3fb730cb854cf139f8b78696e5469ae78c096a Mon Sep 17 00:00:00 2001 From: Tudor Constantin Date: Wed, 8 Apr 2015 18:50:52 +0300 Subject: [PATCH 5/6] use Pod::Markdown::Github to generate README.md in order to offer perl syntax highlighting --- README.md | 46 +++++++++++++++++++++++++++------------------- inc/MyBuilder.pm | 4 ++-- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 5171319..e4ac7e2 100644 --- a/README.md +++ b/README.md @@ -11,19 +11,21 @@ Version 0.33 If you're not going to customize the way CPAN::Mini::Inject works you probably want to look at the [mcpani](https://metacpan.org/pod/mcpani) command instead. - use CPAN::Mini::Inject; +```perl +use CPAN::Mini::Inject; - $mcpi=CPAN::Mini::Inject->new; - $mcpi->parsecfg('t/.mcpani/config'); +$mcpi=CPAN::Mini::Inject->new; +$mcpi->parsecfg('t/.mcpani/config'); - $mcpi->add( module => 'CPAN::Mini::Inject', - authorid => 'SSORICHE', - version => ' 0.01', - file => 'mymodules/CPAN-Mini-Inject-0.01.tar.gz' ) +$mcpi->add( module => 'CPAN::Mini::Inject', + authorid => 'SSORICHE', + version => ' 0.01', + file => 'mymodules/CPAN-Mini-Inject-0.01.tar.gz' ) - $mcpi->writelist; - $mcpi->update_mirror; - $mcpi->inject; +$mcpi->writelist; +$mcpi->update_mirror; +$mcpi->inject; +``` # DESCRIPTION @@ -36,10 +38,12 @@ of private modules in a minimal CPAN mirror. Each method in CPAN::Mini::Inject returns a CPAN::Mini::Inject object which allows method chaining. For example: - my $mcpi=CPAN::Mini::Inject->new; - $mcpi->parsecfg - ->update_mirror - ->inject; +```perl +my $mcpi=CPAN::Mini::Inject->new; +$mcpi->parsecfg + ->update_mirror + ->inject; +``` A `CPAN::Mini::Inject` ISA [CPAN::Mini](https://metacpan.org/pod/CPAN::Mini). Refer to the [documentation](https://metacpan.org/pod/CPAN::Mini) for that module for details of the interface @@ -83,7 +87,9 @@ A `CPAN::Mini::Inject` ISA [CPAN::Mini](https://metacpan.org/pod/CPAN::Mini). Re a get on each site in order for authors/01mailrc.txt.gz. The first site to respond successfully is set as the instance variable site. - print "$mcpi->{site}\n"; # ftp://ftp.cpan.org/pub/CPAN + ``` + print "$mcpi->{site}\n"; # ftp://ftp.cpan.org/pub/CPAN + ``` `testremote` accepts an optional parameter to enable verbose mode. @@ -129,10 +135,12 @@ A `CPAN::Mini::Inject` ISA [CPAN::Mini](https://metacpan.org/pod/CPAN::Mini). Re ### Example - add( module => 'Module::Name', - authorid => 'AUTHOR', - version => 0.01, - file => './Module-Name-0.01.tar.gz' ); +```perl +add( module => 'Module::Name', + authorid => 'AUTHOR', + version => 0.01, + file => './Module-Name-0.01.tar.gz' ); +``` - `added_modules` diff --git a/inc/MyBuilder.pm b/inc/MyBuilder.pm index f4c337f..e25a11e 100644 --- a/inc/MyBuilder.pm +++ b/inc/MyBuilder.pm @@ -7,7 +7,7 @@ use FindBin; use Cwd qw(realpath); use File::Spec::Functions; -use Pod::Markdown; +use Pod::Markdown::Github; sub create_build_script { my ( $self, @args ) = @_; @@ -99,7 +99,7 @@ sub ACTION_docs { my $inject_pm = catfile($FindBin::Bin, "lib", "CPAN", "Mini", "Inject.pm"); my $readme_md = catfile($FindBin::Bin, "README.md"); - my $parser = Pod::Markdown->new( perldoc_url_prefix => 'metacpan' ); + my $parser = Pod::Markdown::Github->new( perldoc_url_prefix => 'metacpan' ); open my $in_file, "<", $inject_pm or die "Failed to open '$inject_pm': $!\n"; open my $out_file, ">", $readme_md or die "Failed to open '$readme_md': $!\n"; From 2b55cb5baa427520763b06a501ec8d5efd33d8bf Mon Sep 17 00:00:00 2001 From: Tudor Constantin Date: Wed, 8 Apr 2015 18:52:55 +0300 Subject: [PATCH 6/6] add Pod::Markdown::Github as a dependency instead of Pod::Markdown --- Build.PL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Build.PL b/Build.PL index e5ec0be..28e598a 100644 --- a/Build.PL +++ b/Build.PL @@ -38,7 +38,7 @@ my $builder = MyBuilder->new( 'IO::Zlib' => 0, 'LWP::Simple' => 0, 'Pod::Usage' => 0, - 'Pod::Markdown' => 0, + 'Pod::Markdown::Github' => 0, 'Test::More' => 0, 'YAML' => 0, 'File::Slurp' => 0,