summaryrefslogtreecommitdiff
path: root/scripts/Dpkg/Source/Functions.pm
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2012-12-31 21:43:39 +0100
committerGuillem Jover <guillem@debian.org>2013-05-04 19:03:13 +0200
commit6a73e3078b01a71d4a6ea90c85da16523ed56f1d (patch)
tree4cc7a210e7e851395f7ba4989e3aac4aa9d32710 /scripts/Dpkg/Source/Functions.pm
parent62bc788a45e4a641c28ca9c8c5b9bb08f29faed8 (diff)
downloaddpkg-6a73e3078b01a71d4a6ea90c85da16523ed56f1d.tar.gz
Do not use double-quotes on strings that do not need interpolation
Using double-quotes imposes a small performance penalty as the perl parser needs to check if any interpolation is needed. Use double-quotes only when the string contains single-quotes. Ideally we'd use double-quotes too for escaped meta-characters that might otherwise be confusing to immediately see if they need interpolation or not, but the policy does not (currently) allow to ignore these. Fixes ValuesAndExpressions::ProhibitInterpolationOfLiterals. Warned-by: perlcritic
Diffstat (limited to 'scripts/Dpkg/Source/Functions.pm')
-rw-r--r--scripts/Dpkg/Source/Functions.pm12
1 files changed, 6 insertions, 6 deletions
diff --git a/scripts/Dpkg/Source/Functions.pm b/scripts/Dpkg/Source/Functions.pm
index 10a9d7af0..d830b0b5f 100644
--- a/scripts/Dpkg/Source/Functions.pm
+++ b/scripts/Dpkg/Source/Functions.pm
@@ -16,7 +16,7 @@ package Dpkg::Source::Functions;
use strict;
use warnings;
-our $VERSION = "0.01";
+our $VERSION = '0.01';
use base qw(Exporter);
our @EXPORT_OK = qw(erasedir fixperms fs_time is_binary);
@@ -31,7 +31,7 @@ sub erasedir {
my ($dir) = @_;
if (not lstat($dir)) {
return if $! == ENOENT;
- syserr(_g("cannot stat directory %s (before removal)"), $dir);
+ syserr(_g('cannot stat directory %s (before removal)'), $dir);
}
system 'rm','-rf','--',$dir;
subprocerr("rm -rf $dir") if $?;
@@ -75,14 +75,14 @@ sub fs_time($) {
my ($file) = @_;
my $is_temp = 0;
if (not -e $file) {
- open(my $temp_fh, ">", $file) or syserr(_g("cannot write %s"));
+ open(my $temp_fh, '>', $file) or syserr(_g('cannot write %s'));
close($temp_fh);
$is_temp = 1;
} else {
utime(undef, undef, $file) or
- syserr(_g("cannot change timestamp for %s"), $file);
+ syserr(_g('cannot change timestamp for %s'), $file);
}
- stat($file) or syserr(_g("cannot read timestamp from %s"), $file);
+ stat($file) or syserr(_g('cannot read timestamp from %s'), $file);
my $mtime = (stat(_))[9];
unlink($file) if $is_temp;
return $mtime;
@@ -112,7 +112,7 @@ sub is_binary($) {
last;
}
}
- close($diffgen) or syserr("close on diff pipe");
+ close($diffgen) or syserr('close on diff pipe');
wait_child($diff_pid, nocheck => 1, cmdline => "diff -u -- /dev/null $file");
return $result;
}