summaryrefslogtreecommitdiff
path: root/scripts/Dpkg/Index.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/Index.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/Index.pm')
-rw-r--r--scripts/Dpkg/Index.pm14
1 files changed, 7 insertions, 7 deletions
diff --git a/scripts/Dpkg/Index.pm b/scripts/Dpkg/Index.pm
index 9d54bb771..60d4b9167 100644
--- a/scripts/Dpkg/Index.pm
+++ b/scripts/Dpkg/Index.pm
@@ -18,7 +18,7 @@ package Dpkg::Index;
use strict;
use warnings;
-our $VERSION = "1.00";
+our $VERSION = '1.00';
use Dpkg::Gettext;
use Dpkg::ErrorHandling;
@@ -100,18 +100,18 @@ sub set_options {
$self->{get_key_func} = sub { return $_[0]->{Source}; };
} elsif ($t == CTRL_CHANGELOG) {
$self->{get_key_func} = sub {
- return $_[0]->{Source} . "_" . $_[0]->{Version};
+ return $_[0]->{Source} . '_' . $_[0]->{Version};
};
} elsif ($t == CTRL_FILE_CHANGES) {
$self->{get_key_func} = sub {
- return $_[0]->{Source} . "_" . $_[0]->{Version} . "_" .
+ return $_[0]->{Source} . '_' . $_[0]->{Version} . '_' .
$_[0]->{Architecture};
};
} elsif ($t == CTRL_FILE_VENDOR) {
$self->{get_key_func} = sub { return $_[0]->{Vendor}; };
} elsif ($t == CTRL_FILE_STATUS) {
$self->{get_key_func} = sub {
- return $_[0]->{Package} . "_" . $_[0]->{Architecture};
+ return $_[0]->{Package} . '_' . $_[0]->{Architecture};
};
}
}
@@ -219,11 +219,11 @@ sub get_keys {
my ($self, %crit) = @_;
my @selected = @{$self->{order}};
foreach my $s_crit (keys %crit) { # search criteria
- if (ref($crit{$s_crit}) eq "Regexp") {
+ if (ref($crit{$s_crit}) eq 'Regexp') {
@selected = grep {
$self->{items}{$_}{$s_crit} =~ $crit{$s_crit}
} @selected;
- } elsif (ref($crit{$s_crit}) eq "CODE") {
+ } elsif (ref($crit{$s_crit}) eq 'CODE') {
@selected = grep {
&{$crit{$s_crit}}($self->{items}{$_}{$s_crit});
} @selected;
@@ -330,7 +330,7 @@ Print the string representation of the index to a filehandle.
sub output {
my ($self, $fh) = @_;
- my $str = "";
+ my $str = '';
foreach my $key ($self->get_keys()) {
if (defined $fh) {
print $fh $self->get_by_key($key) . "\n";