|
From: Chris W. <ch...@cw...> - 2002-01-29 20:17:08
|
On Tue, 2002-01-29 at 15:11, Ray Zimmerman wrote:
> Hi Chris,
>
> Here's a patch for SPOPS which fixes a problem with initialization
> data passed in to clone(). The problem is that a field which has a
> "true" value in the original object cannot be set to a false value by
> a hash passed to clone().
>
> --- SPOPS-0.56/SPOPS.pm Sun Jan 13 22:12:15 2002
> +++ SPOPS-0.56-patched/SPOPS.pm Tue Jan 29 14:37:51 2002
> @@ -183,7 +183,7 @@
> while ( my ( $k, $v ) = each %{ $self } ) {
> next unless ( $k );
> next if ( $id_field and $k eq $id_field );
> - $initial_data{ $k } = $p->{ $k } || $v;
> + $initial_data{ $k } = exists $p->{ $k } ? $p->{ $k } : $v;
> }
>
> return $class->new({ %initial_data, skip_default_values => 1 });
Thanks, applied.
(I always wanted to say that!)
Chris
--
Chris Winters (ch...@cw...)
Building enterprise-capable snack solutions since 1988.
|