Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: Preferred technique for named subroutine parameters?

by spacebat (Beadle)
on May 26, 2009 at 22:36 UTC ( #766302=note: print w/replies, xml ) Need Help??

in reply to Preferred technique for named subroutine parameters?

While I lean towards the flat list, I dislike more having to remember which convention is required in a particular piece of code. So I tend to support both forms:
sub new { my $class = shift; my $args = (ref $_[0] eq 'HASH') ? shift : { @_ }; # ... }
update: possibly bad example - that's how I retrofit some of the legacy code at work. New code would inherit new() from Moose or Mouse :)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://766302]
[Discipulus]: nice Perl dreams, folks.. shower->Dumas->bed
[erix]: pere ou fils?
[Lady_Aleena]: Discipulus, good night.
[Discipulus]: pere, le vicomte de bragelonne.. wonderfull
[erix]: I'll keep that in mind (haven't read), buona notte :)
[Discipulus]: oh erix but is the fourth of cycle;read them in order
[erix]: hm, perhaps I can just read it here
Discipulus zzz...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (12)
As of 2017-05-23 20:01 GMT
Find Nodes?
    Voting Booth?