| 1 | package MooX::TypeTiny; | ||||||||||
| 2 | 6 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 6 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 6 | our $VERSION = '0.002003'; | |||||||||
| 5 | 6 | $VERSION =~ tr/_//d; | |||||||||
| 6 | |||||||||||
| 7 | 6 | ▶ | use Moo::_Utils qw(_install_modifier); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 6 | ▶ | sub import { | ||||||||
|
Subroutine
import: called CC=2 SCAR=7.0
| |||||||||||
| 10 | 6 | my $target = caller; | |||||||||
| 11 | 6 | require Moo; | |||||||||
| 12 | 6 | require Moo::Role; | |||||||||
| 13 | |||||||||||
| 14 | 6 | ▶ | unless (Moo->is_class($target)) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 15 | 0 | die "MooX::TypeTiny can only be used on Moo classes."; | |||||||||
| 16 | } | ||||||||||
| 17 | |||||||||||
| 18 | 12 | ▶ | _install_modifier($target, 'before', ['has', 'extends', 'with'], sub { | ||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||
| 19 | 12 | my $am = Moo->_accessor_maker_for($target); | |||||||||
| 20 | $am->does($_) or Moo::Role->apply_roles_to_object($am, $_) | ||||||||||
| 21 | 12 | ▶ | for qw(MooX::TypeTiny::Role::GenerateAccessor); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | |||||||||||
| 23 | # make sure we have our own constructor | ||||||||||
| 24 | 12 | Moo->_constructor_maker_for($target); | |||||||||
| 25 | 6 | }); | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 6 | 1; | |||||||||
| 29 | __END__ | ||||||||||