Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
129 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package Devel::PatchPerl::Plugin; | ||
|
||
#ABSTRACT: Devel::PatchPerl plugins explained | ||
|
||
use strict; | ||
use warnings; | ||
|
||
qq[Plug it in]; | ||
|
||
=pod | ||
=head1 DESCRIPTION | ||
This document explains the L<Devel::PatchPerl> plugin system. | ||
Plugins are a mechanism for providing additional functionality to | ||
L<Devel::PatchPerl>. | ||
Plugins are searched for in the L<Devel::PatchPerl::Plugin> namespace. | ||
=head1 INITIALISATION | ||
The plugin constructor is C<patchperl>. | ||
A plugin is specified using the C<PERL5_PATCHPERL_PLUGIN> environment | ||
variable. It may either be specified in full (ie. C<Devel::PatchPerl::Plugin::Feegle>) | ||
or as the short part (ie. C<Feegle>). | ||
$ export PERL5_PATCHPERL_PLUGIN=Devel::PatchPerl::Plugin::Feegle | ||
$ export PERL5_PATCHPERL_PLUGIN=Feegle | ||
When L<Devel::PatchPerl> has identified the perl source patch and done its patching | ||
it will attempt to load the plugin identified. It will then call the class method | ||
C<patchperl> for the plugin package, with the following parameters: | ||
'version', the Perl version of the source tree; | ||
'source', the absolute path to the Perl source tree; | ||
'patchexe', the 'patch' utility that can be used; | ||
Plugins are called with the current working directory being the root of the | ||
Perl source tree, ie. C<source>. | ||
Summarised: | ||
$ENV{PERL5_PATCHPERL_PLUGIN} = 'Devel::PatchPerl::Plugin::Feegle'; | ||
my $plugin = $ENV{PERL5_PATCHPERL_PLUGIN}; | ||
eval "require $plugin"; | ||
eval { | ||
$plugin->patchperl( version => $vers, source => $srcdir, patchexe => $patch ); | ||
}; | ||
=head1 WHAT CAN PLUGINS DO? | ||
Anything you desire to a Perl source tree. | ||
=head1 WHY USE AN ENVIRONMENT VARIABLE TO SPECIFY PLUGINS? | ||
So that indicating a plugin to use can be specified independently of whatever mechanism is | ||
calling L<Devel::PatchPerl> to do its bidding. | ||
Think L<perlbrew>. | ||
=cut |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use strict; | ||
use warnings; | ||
use lib 't/lib'; | ||
BEGIN { | ||
$ENV{PERL5_PATCHPERL_PLUGIN} = 'TEST'; | ||
} | ||
use Test::More qq'no_plan'; | ||
use File::Spec; | ||
use Devel::PatchPerl; | ||
my $result = Devel::PatchPerl::_process_plugin(version => '5.14.2'); | ||
ok( $result, 'The result was okay' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package Devel::PatchPerl::Plugin::TEST; | ||
|
||
use strict; | ||
use warnings; | ||
|
||
sub patchperl { | ||
warn "I AM A TEST PLUGIN\n"; | ||
} | ||
|
||
qq[1]; |