in reply to Re: Re: Re: accessing Apache::DBI 'cached connections'
in thread accessing Apache::DBI 'cached connections'

Your post sounded so good, I  ++'d it, but it's wrong.

#!/usr/bin/perl -w my $DBH ||= retval('1'); print "$DBH\n"; sub retval { return $_[0] }

This prints '1'.

Update: Oddly enough, Camel 3 calls 'my' a named unary operator and lists named unary operators at higher precedence than any of assignment, assignment operators or logical operators, so you should be right, but the code doesn't work that way for me, at least not on 5.8.0 or 5.005_03.

Newer Update: 'my' probably does have higher precedence thatn ||=, but it doesn't matter because it returns false.

my $orr || print "or\n"; my $andd && print "and\n";

prints 'or'.

--Bob Niederman, http://bob-n.com

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: accessing Apache::DBI 'cached connections'
by perrin (Chancellor) on Jul 21, 2003 at 21:41 UTC
    You're right, the DBI->connect part will get executed. However, since he has || and not ||=, it will just get thrown away.

      That's for sure, was pointed out previously. BTW, see my update above - interesting, no?

      --Bob Niederman, http://bob-n.com