sympatic
view release on metacpan or search on metacpan
lib/Sympatic.pm view on Meta::CPAN
package Sympatic;
our $VERSION = '0.2';
use strict;
use warnings;
require Import::Into;
sub import {
my $to; # the NS to infect
# Sympatic->import(@options)
# Sympatic->import(to => $NS, @options)
('to' eq ( $_[1] // '' ))
? ( $to = $_[2], splice @_,0,3 )
: ( $to = caller, shift );
my %feature = qw<
utf8all .
utf8 .
utf8io .
oo .
class .
path .
>;
English->import::into( $to, qw< -no_match_vars > );
feature->import::into( $to, qw< say state > );
strict->import::into($to);
warnings->import::into($to);
Function::Parameters->import::into($to);
while (@_) {
# disable default features
if ( $_[0] =~ /-(?<feature>
utf8all |
utf8 |
utf8io |
oo |
class |
path
)/x) {
delete $feature{ $+{feature} };
shift;
next;
}
...
}
$feature{path} and do { Path::Tiny->import::into($to) };
$feature{oo} and do {
( $feature{class}
? 'Moo'
: 'Moo::Role' )->import::into($to);
MooX::LvalueAttribute->import::into($to);
};
$feature{utf8all} and do {
utf8::all->import::into($to);
delete $feature{$_} for qw< utf8 utf8io >;
};
$feature{utf8} and do {
utf8->import::into($to);
feature->import::into( $to, qw< unicode_strings > );
};
$feature{utf8io} and do { 'open'->import::into( $to, qw< :UTF-8 :std > ) };
# see https://github.com/pjf/autodie/commit/6ff9ff2b463af3083a02a7b5a2d727b8a224b970
# TODO: is there a case when caller > 1 ?
# $feature{autodie} and do {
# autodie->import::into(1);
# }
}
1;
=encoding utf8
=head1 NAME
Sympatic - A more producive perl thanks to CPAN
( run in 1.305 second using v1.01-cache-2.11-cpan-ceb78f64989 )