my $params = Hash::Param->new(parameters => {
qw/a 1 b 2 c 3/,
d => [qw/4 5 6 7/],
})
$result = $params->param( a ) # Returns 1
$result = $params->param( d ) # Returns 4
@result = $params->param( d ) # Returns 4, 5, 6, 7
@result = $params->params # Returns a, b, c, d
$result = $params->params # Returns { a => , b => 2,
c => 3, d => [ 4, 5, 6, 7 ] }
@result = $params->params( a, b, d ) # Returns 1, 2, [ 4, 5, 6, 7 ]
%result = $params->slice( a, b ) # Returns a => 1, b => 2
$params->param( a => 8 ) # Sets a to 8
$params->param( a => 8, 9 ) # Sets a to [ 8, 9 ]
The source repository is on GitHub: http://github.com/robertkrimen/hash-param/tree/master