Scalar::MoreUtils - Provide the stuff missing in Scalar::Util
Version 0.02
use Scalar::MoreUtils qw(nil empty define default ifnil ifempty); ... sub add { my $left = default shift, 0; my $right = default shift, 0; return $left + $right; } sub greet { return default shift, "This the default greeting!"; }
Similar to Hsah::MoreUtils and List::MoreUtils, Scalar::MoreUtils contains trivial but commonly-used scalar functionality.
Hsah::MoreUtils
List::MoreUtils
Scalar::MoreUtils
Essentially, provide some pretty trivial functionality that I find useful over and over. The value of this module will probably be blasted away by Perl 5.10.
Suggestions welcome.
Returns true if VALUE is not defined.
Returns true if VALUE is not defined or if VALUE is the empty string ("").
Returns VALUE if it is defined, otherwise returns the empty string ("").
Returns VALUE if it is defined, otherwise returns DEFAULT.
This is similar to the "//" in the Perl 5.10 ... well, not really, but kinda.
Returns VALUE if it is not nil, otherwise returns DEFAULT.
Read "ifnil(A,B)" as "ifnil A, then B, otherwise A"
ifnil behaves exactly the same as default.
ifnil
default
Returns VALUE if it is not empty, otherwise returns DEFAULT.
Read "ifempty(A,B)" as "ifempty A, then B, otherwise A"
Robert Krimen, <rkrimen at cpan.org>
<rkrimen at cpan.org>
Please report any bugs or feature requests to bug-scalar-moreutils at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Scalar-MoreUtils. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-scalar-moreutils at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Scalar::MoreUtils
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Scalar-MoreUtils
CPAN Ratings
http://cpanratings.perl.org/d/Scalar-MoreUtils
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Scalar-MoreUtils
Search CPAN
http://search.cpan.org/dist/Scalar-MoreUtils
Copyright 2007 Robert Krimen, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Scalar::MoreUtils, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Scalar::MoreUtils
CPAN shell
perl -MCPAN -e shell install Scalar::MoreUtils
For more information on module installation, please visit the detailed CPAN module installation guide.