use
5.016;
for
my
$type
(
qw(Hash Array)
) {
Moose::Autobox->mixin_additional_role(
uc
(
$type
) =>
"Data::Frame::Autobox::$type"
);
}
Role::Tiny->apply_roles_to_package(
'PDL'
,
'Data::Frame::PDL'
);
sub
import
{
my
(
$class
,
@tags
) =
@_
;
unless
(
@tags
) {
@tags
=
qw(:base)
;
}
$class
->_import(
scalar
(
caller
),
@tags
);
}
sub
_import {
my
(
$class
,
$target
,
@tags
) =
@_
;
for
my
$tag
( uniq
@tags
) {
$class
->_import_tag(
$target
,
$tag
);
}
}
sub
_import_tag {
my
(
$class
,
$target
,
$tag
) =
@_
;
if
(
$tag
eq
':base'
) {
strict->
import
::into(
$target
);
warnings->
import
::into(
$target
);
utf8->
import
::into(
$target
);
feature->
import
::into(
$target
,
':5.16'
);
Carp->
import
::into(
$target
);
Data::Dumper->
import
::into(
$target
);
Function::Parameters->
import
::into(
$target
);
Ref::Util->
import
::into(
$target
);
Safe::Isa->
import
::into(
$target
);
Syntax::Keyword::Try->
import
::into(
$target
);
boolean->
import
::into(
$target
);
indirect->unimport::out_of(
$target
);
Moose::Autobox->
import
::into(
$target
);
}
elsif
(
$tag
eq
':class'
) {
$class
->_import_tag(
$target
,
':base'
);
Function::Parameters->
import
::into(
$target
,
qw(classmethod :modifiers)
);
Moo->
import
::into(
$target
);
}
elsif
(
$tag
eq
':role'
) {
$class
->_import_tag(
$target
,
':base'
);
Function::Parameters->
import
::into(
$target
,
qw(classmethod :modifiers)
);
Moo::Role->
import
::into(
$target
);
}
else
{
croak
qq["$tag" is not exported by the $class module\n]
;
}
}
1;