[interchange-cvs] interchange - racke modified lib/Vend/Util.pm
interchange-core@interchange.redhat.com
interchange-core@interchange.redhat.com
Thu Jan 31 12:56:01 2002
User: racke
Date: 2002-01-31 17:55:02 GMT
Modified: lib/Vend Util.pm
Log:
removed useless " from need_escape
errmsg don't call sprintf anymore if only one parameter is passed
which protects against unwanted expansion
Revision Changes Path
2.16 +12 -11 interchange/lib/Vend/Util.pm
rev 2.16, prev_rev 2.15
Index: Util.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Util.pm,v
retrieving revision 2.15
retrieving revision 2.16
diff -u -r2.15 -r2.16
--- Util.pm 30 Jan 2002 21:53:15 -0000 2.15
+++ Util.pm 31 Jan 2002 17:55:02 -0000 2.16
@@ -1,6 +1,6 @@
# Vend::Util - Interchange utility functions
#
-# $Id: Util.pm,v 2.15 2002/01/30 21:53:15 racke Exp $
+# $Id: Util.pm,v 2.16 2002/01/31 17:55:02 racke Exp $
#
# Copyright (C) 1996-2001 Red Hat, Inc. <interchange@redhat.com>
#
@@ -81,7 +81,7 @@
use Safe;
use subs qw(logError logGlobal);
use vars qw($VERSION @EXPORT @EXPORT_OK);
-$VERSION = substr(q$Revision: 2.15 $, 10);
+$VERSION = substr(q$Revision: 2.16 $, 10);
BEGIN {
eval {
@@ -123,7 +123,7 @@
}
my $string = "[^$ESCAPE_CHARS::ok_in_filename]";
- $need_escape = qr{"$string="};
+ $need_escape = qr{$string=};
}
@@ -1631,15 +1631,16 @@
elsif($Global::Locale and defined $Global::Locale->{$fmt}) {
$location = $Global::Locale;
}
- return sprintf $fmt, @strings if ! $location;
- if(ref $location->{$fmt}) {
- $fmt = $location->{$fmt}[0];
- @strings = @strings[ @{ $location->{$fmt}[1] } ];
- }
- else {
- $fmt = $location->{$fmt};
+ if($location) {
+ if(ref $location->{$fmt}) {
+ $fmt = $location->{$fmt}[0];
+ @strings = @strings[ @{ $location->{$fmt}[1] } ];
+ }
+ else {
+ $fmt = $location->{$fmt};
+ }
}
- return sprintf $fmt, @strings;
+ scalar(@strings) ? sprintf $fmt, @strings : $fmt;
}
*l = \&errmsg;