Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Your named arguments

by etcshadow (Priest)
on Nov 08, 2005 at 04:57 UTC ( [id://506607]=note: print w/replies, xml ) Need Help??


in reply to Your named arguments

By the standard we use where I work, it would look like this:
sub convert { my ($args) = @_; AssertRequiredFields($args, [qw( from to thing )]); AssertValidFields( $args, [qw( from to thing )]); ... }
where AssertRequiredFields and AssertValidFields are fairly obvious core utility functions (which confess if the assertion is invalid), and $args is a hashref.

Yes, I know that it looks a little outdated... However, even though the codebase is under active development, some of it is still very old. Since nobody really feels like going back and retrofitting a million lines of code, we continue with the old (but still pretty good) standard.

------------ :Wq Not an editor command: Wq

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-09-15 13:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The PerlMonks site front end has:





    Results (21 votes). Check out past polls.

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.