| YAPC::NA 2004 | Perl Style Guides for Large Projects | #39 | 
| Bonus: Parameter Checking:Similar capabilities but different interface: 
 
         use Params::Validate qw(:all);
         sub foo  {
             validate( @_, { foo => 1, # mandatory
                             bar => 0, # optional
                           }
                     );
         }
 
        sub foo {
            my ($x, $y) = xgetargs(@_,
                -foo => 'i',             # mandatory, integer
                -bar => ['i', 0],        # optional integer, defaults to 0
            );
            # code use $x, $y, $z
        }
 | 
| << Previous | Index | Next >> | Copyright © 2004 Daniel Allen |