Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

autobox::list::util(3pm) [debian man page]

autobox::List::Util(3pm)				User Contributed Perl Documentation				  autobox::List::Util(3pm)

NAME
autobox::List::Util - bring the List::Util functions to autobox VERSION
Version 20090629 SYNOPSIS
"autobox::List::Util" brings all of the functions from List::Util to arrays as methods. use autobox::List::Util; my @array = qw/ foo bar baz /; print @array->first(sub { /ar/ }), " "; # "bar" print [5, 6, 3, 4]->max, " "; # 6 print @array->maxstr, " "; # baz print [5, 6, 3, 4]->min, " "; # 3 print @array->minstr, " "; # foo print [1 .. 10]->shuffle, " "; #1 to 10 randomly shuffled print [1 .. 10]->sum, " "; # 55 print [1 .. 10]->reduce( sub { $a + $b } ), " "; # 55 METHODS
first(coderef) This method behaves nearly the same as the first function from List::Util, but it takes a coderef not a block because methods can't use prototypes. reduce(coderef) This method behaves nearly the same as the reduce function from List::Util, but it takes a coderef not a block for the same reason. It also has a bug (see BUGS) shuffle If called in scalar context it returns a reference to an array instead of a list. This allows shuffle to be chained with other calls. max, maxstr, min, minstr, sum These methods behave exactly the same as their List::Util counterparts. AUTHOR
Chas. J. Owens IV, "<chas.owens at gmail.com>" BUGS
The reduce method works with $main::a and $main::b, not your current package's $a and $b, so you need to say print @array->reduce( sub { $main::a + $main::b } ), " "; if you are not in the main package. Reduce uses $_, so it doesn't suffer from this problem. SUPPORT
You can find documentation for this module with the perldoc command. perldoc autobox::List::Util You can also look for information at: o RT: CPAN's request tracker <http://rt.cpan.org/NoAuth/Bugs.html?Dist=autobox-List-Util> o AnnoCPAN: Annotated CPAN documentation <http://annocpan.org/dist/autobox-List-Util> o CPAN Ratings <http://cpanratings.perl.org/d/autobox-List-Util> o Search CPAN <http://search.cpan.org/dist/autobox-List-Util/> ACKNOWLEDGEMENTS
COPYRIGHT &; LICENSE Copyright 2009 Chas. J. Owens IV, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2010-04-17 autobox::List::Util(3pm)

Check Out this Related Man Page

autobox::dump(3pm)					User Contributed Perl Documentation					autobox::dump(3pm)

NAME
autobox::dump - human/perl readable strings from the results of an EXPR VERSION
Version 20090426.1746 SYNOPSIS
The autobox::dump pragma adds, via the autobox pragma, a method to normal expression (such as scalars, arrays, hashes, math, literals, etc.) that produces a human/perl readable representation of the value of that expression. use autobox::dump; my $foo = "foo"; print $foo->perl; # "foo"; print +(5*6)->perl; # 30; my @a = (1..3); print @a->perl; # [ # 1, # 2, # 3 # ]; print {a=>1, b=>2}->perl; # { # "a" => 1, # "b" => 2 # }; sub func { my ($x, $y) = @_; return $x + $y; } my $func = &func; print $func->perl; #sub { # BEGIN { # $^H{'autobox_scope'} = q(154456408); # $^H{'autobox'} = q(HASH(0x93a3e00)); # $^H{'autobox_leave'} = q(Scope::Guard=ARRAY(0x9435078)); # } # my($x, $y) = @_; # return $x + $y; #} You can set Data::Dumper options by passing either arrayrefs of option and value pairs or just keys (in which case the option will be set to 1). The default options are C<qw/Indent Terse Useqq Sortkeys Deparse/>. print ["a", 0, 1]->perl([Indent => 3], [Varname => "a"], qw/Useqq/); #$a1 = [ # #0 # "a", # #1 # 0, # #2 # 1 # ]; You can also call the class method ->options to set a different default. #set Indent to 0, but leave the rest of the options autobox::dump->options([Indent => 0], qw/Terse Useqq Sortkeys Deparse/); print ["a", 0, 1]->perl; #["a",0,1] AUTHOR
Chas. J Owens IV, "<chas.owens at gmail.com>" BUGS
Has all the issues autobox has. Has all the issues Data::Dumper has. This pragma errs on the side of human readable to the detriment of Perl readable. In particular it uses the terse and deparse options of Data::Dumper by default. These options may create code that cannot be eval'ed. For best eval results, set options to "qw/Purity/". Note, this turns off coderef dumping. Please report any bugs or feature requests to http://github.com/cowens/autobox-dump/issues SUPPORT
You can find documentation for this module with the perldoc command. perldoc autobox::dump ACKNOWLEDGEMENTS
Michael Schwern for starting the perl5i pragma which prompted me to add a feature I wanted to autobox. COPYRIGHT &; LICENSE Copyright 2009 Chas. J Owens IV, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2009-04-26 autobox::dump(3pm)
Man Page