[interchange-cvs] interchange - heins modified lib/Vend/Util.pm
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Wed Aug 30 14:56:23 EDT 2006
User: heins
Date: 2006-08-30 18:56:23 GMT
Modified: lib/Vend Tag: STABLE_5_4-branch 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
No revision
No revision
2.87.2.2 +8 -7 interchange/lib/Vend/Util.pm
rev 2.87.2.2, prev_rev 2.87.2.1
Index: Util.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Util.pm,v
retrieving revision 2.87.2.1
retrieving revision 2.87.2.2
diff -u -r2.87.2.1 -r2.87.2.2
--- Util.pm 23 Dec 2005 15:47:52 -0000 2.87.2.1
+++ Util.pm 30 Aug 2006 18:56:22 -0000 2.87.2.2
@@ -1,6 +1,6 @@
# Vend::Util - Interchange utility functions
#
-# $Id: Util.pm,v 2.87.2.1 2005/12/23 15:47:52 kwalsh Exp $
+# $Id: Util.pm,v 2.87.2.2 2006/08/30 18:56:22 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.87.2.1 $, 10);
+$VERSION = substr(q$Revision: 2.87.2.2 $, 10);
my $Eval_routine;
my $Eval_routine_file;
@@ -846,13 +846,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