We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://rt.cpan.org/Ticket/Display.html?id=78368
FromCode files cannot be munged, so don't even try. --- lib/Dist/Zilla/Plugin/PkgVersion.pm | 1 + t/plugins/pkgversion.t | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/lib/Dist/Zilla/Plugin/PkgVersion.pm b/lib/Dist/Zilla/Plugin/PkgVersion.pm index 92c3c5f..a2c8a2f 100644 --- a/lib/Dist/Zilla/Plugin/PkgVersion.pm +++ b/lib/Dist/Zilla/Plugin/PkgVersion.pm @@ -73,6 +73,7 @@ sub munge_file { return if $file->name =~ /\.t$/i; return if any { $_ eq $file->name } @{ $self->skip_file }; + return if $file->isa('Dist::Zilla::File::FromCode'); return $self->munge_perl($file) if $file->name =~ /\.(?:pm|pl)$/i; return $self->munge_perl($file) if $file->content =~ /^#!(?:.*)perl(?:$|\s)/; return; diff --git a/t/plugins/pkgversion.t b/t/plugins/pkgversion.t index 1a88fac..97fb5a2 100644 --- a/t/plugins/pkgversion.t +++ b/t/plugins/pkgversion.t @@ -5,6 +5,7 @@ use Test::More 0.88; use lib 't/lib'; use autodie; +use Dist::Zilla::File::FromCode; use Test::DZil; my $with_version = ' @@ -106,6 +107,14 @@ my $tzil = Builder->from_config( }, ); +# XXX: I shouldn't be accessing internals here +# How do I add a FromCode file in add_files above? +my $fromcode = Dist::Zilla::File::FromCode->new({ + name => 'lib/DZT/FromCode.pm', + code => sub { return "package DZT::FromCode;\n1;\n" }, +}); +push @{$tzil->{files}}, $fromcode; + $tzil->build; my $dzt_sample = $tzil->slurp_file('build/lib/DZT/Sample.pm'); @@ -207,6 +216,13 @@ unlike( 'No version added for DZT::Skip::Package when it was excluded by skip_package directive' ); +my $dzt_fromcode = $tzil->slurp_file('build/lib/DZT/FromCode.pm'); +unlike( + $dzt_fromcode => qr{\$DZT::FromCode::VERSION}, + 'No version added for DZT::FromCode because it cannot be munged', +); +is $dzt_fromcode => $fromcode->content, 'fromcode content unchanged'; + { local $ENV{TRIAL} = 1; -- 1.7.9.5
The text was updated successfully, but these errors were encountered:
No branches or pull requests
https://rt.cpan.org/Ticket/Display.html?id=78368
The text was updated successfully, but these errors were encountered: