package Getopt::Dakkar::Style;
use 5.026;
use strictures 2;
use true;
use Import::Into;
use Try::Tiny ();
use Carp ();
use feature ();
use experimental ();
use Path::Tiny ();
sub use_types {
my ($caller) = @_;
require Types::Standard;
require Type::Params;
Types::Standard->import::into(
$caller,
"Any",
"Item",
"Bool",
"Undef",
"Defined",
"Value",
"Str",
"Num",
"Int",
"ClassName",
"RoleName",
"Ref",
"CodeRef",
"RegexpRef",
"FileHandle",
"ArrayRef",
"HashRef",
"ScalarRef",
"Object",
"Maybe",
"Map",
"Optional",
"Tuple",
"Dict",
"InstanceOf",
"ConsumerOf",
"HasMethods",
);
Type::Params->import::into($caller);
}
sub import {
my $class = shift;
my (@args) = @_;
my $caller = caller();
strict->import();
feature->import(':5.26');
Try::Tiny->import::into($caller);
Carp->import::into($caller);
feature->import::into($caller, ':5.26');
true->import({ into => $caller });
my %arg = map { $_ => 1 } @args;
if ($arg{class}) {
require Moo;
Moo->import::into($caller);
$arg{types}=1;
}
if ($arg{role}) {
require Moo::Role;
Moo::Role->import::into($caller);
$arg{types}=1;
}
if ($arg{types}) {
use_types($caller);
}
if ($arg{test}) {
require Test::Most;
require Test::Warnings;
require lib;
Test::Most->import::into($caller);
Test::Warnings->import::into($caller);
lib->import::into(
$caller,
Path::Tiny::path(__FILE__)->parent(4)->child('t/lib')->stringify,
);
}
strictures->import::into($caller,version=>2);
experimental->import::into($caller,qw(postderef signatures));
namespace::autoclean->import(
-cleanee => $caller,
);
return;
}