http://qs321.pair.com?node_id=656963


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.