in reply to Passing by Named Parameter
use Class::ParmList qw (parse_parms simple_parms); sub something { my ($file, $other) = simple_parms(['-file','-other'],@_); } sub otherthing { my $parms = parse_parms({ -parms => \@_, -legal => [qw (-textcolor -border -cellpadding)], -required => [qw (-bgcolor)], -defaults => { -bgcolor => "#ffffff", -textcolor => "#000000" } }); if (not $parms) { my $error_message = Class::ParmList->error; die ($error_message); } my ($text_color) = $parms->get('-textcolor'); }
|
|---|