diff options
author | Russ Allbery <eagle@eyrie.org> | 2018-06-03 17:42:07 -0700 |
---|---|---|
committer | Russ Allbery <eagle@eyrie.org> | 2018-06-03 17:42:07 -0700 |
commit | 9ab7e03e968734819a717354d4bc91295404fafd (patch) | |
tree | 3d4d5a64a0a3af449d236c5c350183109bdb2abc /tests/tap/perl/Test/RRA/ModuleVersion.pm | |
parent | edf31eba414d9a105791c076fb1444a78d210dff (diff) | |
parent | b320ea60b2761fc984fe2870a718da1ef7fc7440 (diff) |
New upstream version 1.4
Diffstat (limited to 'tests/tap/perl/Test/RRA/ModuleVersion.pm')
-rw-r--r-- | tests/tap/perl/Test/RRA/ModuleVersion.pm | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/tests/tap/perl/Test/RRA/ModuleVersion.pm b/tests/tap/perl/Test/RRA/ModuleVersion.pm index 49acac4..8b6dba2 100644 --- a/tests/tap/perl/Test/RRA/ModuleVersion.pm +++ b/tests/tap/perl/Test/RRA/ModuleVersion.pm @@ -129,21 +129,23 @@ sub _module_version { # Throws: Text exception on I/O failure or inability to find version sub _update_module_version { my ($file, $version) = @_; - open(my $in, q{<}, $file) or die "$0: cannot open $file: $!\n"; - open(my $out, q{>}, "$file.new") - or die "$0: cannot create $file.new: $!\n"; - # If the version starts with v, use it without quotes. Otherwise, quote - # it to prevent removal of trailing zeroes. - if ($version !~ m{ \A v }xms) { - $version = "'$version'"; + # The old-style syntax may require different quoting. If the version + # starts with v, use it without quotes. Otherwise, quote it to prevent + # removal of trailing zeroes. + my $old_version = $version; + if ($old_version !~ m{ \A v }xms) { + $old_version = "'$old_version'"; } # Scan for the version and replace it. + open(my $in, q{<}, $file) or die "$0: cannot open $file: $!\n"; + open(my $out, q{>}, "$file.new") + or die "$0: cannot create $file.new: $!\n"; SCAN: while (defined(my $line = <$in>)) { if ( $line =~ s{ $REGEX_VERSION_PACKAGE }{$1$version$3}xms - || $line =~ s{ $REGEX_VERSION_OLD }{$1$version$3}xms) + || $line =~ s{ $REGEX_VERSION_OLD }{$1$old_version$3}xms) { print {$out} $line or die "$0: cannot write to $file.new: $!\n"; last SCAN; @@ -267,7 +269,7 @@ Russ Allbery <eagle@eyrie.org> =head1 COPYRIGHT AND LICENSE -Copyright 2016 Russ Allbery <eagle@eyrie.org> +Copyright 2016, 2018 Russ Allbery <eagle@eyrie.org> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal |