Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Prototyping Subs: Good,Bad,Indifferent

by lestrrat (Deacon)
on Aug 31, 2003 at 17:48 UTC ( [id://288043]=note: print w/replies, xml ) Need Help??


in reply to Prototyping Subs: Good,Bad,Indifferent

Here's something to read: Far More Than Everything You've Ever Wanted to Know about Prototypes in Perl.

I try not to use it in Perl partly because it gives you the false impression of security. While it enforces certain context/number of arguments, for some reason a lot of people I know tend to not validate their input if you have a function prototype. Which is really bad, especially when you try to make the transition from procedural to OO Perl, where no prototype check is done.

Plus it's really damn annoying when something like this compiles:

sub foo($) { ... } foo(@bar); # = foo( scalar( @bar ) ). argh.

I'd rather stick with Params::Validate

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-25 23:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found