Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

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?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2023-06-05 07:28 GMT
Find Nodes?
    Voting Booth?
    How often do you go to conferences?

    Results (23 votes). Check out past polls.