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

Re^3: Object method prototypes?

by Puny Human (Initiate)
on Dec 14, 2007 at 01:39 UTC ( #656963=note: print w/replies, xml ) Need Help??


in reply to Re^2: Object method prototypes?
in thread Object method prototypes?

That works, as long as you don't mind creating and destroying an argument hash every time your method is called. Passing a hashref would avoid that, but unless you're writing performance-sensitive code it doesn't matter much.

Replies are listed 'Best First'.
Re^4: Object method prototypes?
by mreece (Friar) on Dec 14, 2007 at 02:32 UTC
    what's worse than copying the hash is having the called method (or another it calls) impolitely muck with your hashref by deleting or adding keys for its own purposes.

    next thing you know, you find yourself making a copy anyway so you can send an anon ref to that instead..

Re^4: Object method prototypes?
by ysth (Canon) on Dec 14, 2007 at 05:22 UTC
Re^4: Object method prototypes?
by blazar (Canon) on Dec 14, 2007 at 15:41 UTC

    I personally believe that passing a hashref would also create and destroy a hash every time your method is called. Additionally, it would take a reference to it. So the performance-sensitive comment is completely moot.

    --
    If you can't understand the incipit, then please check the IPB Campaign.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2021-02-28 13:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?