Data-Math
view release on metacpan or search on metacpan
Given two hash references, returns a joint list of keys, and two
"qualified" versions of the hashes, where undef values are replaced
with default values based on the type of what's in the parallel
location in the other hash.
Example usage:
my ($keys, $qh1, $qh2) = $self->qualify_hash( $ds1, $ds2 );
qualify_array
Given two array references, returns the maximum index limit and two
"qualified" versions of the arrays, where undef values are replaced
with default values based on the type of what's in the parallel
location in the other hash.
Example usage:
my ( $limit, $aref1, $aref2 ) = $self->qualify_array( $aref1, $aref2 );
numeric_handler
Perform the indicated numeric operation on the two arguments. The
operation is passed in as an option named "op", included in the
options hashref in the third position.
Example usage:
my $result =
$self->numeric_handler( $ds1, $ds2, { op => '-' } );
string_handler
Handle two string arguments, according to the "string_policy" defined
for this object. The default string handling behavior is to pass
through the existing string if there's just one available or if there
are two, to concatenate them using the object's "join_char"
(typically a '|').
Other allowed values of "string_policy" are:
"pick_one" if there are two different values, use the first one.
"pick_2nd" if there are two different values, use the second.
Example usage:
my $result = $self->string_handler( $ds1, $ds2 );
# override object level string_policy
my $result = $self->string_handler( $ds1, $ds2, 'pick_one' );
TODO
o look into 'preserve_source' options and such to
improve memory efficiency
o try an operator overload interface
o examine possibility of arbitrary user-defineable
operations (pattern/action callbacks?)
AUTHOR
Joseph Brenner, <doom@kzsu.stanford.edu>
COPYRIGHT AND LICENSE
Copyright (C) 2016 by Joseph Brenner
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See http://dev.perl.org/licenses/ for more information.
( run in 2.222 seconds using v1.01-cache-2.11-cpan-cdf2f3d4e48 )