* A. Pagaltzis <[EMAIL PROTECTED]> [2007-05-15 02:35]:
> * Matt S Trout <[EMAIL PROTECTED]> [2007-05-14 18:45]:
> > On Mon, May 14, 2007 at 09:15:18AM -0700, John Napiorkowski wrote:
> > > I'm personally attached to the following syntax:
> > >
> > > my $result = $dbic->resultset('MyApp')->find(xxx) ||
> > > $self->throw('Not Found Type Error');
> >
> > That'll still work whatever. What would break is
> >
> > my ($result) = ($dbic->resultset('MyApp')->find(xxx)) || ...;
> >
> > I suspect.
>
> No. The left-hand side of a boolean op is always in scalar context.
PS.: what you’re saying there *can* be expressed:
( my ( $result ) = $dbic->resultset( 'MyApp' )->find( xxx ) ) || ...;
That makes the assignment as a whole the left-hand side of the
boolean op, so the right-hand side of the assignment is not
affected by the boolean op’s enforced scalar context.
And this would indeed break if `find` returns undef explicitly,
because the return value of a list assignment in scalar context
is the number of rvalue elements, which would be 1 when an undef
is returned.
Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/