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

Re^3: return if defined

by AnomalousMonk (Canon)
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1009746]
help
Chatterbox?
[ambrus]: I think the minimal implementation here is just a timer and io function, plus pushing to the @REGISTRY.
[Corion]: ambrus: Yeah, at least that's what I think I'll start with. A timer and potentially the dummy IO function that never is ready
[ambrus]: That only lets you invoke the main loop from Prima->run;, not from AnyEvent->condvar- >recv; but that shouldn't matter
[Corion]: ambrus: Details ;)

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2016-12-08 12:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (141 votes). Check out past polls.