| 1 | package Mock::Data; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # ABSTRACT: Extensible toolkit for generating mock data | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 9 | our $VERSION = '0.04'; # VERSION | |||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 9 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 9 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 9 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # require MRO::Compat if "$]" < '5.009005'; # now requiring v5.10 for dist, anyway | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 9 | require mro; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 9 | mro::set_mro(__PACKAGE__, 'c3'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 9 | require Storable; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 9 | require Module::Runtime; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 17 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=10 SCAR=24.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 17 | my $class= shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 17 | ▶ | my $self= ref $class? $class->clone | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | : bless { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | generators => {}, # can't initialize, plugins go first | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | generator_state => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | _generator_cache => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | _loaded_plugins => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | }, $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 17 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 13 | ▶ | my $args | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%3/6
@_ == 1 and ref $_[0] eq "ARRAY"
@_ == 1 and ref $_[0] eq "HASH"
MC/DC50%1/2
@_ == 1 and ref $_[0] eq "ARRAY"
@_ == 1
ref $_[0] eq "ARRAY"
MC/DC0%0/2
@_ == 1 and ref $_[0] eq "HASH"
@_ == 1
ref $_[0] eq "HASH"
Truth table66%2/3
A and B
A= @_ == 1B= ref $_[0] eq "ARRAY"
Truth table33%1/3
A and B
A= @_ == 1B= ref $_[0] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | = (@_ == 1 && ref $_[0] eq 'ARRAY')? { plugins => $_[0] } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | : (@_ == 1 && ref $_[0] eq 'HASH')? $_[0] | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | : { @_ }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 13 | ▶ | if (my $plugins= $args->{plugins}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 11 | ▶ | $self= $self->load_plugin(ref $plugins? @$plugins : ( $plugins )); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | $self->add_generators($args->{generators}) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 13 | ▶ | if $args->{generators}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 17 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | sub clone { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | my $self= shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | my $new= { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | %$self, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | # Shallow clone generators and _loaded_plugins | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | _loaded_plugins => { %{ $self->{_loaded_plugins} } }, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | generators => { %{ $self->{generators} } }, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | # deep clone generator_state | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | generator_state => Storable::dclone($self->{generator_state}), | |||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | # clear cache | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | _generator_cache => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | # Allow generators to handle cloned state | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | for (values %{ $new->{generators} }) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | $_= $_->clone if ref->can('clone'); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | bless $new, ref $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 209 | ▶ | sub generators { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
generators: called CC=3 SCAR=19.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 209 | ▶ | return $_[0]{generators} if @_ == 1; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | # Coerce generators | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | my %new= %{ $_[1] }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | $_= Mock::Data::Util::coerce_generator($_) for values %new; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | # clear cache first | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | %{$_[0]{_generator_cache}}= (); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | return $_[0]{generators}= \%new; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 35 | ▶ | sub generator_state { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
generator_state: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 35 | ▶ | $_[0]{generator_state}= $_[1] if @_ > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 35 | $_[0]{generator_state}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 12 | ▶ | sub load_plugin { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_plugin: called CC=7 SCAR=23.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 12 | my ($self, @names)= @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 12 | for my $name (@names) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 14 | ▶ | next if $self->{_loaded_plugins}{$name}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 14 | my $class= "Mock::Data::Plugin::$name"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 14 | ▶ | unless ($class->can('apply_mockdata_plugin')) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | Module::Runtime::require_module($class); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | $class->can('apply_mockdata_plugin') | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | or Carp::croak("No such method ${class}->apply_mockdata_plugin"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 14 | $self= $class->apply_mockdata_plugin($self); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 14 | ▶ | ref($self) && ref($self)->isa(__PACKAGE__) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $self and ref($self)->isa(__PACKAGE__)
MC/DC0%0/2
ref $self and ref($self)->isa(__PACKAGE__)
ref $self
ref($self)->isa(__PACKAGE__)
Truth table33%1/3
A and B
A= ref $selfB= ref($self)->isa(__PACKAGE__)
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | or Carp::croak("$class->apply_mockdata_plugin did not return a Mock::Data"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 14 | ++$self->{_loaded_plugins}{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 12 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 13 | ▶ | sub add_generators { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_generators: called CC=5 SCAR=16.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 13 | my $self= shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 13 | ▶ | my @args= @_ == 1? %{ $_[0] } : @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 13 | ▶ | while (@args) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 82 | my ($name, $gen)= splice @args, 0, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 82 | $gen= Mock::Data::Util::coerce_generator($gen); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 82 | $self->generators->{$name}= $gen; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 82 | delete $self->{_generator_cache}{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 82 | ▶ | $self->generators->{$1} //= $gen | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->generators->{$1} //= $gen
MC/DC0%0/2
$self->generators->{$1} //= $gen
$self->generators->{$1}
$gen
Truth table33%1/3
A //= B
A= $self->generators->{$1}B= $gen
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | if $name =~ /::([^:]+)$/ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 13 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 4 | ▶ | sub combine_generators { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
combine_generators: called CC=6 SCAR=18.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 4 | my $self= shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | my @args= @_ == 1? %{ $_[0] } : @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 4 | ▶ | while (@args) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 4 | my ($name, $gen)= splice @args, 0, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 4 | $gen= Mock::Data::Util::coerce_generator($gen); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 4 | my $merged= $gen; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 4 | ▶ | if (defined (my $cur= $self->generators->{$name})) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | $merged= $cur->combine_generator($gen); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | delete $self->{_generator_cache}{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 4 | $self->generators->{$name}= $merged; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | # If given a namespace-qualified name, also install as the 'leaf' of that name | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 4 | ▶ | if ($name =~ /::([^:]+)$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 4 | ($name, $merged)= ($1, $gen); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 4 | ▶ | if (defined (my $cur= $self->generators->{$name})) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 1 | $merged= $cur->combine_generator($gen); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 1 | delete $self->{_generator_cache}{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 4 | $self->generators->{$name}= $merged; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 4 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 367 | ▶ | sub call { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
call: called CC=4 SCAR=14.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 367 | my ($self, $name)= (shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 367 | ▶ | defined $self->{generators}{$name} | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | or Carp::croak("No such generator '$name'"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 367 | ▶ | return $self->{generators}{$name}->generate($self, @_) if @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | # If no params, call the cached compiled version | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 174 | ▶ | ($self->{_generator_cache}{$name} ||= $self->{generators}{$name}->compile) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->{"_generator_cache"}{$name} ||= $self->{"generators"}{$name}->compile
MC/DC0%0/2
$self->{"_generator_cache"}{$name} ||= $self->{"generators"}{$name}->compile
$self->{"_generator_cache"}{$name}
$self->{"generators"}{$name}->compile
Truth table66%2/3
A ||= B
A= $self->{"_generator_cache"}{$name}B= $self->{"generators"}{$name}->compile
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | ->($self, @_); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | sub wrap { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
wrap: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | my ($self, $name)= (shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | my $gen= $self->{generators}{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | defined $gen or Carp::croak("No such generator '$name'"); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | my $code= @_? $gen->compile(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | ▶ | : ($self->{_generator_cache}{$name} ||= $gen->compile); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"_generator_cache"}{$name} ||= $gen->compile
MC/DC0%0/2
$self->{"_generator_cache"}{$name} ||= $gen->compile
$self->{"_generator_cache"}{$name}
$gen->compile
Truth table0%0/3
A ||= B
A= $self->{"_generator_cache"}{$name}B= $gen->compile
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | return sub { $code->($self) } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | } | |||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 9 | our $AUTOLOAD; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 357 | ▶ | sub AUTOLOAD { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 357 | my $self= shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 357 | ▶ | Carp::croak("No method $AUTOLOAD in package $self") unless ref $self; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 357 | my $name= substr($AUTOLOAD, rindex($AUTOLOAD,':')+1); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 357 | $self->call($name, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | # don't install, because generators are defined per-instance not per-package | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | sub DESTROY {} # prevent AUTOLOAD from triggering on ->DESTROY | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 9 | ▶ | sub import { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
import: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 9 | shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 9 | Mock::Data::Util->import_into(scalar caller, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 9 | require Mock::Data::Util; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||