App-CamelPKI
view release on metacpan or search on metacpan
inc/My/Module/Build.pm view on Meta::CPAN
$node->{no_index} = $self->{properties}->{add_to_no_index} || {};
$node->{no_index}->{directory} ||= [];
unshift(@{$node->{no_index}->{directory}}, qw(examples inc t),
(map { File::Spec::Unix->catdir("lib", split m/::/) }
(@{$node->{no_index}->{namespace} || []})));
foreach my $package (keys %{$node->{provides}}) {
delete $node->{provides}->{$package} if
(grep {$package =~ m/^\Q$_\E/}
@{$node->{no_index}->{namespace} || []});
delete $node->{provides}->{$package} if
(grep {$package eq $_}
@{$node->{no_index}->{package} || []});
}
my $metafile =
$self->can("metafile") ? # True as of Module::Build 0.2805
$self->metafile() : $self->{metafile};
# YAML API changed after version 0.30
my $yaml_sub =
($YAML::VERSION le '0.30' ? \&YAML::StoreFile : \&YAML::DumpFile);
$yaml_sub->($metafile, $node)
or die "Could not write to $metafile: $!";
;
}
=item I<customize_env(%env)>
Returns a copy of %env, an environment hash, modified in a
package-specific fashion. To be used typically as
local %ENV = $self->customize_env(%ENV);
The default implementation sets PERL_INLINE_BUILD_NOISY to 1 and also
sets FULL_DEBUGGING if so directed by the command line (see L</
ACTION_test>).
=cut
sub customize_env {
my ($self, %env) = @_;
delete $env{FULL_DEBUGGING};
$env{PERL_INLINE_BUILD_NOISY} = 1;
$env{FULL_DEBUGGING} = 1 if ($self->{args}->{full_debugging});
return %env;
}
=item I<process_pm_files>
Called internally in Build to convert lib/**.pm files into their
blib/**.pm counterpart; overloaded here to remove the test suite (see
L</Unit tests>) and standardize the copyright of the files authored by
me.
=cut
sub process_pm_files {
no warnings "once";
local *copy_if_modified = \*process_pm_file_if_modified;
my $self = shift;
return $self->SUPER::process_pm_files(@_);
}
=item I<process_pm_file_if_modified(%args)>
Does the same as L<copy_file_if_modified> (which it actually replaces
while L<process_pm_files> runs), except that the L</new_pm_filter> is
applied instead of performing a vanilla copy as L<Module::Build> does.
=cut
sub process_pm_file_if_modified {
my ($self, %args) = @_;
my ($from, $to) = @args{qw(from to)};
return if $self->up_to_date($from, $to); # Already fresh
mkpath(dirname($to), 0, 0777);
# Do a filtering copy
print "$from -> $to\n" if $args{verbose};
die "Cannot open $from for reading: $!\n" unless
(my $fromfd = new IO::File($from, "r"));
die "Cannot open $to for writing: $!\n" unless
(my $tofd = new IO::File($to, "w"));
my $filter = $self->new_pm_filter;
while(my $line = <$fromfd>) {
my $moretext = $filter->filter($line);
if (defined($moretext) && length($moretext)) {
$tofd->print($moretext) or
die "Cannot write to $to: $!\n";
}
last if $filter->eof_reached();
}
$tofd->close() or die "Cannot close to $to: $!\n";
}
=item I<new_pm_filter>
Creates and returns a fresh filter object (see
L</My::Module::Build::PmFilter Ancillary Class>) that will be used by
L</process_pm_file_if_modified> to process the text of the .pm files.
Subclasses may find it convenient to overload I<new_pm_filter> in
order to provide a different filter. The filter object should obey
the API set forth in L</My::Module::Build::PmFilter Ancillary Class>,
although it need not inherit from same.
=cut
sub new_pm_filter { My::Module::Build::PmFilter->new }
=item I<find_test_files()>
Overloaded from parent class to treat all .pm files in C<lib/> and
C<t/lib/> as unit tests if they use L<My::Tests::Below>, to look for
C<.t> files in C<examples/>, and to retain C<.t> test files in
C<t/maintainer> if and only if L</maintainer_mode_enabled> is true.
=cut
( run in 1.663 second using v1.01-cache-2.11-cpan-39bf76dae61 )