NAME
Sub::Args - Simple check/get arguments.
SYNOPSIS
package Your::Class;
use Sub::Args;
sub foo {
my $class = shift;
my $args = args(
{
name => 1,
age => 0,
}
);
$args;
}
# got +{name => nekokak}
Your::Class->foo(
{
name => 'nekokak',
}
);
# got +{name => 'nekokak', age => 32}
Your::Class->foo(
{
name => 'nekokak',
age => 32,
}
);
# nick parameter don't defined for args method.
Your::Class->foo(
{
name => 'nekokak',
age => 32,
nick => 'inukaku',
}
);
# or
my $args = Your::Class->foo(
{
name => 'nekokak',
age => 32,
}
);
$args->{nick}; # for die.
# name arguments must required. for die.
Your::Class->foo(
{
age => 32,
}
);
or
package Your::Class;
use Sub::Args;
sub foo {
my $class = shift;
my $args = args(
{
name => 1,
age => 0,
}, @_
);
$args;
}
# got +{name => nekokak}
Your::Class->foo(
{
name => 'nekokak',
}
);
DESCRIPTION
This module makes your module more readable, and writable =p
AUTHOR
Atsushi Kobayashi <nekokak _at_ gmail _dot_ com>
CONTRIBUTORS
hirobanex : Hiroyuki Akabane
SEE ALSO
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.