| 1 | package MOP4Import::Types; | ||
| 2 | use 5.010; | ||
| 3 | use strict; | ||
| 4 | use warnings qw(FATAL all NONFATAL misc); | ||
| 5 | use Carp; | ||
| 6 | |||
| 7 | use MOP4Import::Pairs -as_base, qw/Opts m4i_opts/; | ||
| 8 | # XXX: [carp_not => MOP4Import::Util] | ||
| 9 | use MOP4Import::Declare::Type -as_base; | ||
| 10 | use MOP4Import::Util; | ||
| 11 | |||
| 12 | use constant DEBUG => $ENV{DEBUG_MOP4IMPORT}; | ||
| 13 | |||
| 14 | sub import { | ||
| 15 | my $myPack = shift; | ||
| 16 | |||
| 17 | m4i_log_start() if DEBUG; | ||
| 18 | |||
| 19 | my Opts $opts = m4i_opts([caller])->take_hash_maybe(\@_); | ||
| 20 | |||
| 21 | $myPack->dispatch_pairs_as_declare(type => $opts, @_); | ||
| 22 | |||
| 23 | my $tasks; | ||
| 24 | if ($tasks = $opts->{delayed_tasks} and @$tasks) { | ||
| 25 | print STDERR " Calling delayed tasks for $opts->{destpkg}\n" if DEBUG; | ||
| 26 | $_->($opts) for @$tasks; | ||
| 27 | } | ||
| 28 | |||
| 29 | m4i_log_end($opts->{callpack}) if DEBUG; | ||
| 30 | } | ||
| 31 | |||
| 32 | 1; |