Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: calling subs using references.

by rinceWind (Monsignor)
on May 22, 2007 at 14:46 UTC ( #616780=note: print w/replies, xml ) Need Help??


in reply to calling subs using references.

I have a niggle. There's a misquoted idiom in your constructor. The line is:

return bless {}, $caller || ref($caller);

If $caller is false, there's no way it can be a reference. The idiom you've misquoted has the or round the other way, which allows the user to pass in an existing object from which you derive the package name.

In practice, nobody's ever going to call new on an existing object. There's thus no need to document and test for this special case, just code it as:

return bless {}, $caller;

--
wetware hacker
(Qualified NLP Practitioner and Hypnotherapist)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (1)
As of 2022-01-16 19:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (49 votes). Check out past polls.

    Notices?