Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: return if defined

by AnomalousMonk (Abbot)
on Dec 20, 2012 at 13:42 UTC ( #1009746=note: print w/ replies, xml ) Need Help??


in reply to Re^2: return if defined
in thread return if defined

Clever, but maybe a little too clever. This isn't the clearest construct in the world ...

But I thought the whole point of the OP was to be too clever by half, and clarity be damned.

IMHO, the pair of statements
    my $existing_result = $self->find_by_something(@args);
    return $existing_result if (defined $existing_result);
is perfectly clear and sufficiently unclever to help me avoid future foot trauma.


Comment on Re^3: return if defined
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1009746]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2015-07-07 02:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (86 votes), past polls