Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^4: getting 2 things done at once with Class::Base (return undef)

by jplindstrom (Monsignor)
on Nov 02, 2007 at 14:07 UTC ( [id://648650]=note: print w/replies, xml ) Need Help??


in reply to Re^3: getting 2 things done at once with Class::Base (return undef)
in thread getting 2 things done at once with Class::Base

It is indeed in PBP, but IMHO this is one of the less thought through practices. The example and problem described in the book applies to a specific situation, but the conclusion/solution is then elevated to a general practice.

The real lesson here is: if the sub is documented to return a scalar and it uses a return code to signal failure, it should return a scalar. It shouldn't randomly introduce context sensitivity in case of failure.

/J

  • Comment on Re^4: getting 2 things done at once with Class::Base (return undef)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2026-01-16 11:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (118 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.