NAME
List::MoreUtils - Provide the stuff missing in List::Util
SYNOPSIS
use List::MoreUtils qw(:tassilo); # use as initially thought
use List::MoreUtils qw(:alias); # use alias changes
use List::MoreUtils qw(:modern); # use compat mode to List::Util
use List::MoreUtils qw(:sno); # use nowadays added stuff
use List::MoreUtils qw(:all); # use all with precedence 'alias', 'sno', 'tassilo', 'modern';
use List::MoreUtils any => { impl => 'modern' },
all => { impl => 'tassilo' },
'none', 'notall', # above precedence
'firstidx' => { impl => 'tassilo' },
all => { impl => 'modern', as => 'modern_all' };
DESCRIPTION
List::MoreUtils provides some trivial but commonly needed functionality
on lists which is not going to go into List::Util.
All of the below functions are implementable in only a couple of lines
of Perl code. Using the functions from this module however should give
slightly better performance as everything is implemented in C. The
pure-Perl implementation of these functions only serves as a fallback in
case the C portions of this module couldn't be compiled on this machine.
EXPORTS
Nothing by default. To import all of this module's symbols, do the
conventional
use List::MoreUtils ':all';
It may make more sense though to only import the stuff your program
actually needs:
use List::MoreUtils qw{ any firstidx };
ENVIRONMENT
When "LIST_MOREUTILS_PP" is set, the module will always use the
pure-Perl implementation and not the XS one. This environment variable
is really just there for the test-suite to force testing the Perl
implementation, and possibly for reporting of bugs. I don't see any
reason to use it in a production environment.
BUGS
There is a problem with a bug in 5.6.x perls. It is a syntax error to
write things like:
my @x = apply { s/foo/bar/ } qw{ foo bar baz };
It has to be written as either
my @x = apply { s/foo/bar/ } 'foo', 'bar', 'baz';
or
my @x = apply { s/foo/bar/ } my @dummy = qw/foo bar baz/;
Perl 5.5.x and Perl 5.8.x don't suffer from this limitation.
If you have a functionality that you could imagine being in this module,
please drop me a line. This module's policy will be less strict than
List::Util's when it comes to additions as it isn't a core module.
When you report bugs, it would be nice if you could additionally give me
the output of your program with the environment variable
"LIST_MOREUTILS_PP" set to a true value. That way I know where to look
for the problem (in XS, pure-Perl or possibly both).
SUPPORT
Bugs should always be submitted via the CPAN bug tracker.
You can find documentation for this module with the perldoc command.
perldoc List::MoreUtils
You can also look for information at:
* RT: CPAN's request tracker
<http://rt.cpan.org/NoAuth/Bugs.html?Dist=List-MoreUtils>
* AnnoCPAN: Annotated CPAN documentation
<http://annocpan.org/dist/List-MoreUtils>
* CPAN Ratings
<http://cpanratings.perl.org/l/List-MoreUtils>
* CPAN Search
<http://search.cpan.org/dist/List-MoreUtils/>
* Got Repository
<https://github.com/perl5-utils/List-MoreUtils>
Where can I go for help?
If you have a bug report, a patch or a suggestion, please open a new
report ticket at CPAN (but please check previous reports first in case
your issue has already been addressed).
Report tickets should contain a detailed description of the bug or
enhancement request and at least an easily verifiable way of reproducing
the issue or fix. Patches are always welcome, too - and it's cheap to
send pull-requests on GitHub. Please keep in mind that code changes are
more likely accepted when they're bundled with an approving test.
If you think you've found a bug then please read "How to Report Bugs
Effectively" by Simon Tatham:
<http://www.chiark.greenend.org.uk/~sgtatham/bugs.html>.
Where can I go for help with a concrete version?
Bugs and feature requests are accepted against the latest version only.
To get patches for earlier versions, you need to get an agreement with a
developer of your choice - who may or not report the issue and a
suggested fix upstream (depends on the license you have chosen).
Business support and maintenance
For business support you can contact Jens via his CPAN email address
rehsackATcpan.org. Please keep in mind that business support is neither
available for free nor are you eligible to receive any support based on
the license distributed with this package.
THANKS
Credits go to a number of people: Steve Purkis for giving me namespace
advice and James Keenan and Terrence Branno for their effort of keeping
the CPAN tidier by making List::Utils obsolete.
Brian McCauley suggested the inclusion of apply() and provided the
pure-Perl implementation for it.
Eric J. Roode asked me to add all functions from his module
"List::MoreUtil" into this one. With minor modifications, the pure-Perl
implementations of those are by him.
The bunch of people who almost immediately pointed out the many problems
with the glitchy 0.07 release (Slaven Rezic, Ron Savage, CPAN testers).
A particularly nasty memory leak was spotted by Thomas A. Lowery.
Lars Thegler made me aware of problems with older Perl versions.
Anno Siegel de-orphaned each_arrayref().
David Filmer made me aware of a problem in each_arrayref that could
ultimately lead to a segfault.
Ricardo Signes suggested the inclusion of part() and provided the
Perl-implementation.
Robin Huston kindly fixed a bug in perl's MULTICALL API to make the
XS-implementation of part() work.
TODO
A pile of requests from other people is still pending further processing
in my mailbox. This includes:
* List::Util export pass-through
Allow List::MoreUtils to pass-through the regular List::Util
functions to end users only need to "use" the one module.
* uniq_by(&@)
Use code-reference to extract a key based on which the uniqueness is
determined. Suggested by Aaron Crane.
* delete_index
* random_item
* random_item_delete_index
* list_diff_hash
* list_diff_inboth
* list_diff_infirst
* list_diff_insecond
These were all suggested by Dan Muey.
* listify
Always return a flat list when either a simple scalar value was
passed or an array-reference. Suggested by Mark Summersault.
SEE ALSO
List::Util
AUTHOR
Jens Rehsack <rehsack AT cpan.org>
Adam Kennedy <adamk@cpan.org>
Tassilo von Parseval <tassilo.von.parseval@rwth-aachen.de>
COPYRIGHT AND LICENSE
Some parts copyright 2011 Aaron Crane.
Copyright 2004 - 2010 by Tassilo von Parseval Copyright 2013 by Jens
Rehsack
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself, either Perl version 5.8.4 or, at
your option, any later version of Perl 5 you may have available.