Eve::Support - an utility class that houses various helper functions
use Eve::Support; Eve::Support::arguments(\%arg_hash, my $required_argument, my $optional_argument = 'default value' );
The arguments() method makes it easier to specify a list of required and optional arguments in any other method. It can be used in both class method calls and usual subroutine calls.
arguments()
Here is an example in a usual subroutine:
sub usual_subroutine { my (%arg_hash) = @_; Eve::Support::arguments(\%arg_hash, my ($required_argument, $another_required_argument), my ($optional_argument, $optional_empty_argument) = (1, \undef) ); }
The same may be done in a class method call:
sub class_method { my ($self, %arg_hash) = @_; Eve::Support::arguments(\%arg_hash, my ($required_argument, $another_required_argument), my ($optional_argument, $optional_empty_argument) = ('default', \undef) ); }
If the function is called in the RVALUE context it skips the redundancy check and returns the rest of arguments that have not been processed as a hash reference.
sub foo { my (%arg_hash) = @_; my $rest_hash = Eve::Support::arguments( \%arg_hash, my $bar); return $rest_hash; }
Here the call foo(bar = 1, baz => 2, bad => 3)> will return the hash {'baz' = 2, 'bad' => 3}>.
foo(bar =
{'baz' =
\%arg_hash
A reference to a hash of arguments that has been passed into the current method.
@variable_list
A list of variables that have to be filled by values from the incoming \%arg_hash.
Eve::Error::Attribute
could not get a variable for a named argument, an argument is required or an argument is redundant.
list
A list containing only unique elements of the passed list.
mode
file
A filehandle.
Eve::Exception::InputOutput
in case of a file open error.
Key-value pair list.
A hash tied to Tie::IxHash.
A string.
Trimmed string.
Eve::Exception::Value
if the triming value is undefined.
Copyright 2012 Igor Zinovyev.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Eve, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Eve
CPAN shell
perl -MCPAN -e shell install Eve
For more information on module installation, please visit the detailed CPAN module installation guide.