[interchange-cvs] interchange - heins modified lib/Vend/Util.pm
interchange-core@interchange.redhat.com
interchange-core@interchange.redhat.com
Wed Oct 31 17:23:59 2001
User: heins
Date: 2001-10-31 22:23:19 GMT
Modified: lib/Vend Tag: STABLE_4_8-branch Util.pm
Log:
* Fix variable suicide problem found by Javier Martin <martin@trymedia.com>.
Thanks for the good eye.
Revision Changes Path
No revision
No revision
2.1.2.1 +11 -11 interchange/lib/Vend/Util.pm
rev 2.1.2.1, prev_rev 2.1
Index: Util.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Util.pm,v
retrieving revision 2.1
retrieving revision 2.1.2.1
diff -u -r2.1 -r2.1.2.1
--- Util.pm 2001/08/06 16:16:57 2.1
+++ Util.pm 2001/10/31 22:23:19 2.1.2.1
@@ -1,6 +1,6 @@
# Vend::Util - Interchange utility functions
#
-# $Id: Util.pm,v 2.1 2001/08/06 16:16:57 heins Exp $
+# $Id: Util.pm,v 2.1.2.1 2001/10/31 22:23:19 mheins Exp $
#
# Copyright (C) 1996-2001 Red Hat, Inc. <interchange@redhat.com>
#
@@ -74,7 +74,7 @@
use Errno;
use subs qw(logError logGlobal);
use vars qw($VERSION @EXPORT @EXPORT_OK);
-$VERSION = substr(q$Revision: 2.1 $, 10);
+$VERSION = substr(q$Revision: 2.1.2.1 $, 10);
BEGIN {
eval {
@@ -764,17 +764,17 @@
}
sub get_option_hash {
- if (ref $_[0]) {
- return $_[0] unless ref $_[1];
- for(keys %{$_[1]}) {
- $_[0]->{$_} = $_[1]->{$_}
- unless defined $_[0]->{$_};
- }
- return $_[0];
- }
- return {} unless $_[0] =~ /\S/;
my $string = shift;
my $merge = shift;
+ if (ref $string) {
+ return $string unless ref $merge;
+ for(keys %{$merge}) {
+ $string->{$_} = $merge->{$_}
+ unless defined $string->{$_};
+ }
+ return $string;
+ }
+ return {} unless $string =~ /\S/;
$string =~ s/^\s+//;
$string =~ s/\s+$//;
if($string =~ /^{/ and $string =~ /}/) {