Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Dist-Zilla CPAN distribution.

Report information
The Basics
Id: 78368
Status: new
Priority: 0/
Queue: Dist-Zilla

People
Owner: Nobody in particular
Requestors: doherty [...] cs.dal.ca
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



CC: Mike Doherty <doherty [...] cs.dal.ca>
Subject: [PATCH] PkgVersion: Don't attempt to munge FromCode files
Date: Sat, 14 Jul 2012 01:30:13 -0300
To: bug-Dist-Zilla [...] rt.cpan.org
From: Mike Doherty <doherty [...] cs.dal.ca>
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