summaryrefslogtreecommitdiffstats
path: root/MDK/Common
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-11-15 12:37:11 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-11-15 12:37:11 +0000
commit749daba8115512bb19567dc4404da035c583c7ab (patch)
treec276380b7b91ed8f8f0cf0e8a9ea2cf3f817132d /MDK/Common
parent3e374c857eccccc6929f86daea3da51e3dd6f7f1 (diff)
downloadperl-MDK-Common-749daba8115512bb19567dc4404da035c583c7ab.tar
perl-MDK-Common-749daba8115512bb19567dc4404da035c583c7ab.tar.gz
perl-MDK-Common-749daba8115512bb19567dc4404da035c583c7ab.tar.bz2
perl-MDK-Common-749daba8115512bb19567dc4404da035c583c7ab.tar.xz
perl-MDK-Common-749daba8115512bb19567dc4404da035c583c7ab.zip
make it perl_checker compliant
Diffstat (limited to 'MDK/Common')
-rw-r--r--MDK/Common/File.pm6
-rw-r--r--MDK/Common/Func.pm10
-rw-r--r--MDK/Common/Math.pm2
-rw-r--r--MDK/Common/String.pm4
-rw-r--r--MDK/Common/Various.pm4
5 files changed, 13 insertions, 13 deletions
diff --git a/MDK/Common/File.pm b/MDK/Common/File.pm
index d67da06..1bec2f5 100644
--- a/MDK/Common/File.pm
+++ b/MDK/Common/File.pm
@@ -110,8 +110,8 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK);
sub dirname { local $_ = shift; s|[^/]*/*\s*$||; s|(.)/*$|$1|; $_ || '.' }
sub basename { local $_ = shift; s|/*\s*$||; s|.*/||; $_ }
-sub cat_ { local *F; open F, $_[0] or return; my @l = <F>; wantarray ? @l : join '', @l }
-sub cat__ { my ($f) = @_; my @l = <$f>; wantarray ? @l : join '', @l }
+sub cat_ { local *F; open F, $_[0] or return; my @l = <F>; wantarray() ? @l : join '', @l }
+sub cat__ { my ($f) = @_; my @l = <$f>; wantarray() ? @l : join '', @l }
sub output { my $f = shift; local *F; open F, ">$f" or die "output in file $f failed: $!\n"; print F foreach @_ }
sub append_to_file { my $f = shift; local *F; open F, ">>$f" or die "output in file $f failed: $!\n"; print F foreach @_ }
sub output_p { my $f = shift; mkdir_p(dirname($f)); output($f, @_) }
@@ -194,7 +194,7 @@ sub all {
}
sub glob_ {
- my ($d, $f) = ($_[0] =~ /\*/) ? (dirname($_[0]), basename($_[0])) : ($_[0], '*');
+ my ($d, $f) = $_[0] =~ /\*/ ? (dirname($_[0]), basename($_[0])) : ($_[0], '*');
$d =~ /\*/ and die "glob_: wildcard in directory not handled ($_[0])\n";
($f = quotemeta $f) =~ s/\\\*/.*/g;
diff --git a/MDK/Common/Func.pm b/MDK/Common/Func.pm
index b655ec8..c77b588 100644
--- a/MDK/Common/Func.pm
+++ b/MDK/Common/Func.pm
@@ -159,14 +159,14 @@ sub may_apply { $_[0] ? $_[0]->($_[1]) : (@_ > 2 ? $_[2] : $_[1]) }
sub if_($@) {
my $b = shift;
$b or return ();
- wantarray || @_ <= 1 or die("if_ called in scalar context with more than one argument " . join(":", caller()));
- wantarray ? @_ : $_[0];
+ wantarray() || @_ <= 1 or die("if_ called in scalar context with more than one argument " . join(":", caller()));
+ wantarray() ? @_ : $_[0];
}
sub if__($@) {
my $b = shift;
defined $b or return ();
- wantarray || @_ <= 1 or die("if_ called in scalar context with more than one argument " . join(":", caller()));
- wantarray ? @_ : $_[0];
+ wantarray() || @_ <= 1 or die("if_ called in scalar context with more than one argument " . join(":", caller()));
+ wantarray() ? @_ : $_[0];
}
sub fold_left(&@) {
@@ -259,7 +259,7 @@ sub add_f4before_leaving {
my $f = $list->{$_[0]}{$name} or die '';
$name eq 'DESTROY' and delete $list->{$_[0]};
&$f;
- } unless defined &{*N};
+ } if !defined &{*N};
}
diff --git a/MDK/Common/Math.pm b/MDK/Common/Math.pm
index a261433..c467150 100644
--- a/MDK/Common/Math.pm
+++ b/MDK/Common/Math.pm
@@ -128,7 +128,7 @@ sub sign { $_[0] <=> 0 }
sub round { int($_[0] + 0.5) }
sub round_up { my ($i, $r) = @_; $i = int $i; $i += $r - ($i + $r - 1) % $r - 1 }
sub round_down { my ($i, $r) = @_; $i = int $i; $i -= $i % $r }
-sub divide { my $d = int $_[0] / $_[1]; wantarray ? ($d, $_[0] % $_[1]) : $d }
+sub divide { my $d = int $_[0] / $_[1]; wantarray() ? ($d, $_[0] % $_[1]) : $d }
sub min { my $n = shift; $_ < $n and $n = $_ foreach @_; $n }
sub max { my $n = shift; $_ > $n and $n = $_ foreach @_; $n }
sub or_ { my $n = 0; $n ||= $_ foreach @_; $n }
diff --git a/MDK/Common/String.pm b/MDK/Common/String.pm
index b5a588c..bac5a24 100644
--- a/MDK/Common/String.pm
+++ b/MDK/Common/String.pm
@@ -82,7 +82,7 @@ sub bestMatchSentence {
}
$best = $count, $bestSentence = $_ if $count > $best;
}
- wantarray ? ($bestSentence, $best) : $bestSentence;
+ wantarray() ? ($bestSentence, $best) : $bestSentence;
}
@@ -149,7 +149,7 @@ sub warp_text {
}
push @l, "$beg$t";
}
- wantarray ? @l : join("\n", @l);
+ wantarray() ? @l : join("\n", @l);
}
1;
diff --git a/MDK/Common/Various.pm b/MDK/Common/Various.pm
index 841d486..8a12c14 100644
--- a/MDK/Common/Various.pm
+++ b/MDK/Common/Various.pm
@@ -113,7 +113,7 @@ sub bool2text { $_[0] ? "true" : "false" }
sub bool2yesno { $_[0] ? "yes" : "no" }
sub text2bool { my $t = lc($_[0]); $t eq "true" || $t eq "yes" ? 1 : 0 }
-sub chomp_ { my @l = map { my $l = $_; chomp $l; $l } @_; wantarray ? @l : $l[0] }
+sub chomp_ { my @l = map { my $l = $_; chomp $l; $l } @_; wantarray() ? @l : $l[0] }
sub backtrace {
my $s;
@@ -129,7 +129,7 @@ sub internal_error {
}
sub noreturn {
- if (defined wantarray) {
+ if (defined wantarray()) {
my ($package, $file, $line, $func) = caller(1);
my (undef, undef, undef, $func2) = caller(2);
die "$file:$line: $func2() expects a value from $func(), but $func() doesn't return any value\n";