| 1 | package MooX; | ||||||||||
| 2 | 5 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 5 | $MooX::AUTHORITY = 'cpan:GETTY'; | |||||||||
| 4 | } | ||||||||||
| 5 | { | ||||||||||
| 6 | 5 | $MooX::VERSION = '0.101'; | |||||||||
| 7 | } | ||||||||||
| 8 | # ABSTRACT: Using Moo and MooX:: packages the most lazy way | ||||||||||
| 9 | |||||||||||
| 10 | 5 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 5 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 5 | ▶ | use Import::Into; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 5 | ▶ | use Module::Runtime qw( use_module ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 5 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | 5 | ▶ | use Data::OptList; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | |||||||||||
| 17 | 4 | ▶ | sub import { | ||||||||
|
Subroutine
import: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 4 | my ( $class, @modules ) = @_; | |||||||||
| 19 | 4 | my $target = caller; | |||||||||
| 20 | 4 | unshift @modules, '+Moo'; | |||||||||
| 21 | 4 | MooX::import_base($class,$target,@modules); | |||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | 5 | ▶ | sub import_base { | ||||||||
|
Subroutine
import_base: called CC=6 SCAR=18.0
Pod
undocumented
| |||||||||||
| 25 | 5 | my ( $class, $target, @modules ) = @_; | |||||||||
| 26 | 5 | my @optlist = @{Data::OptList::mkopt([@modules],{ | |||||||||
| 27 | must_be => [qw( ARRAY HASH )], | ||||||||||
| 28 | })}; | ||||||||||
| 29 | 5 | for (@optlist) { | |||||||||
| 30 | 14 | my $package = $_->[0]; | |||||||||
| 31 | 14 | my $opts = $_->[1]; | |||||||||
| 32 | 14 | ▶ | for ($package) { s/^\+// or $_ = "MooX::$_" }; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | my @args = ref $opts eq 'ARRAY' | ||||||||||
| 34 | 1 | ▶ | ? @{$opts} | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | : ref $opts eq 'HASH' | ||||||||||
| 36 | 0 | ▶ | ? %{$opts} | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | : (); | ||||||||||
| 38 | 14 | use_module($package)->import::into($target,@args); | |||||||||
| 39 | } | ||||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | 5 | 1; | |||||||||
| 43 | |||||||||||
| 44 | |||||||||||
| 45 | __END__ | ||||||||||