[interchange-cvs] interchange - heins modified lib/Vend/Util.pm
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Wed Aug 30 14:53:45 EDT 2006
User: heins
Date: 2006-08-30 18:53:45 GMT
Modified: lib/Vend Util.pm
Log:
* Fix problem where get_option_hash would return the reference itself
when passed one. We need to return a copy so that we can be assured
we won't modify a configuration value improperly. Since the user is
asking for an option hash from a possible string, they should not ever
need or want the exact same reference back.
Most of the work done by Bruno Cantieni.
Revision Changes Path
2.96 +8 -7 interchange/lib/Vend/Util.pm
rev 2.96, prev_rev 2.95
Index: Util.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Util.pm,v
retrieving revision 2.95
retrieving revision 2.96
diff -u -r2.95 -r2.96
--- Util.pm 16 Aug 2006 13:34:09 -0000 2.95
+++ Util.pm 30 Aug 2006 18:53:44 -0000 2.96
@@ -1,6 +1,6 @@
# Vend::Util - Interchange utility functions
#
-# $Id: Util.pm,v 2.95 2006/08/16 13:34:09 mheins Exp $
+# $Id: Util.pm,v 2.96 2006/08/30 18:53:44 mheins Exp $
#
# Copyright (C) 2002-2005 Interchange Development Group
# Copyright (C) 1996-2002 Red Hat, Inc.
@@ -88,7 +88,7 @@
use Vend::File;
use subs qw(logError logGlobal);
use vars qw($VERSION @EXPORT @EXPORT_OK);
-$VERSION = substr(q$Revision: 2.95 $, 10);
+$VERSION = substr(q$Revision: 2.96 $, 10);
my $Eval_routine;
my $Eval_routine_file;
@@ -892,13 +892,14 @@
sub get_option_hash {
my $string = shift;
my $merge = shift;
- if (ref $string) {
- return $string unless ref $merge;
+ if (ref $string eq 'HASH') {
+ my $ref = { %$string };
+ return $ref unless ref $merge;
for(keys %{$merge}) {
- $string->{$_} = $merge->{$_}
- unless defined $string->{$_};
+ $ref->{$_} = $merge->{$_}
+ unless defined $ref->{$_};
}
- return $string;
+ return $ref;
}
return {} unless $string and $string =~ /\S/;
$string =~ s/^\s+//;
More information about the interchange-cvs
mailing list