NAME
Z - collection of modules for rapid app development
SYNOPSIS
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.
DESCRIPTION
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.
Perl Version Compatibility
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.
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
.
Additional Functions
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), all the functions (but not the exported regexps) from Module::Runtime, Dumper
from Data::Dumper, maybe
and provided
from PerlX::Maybe, encode_json
and decode_json
from JSON::MaybeXS or JSON::PP (depending which is installed), and STRICT
and LAX
from Devel::StrictMode.
If you specify a compatibility mode (like -modern
), this must be first in the import list.
BUGS
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Z.
SEE ALSO
Zydeco::Lite, Types::Standard, Syntax::Feature::Try, Path::Tiny, match::simple, Object::Adhoc.
AUTHOR
Toby Inkster <tobyink@cpan.org>.
COPYRIGHT AND LICENCE
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.
DISCLAIMER OF WARRANTIES
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.