On 9/23/05 6:32 AM, Uwe Voelker wrote:
> Rose::DB::Object line 240:
> 
>>   $self->{STATE_IN_DB()} = 1;
>>   return $self || 1;
>> }
> 
> Doesn't this lead to an error? If $self is undef (or false) how can you
> assign the STATE_IN_DB flag? Or does $self override the stringification
> (or something else)?
> 
> I'm confused ;-)

The "... || 1" is there just in case $self has its boolean value overloaded
with the overload.pm module.  In Perl 5, all references are "true" normally,
but it's possible to change that if you really want to:

    package Foo;
    #use overload bool => sub { 0 };
    bless $o = {}, 'Foo';
    $o || print "$o is false!\n"; # this prints the msg

If someone does that with an RDBO-derived class, then they can't use the
shortcuts.  But it's not very common, and the behavior is documented.  Plus,
the "long way" is not very long anyway :)

-John




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Rose-db-object mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to