Z - collection of modules for rapid app development
This:
use Z;
Is a shortcut for:
use strict; use warnings; use feature 'say', 'state'; use namespace::autoclean; use Syntax::Keyword::Try 'try'; use Zydeco::Lite -all; use Path::Tiny 'path'; use Object::Adhoc 'object'; use match::simple 'match'; use Types::Standard -types, -is, -assert; use Types::Common::String -types, -is, -assert; use Types::Common::Numeric -types, -is, -assert; use Types::Path::Tiny -types, -is, -assert;
It will also do no indirect if indirect is installed.
no indirect
Just a shortcut for loading a bunch of modules that allow you to quickly code Perl stuff. I've tried to avoid too many domain-specific modules like HTTP::Tiny, etc. The modules chosen should be broadly useful for a wide variety of tasks.
By default, Z requires Perl v5.14, but it has a compatibility mode where for Perl v5.8.8 and above.
It will use Try::Tiny instead of Syntax::Keyword::Try. (Bear in mind that these are not 100% compatible with each other.) It will also load Perl6::Say as a fallback for the say built-in. And it will not provide state. It will also load UNIVERSAL::DOES if there's no built-in UNIVERSAL::DOES method.
say
state
You can specify whether you want the modern modules or the compatibility modules:
use Z -modern; # Uses modern modules. # Requres Perl 5.14+. use Z -compat; # Uses compatible modules. # Requires Perl 5.8.8+. use Z -detect; # Uses modern modules on Perl 5.14+. # Prints a warning and uses compatible modules on Perl 5.8.8+.
The default is -modern.
-modern
There are a whole bunch of other useful functions that Z could make available, but it's hard to know the best place to draw the line. So other functions are available on request:
use Z qw( weaken unweaken isweak ); use Z -compat, qw( pairmap pairgrep ); # Rename functions... use Z qw( pairmap:pmap pairgrep:pgrep );
(The things listed in the "SYNOPSIS" are always imported and don't support the renaming feature.)
The additional functions available are: everything from Scalar::Util, everything from List::Util, everything from Sub::Util, everything from Carp (wrapped versions with sprintf functionality, except confess which is part of the standard set of functions already), Dumper from Data::Dumper, maybe and provided from PerlX::Maybe, and encode_json and decode_json from JSON::MaybeXS or JSON::PP (depending which is installed).
sprintf
confess
Dumper
maybe
provided
encode_json
decode_json
If you specify a compatibility mode (like -modern), this must be first in the import list.
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Z.
Zydeco::Lite, Types::Standard, Syntax::Feature::Try, Path::Tiny, match::simple, Object::Adhoc.
Toby Inkster <tobyink@cpan.org>.
This software is copyright (c) 2020 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
To install Z, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Z
CPAN shell
perl -MCPAN -e shell install Z
For more information on module installation, please visit the detailed CPAN module installation guide.