Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^3: RFC: New style for argument check in subs

by Anonymous Monk
on Sep 05, 2012 at 13:13 UTC ( #991841=note: print w/replies, xml ) Need Help??

in reply to Re^2: RFC: New style for argument check in subs
in thread RFC: New style for argument check in subs

use Filter::Simple ??? are you serious?

absolutely, makes things much nicer

use base 'Devel::Declare::MethodInstaller::Simple' ??? are you serious?

absolutely, its for those who want sugar but not source filters -- schwern says its reliable

nice but ... - overhead by extra sub call

HA! are you serous? You can't be serious :)

- parameters are unpacked into %p hash, i.e. you need to type $p{x} to access x

this isn't the only usage, there is validate_pos, and even as Attribute::Params::Validate

and you'll miss all the benefits of compiletime checks for lexicals like my $x.

What compile-time checks?

So any serious arguments other than clicking thru CPAN?

You're looking for arguments about something? About what?

Hey look, these are compile-time :) fields, Hash::Util::lock_keys, Sub::NamedParams

If you're referring to so which pattern do you think is better? to me there really isn't much difference between them -- not that your mission makes sense to me

Even if I'm typing this stuff myself, I'm fine with

defined $pos1 or die "missing arg"; defined $pos2 or $pos2 = 42;

but I wouldn't mix that and  my ($name1,$name2) = @arg{qw/name1 name2/};

I would use a hash or a flatlist

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://991841]
and the monastery is silent...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2018-01-19 22:09 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (223 votes). Check out past polls.