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: 78366
Status: resolved
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 save if file unchanged
Date: Sat, 14 Jul 2012 00:12:25 -0300
To: bug-Dist-Zilla [...] rt.cpan.org
From: Mike Doherty <doherty [...] cs.dal.ca>
PkgVersion always attempted to save the file, regardless whether it had changed. Now, we track whether the file was successfully munged, and only save if so. This is an optimization for the case where no changes are made. --- lib/Dist/Zilla/Plugin/PkgVersion.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Dist/Zilla/Plugin/PkgVersion.pm b/lib/Dist/Zilla/Plugin/PkgVersion.pm index 7eb8e05..5b7d748 100644 --- a/lib/Dist/Zilla/Plugin/PkgVersion.pm +++ b/lib/Dist/Zilla/Plugin/PkgVersion.pm @@ -81,6 +81,7 @@ sub munge_perl { my %seen_pkg; + my $munged = 0; for my $stmt (@$package_stmts) { my $package = $stmt->namespace; @@ -112,9 +113,10 @@ sub munge_perl { Carp::carp("error inserting version in " . $file->name) unless $stmt->insert_after($children[0]->clone) and $stmt->insert_after( PPI::Token::Whitespace->new("\n") ); + $munged = 1; } - $self->save_ppi_document_to_file($document, $file); + $self->save_ppi_document_to_file($document, $file) if $munged; } __PACKAGE__->meta->make_immutable; -- 1.7.9.5
Thanks, merged! -- rjbs