Re: [CDBI] Updating data automatically after a search (trigger)

[prev] [thread] [next] [Date index for 2006/02/01]

From: Bill Moseley
Subject: Re: [CDBI] Updating data automatically after a search (trigger)
Date: 19:54 on 01 Feb 2006
On Wed, Feb 01, 2006 at 02:35:36PM -0500, Perrin Harkins wrote:

use strict;
use warnings;

    foo(1);
    foo(0);
    foo(0);

    sub foo {
        my $arg = shift;
        my $bar = {} if $arg;
        $bar ||= {};
        print "bar: $bar\n";
    }

    bar: HASH(0x814ac28)
    bar: HASH(0x814ada8)
    bar: HASH(0x814ada8)

That's nasty.

So it seems like from perldiag that people have exploited this bug,
and that the warning is to tell them that the behavior will go away
and the bug will be fixed.  So in the future that construct will work.


The bug doesn't show up in a perhaps more common situation:

    use strict;
    use warnings;

    foo(1);
    foo(0);
    foo(0);
    foo(1);

    sub foo {
        my $arg = shift;
        my $bar = 1 if $arg;
        print "bar is ", $bar ? "set\n" : "not set\n";
    }

    bar is set
    bar is not set
    bar is not set
    bar is set






        -- 
        Bill Moseley
moseley@xxxx.xxx


_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

Re: [CDBI] Updating data automatically after a search (trigger)
Bill Moseley 19:54 on 01 Feb 2006

Generated at 17:59 on 03 Feb 2006 by mariachi v0.52