exact
view release on metacpan or search on metacpan
lib/exact.pm view on Meta::CPAN
monkey_patch(
$package,
( caller(0) )[0],
map { $_ => \&{ $package . '::' . $_ } } @exports
);
return;
},
);
}
sub export {
_patch_import( 'force', @_ );
return;
}
sub exportable {
_patch_import( 'provide', @_ );
return;
}
sub deat ($) {
( my $e = reverse $_[0] ) =~ s/^\s*\.\d+\s+enil\s+.*?\s+ta\s+//;
return '' . reverse $e;
}
sub deattry (&) {
try {
return $_[0]->();
}
catch ($e) {
die deat $e, "\n";
}
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
exact - Perl pseudo pragma to enable strict, warnings, features, mro, filehandle methods
=head1 VERSION
version 1.29
=for markdown [](https://github.com/gryphonshafer/exact/actions?query=workflow%3Atest)
[](https://codecov.io/gh/gryphonshafer/exact)
=head1 SYNOPSIS
Instead of this:
use strict;
use warnings;
use feature ':all';
no warnings "experimental";
use utf8;
use open ':std', ':utf8';
use mro 'c3';
use IO::File;
use IO::Handle;
use Carp qw( croak carp confess cluck );
use Syntax::Keyword::Try;
use PerlX::Maybe ':all';
use namespace::autoclean;
Type this:
use exact;
Or for finer control, add some trailing modifiers like a line of the following:
use exact -nofeatures, -signatures, -try, -say, -state;
use exact 5.16, -nostrict, -nowarnings, -noc3, -noutf8, -noautoclean;
use exact '5.20';
=head1 DESCRIPTION
L<exact> is a Perl pseudo pragma to enable strict, warnings, features, mro,
and filehandle methods along with a lot of other things, plus allow for easy
extension via C<exact::*> classes. The goal is to reduce header boilerplate,
assuming defaults that seem to make sense but allowing overrides easily.
By default, L<exact> will:
=over 4
=item *
enable L<strictures> (version 2)
=item *
enable all available L<feature>s and switch off experimental warnings
=item *
use utf8 in the source code context and set STDIN, STROUT, and STRERR to handle UTF8
=item *
set C3 style of L<mro>
=item *
enable methods on filehandles
=item *
import L<Carp>'s 4 routines (plus the c<deat> and c<deattry> routines; see below)
=item *
implement a C<try...catch...finally> block solution based on Perl version
( run in 2.337 seconds using v1.01-cache-2.11-cpan-75ffa21a3d4 )