[ic] Shipping calculation bug

Bruno Cantieni bruno at digi-land.com
Wed Aug 30 14:19:34 EDT 2006


 

> -----Original Message-----
> From: interchange-users-bounces at icdevgroup.org 
> [mailto:interchange-users-bounces at icdevgroup.org] On Behalf 
> Of Mike Heins
> Sent: August 30, 2006 12:17 PM
> To: interchange-users at icdevgroup.org
> Subject: Re: [ic] Shipping calculation bug
> 
> Quoting Mike Heins (mike at perusion.com):
> > 
> > Index: Util.pm
> > ===================================================================
> > RCS file: /var/cvs/interchange/lib/Vend/Util.pm,v
> > retrieving revision 2.95
> > diff -u -r2.95 Util.pm
> > --- Util.pm	16 Aug 2006 13:34:09 -0000	2.95
> > +++ Util.pm	30 Aug 2006 15:28:44 -0000
> > @@ -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+//;
> > 
> > I believe the value of the option is getting modified in place,
> > and that this should solve that.
> 
> Sorry, bad patch -- use this instead:
> 
> Index: Util.pm
> ===================================================================
> RCS file: /var/cvs/interchange/lib/Vend/Util.pm,v
> retrieving revision 2.95
> diff -u -r2.95 Util.pm
> --- Util.pm	16 Aug 2006 13:34:09 -0000	2.95
> +++ Util.pm	30 Aug 2006 16:16:20 -0000
> @@ -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+//;
> -- 
> Mike Heins

Works as promised.
Mike, you're my hero :)
I was pretty sure get_option_hash was the issue but was too bugeyed by now
to figure it out.


Bruno Cantieni

###########################################
Digital Landscape - Cyboretum.com
Web Applications * Web Hosting * e-Commerce
http://www.digi-land.com
http://www.cyboretum.com
bruno at digi-land.com
Phone/Fax: 1+905.668.2255
Toll free: 1+877.668.2345

Digital Landscape and Cyboretum.com are divisions of CBF Productions Inc.
 



More information about the interchange-users mailing list