| 1 | package MooseX::Privacy::Meta::Attribute::Privacy; | ||||||||||||||
| 2 | 3 | ▶ | BEGIN { | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 3 | 3 | $MooseX::Privacy::Meta::Attribute::Privacy::VERSION = '0.05'; | |||||||||||||
| 4 | } | ||||||||||||||
| 5 | |||||||||||||||
| 6 | 3 | ▶ | use MooseX::Role::Parameterized; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 7 | |||||||||||||||
| 8 | 3 | parameter level => (isa => 'Str', is => 'ro', required => 1,); | |||||||||||||
| 9 | |||||||||||||||
| 10 | 3 | ▶ | role { | ||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.1
| |||||||||||||||
| 11 | 3 | my $p = shift; | |||||||||||||
| 12 | |||||||||||||||
| 13 | 3 | my $check_method = '_check_' . $p->level; | |||||||||||||
| 14 | 3 | my $push_method = '_push_' . $p->level . '_attribute'; | |||||||||||||
| 15 | 3 | my $local_attribute = 'local_' . $p->level . '_attributes'; | |||||||||||||
| 16 | |||||||||||||||
| 17 | 2 | ▶ | method _generate_accessor_method => sub { | ||||||||||||
|
Subroutine
_generate_accessor_method: called CC=2 SCAR=6.9
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||
| 18 | 2 | my $meta = shift; | |||||||||||||
| 19 | 2 | my $attr = $meta->associated_attribute; | |||||||||||||
| 20 | 2 | my $package_name = $attr->associated_class->name; | |||||||||||||
| 21 | |||||||||||||||
| 22 | 2 | my $class = $package_name->meta; | |||||||||||||
| 23 | 2 | ▶ | if ($class->meta->has_attribute($local_attribute)) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 24 | 1 | $class->$push_method($attr->name); | |||||||||||||
| 25 | } | ||||||||||||||
| 26 | |||||||||||||||
| 27 | 8 | ▶ | return sub { | ||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Subroutine
foo: called CC=2 SCAR=6.9
| |||||||||||||||
| 28 | 8 | my $self = shift; | |||||||||||||
| 29 | 8 | my $caller = (scalar caller()); | |||||||||||||
| 30 | 8 | my $name = $self->meta->name; | |||||||||||||
| 31 | 8 | $meta->$check_method($caller, $attr->name, $package_name, $name); | |||||||||||||
| 32 | 5 | ▶ | $attr->set_value($self, $_[0]) if scalar(@_) == 1; | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 33 | 5 | $attr->get_value($self); | |||||||||||||
| 34 | 2 | }; | |||||||||||||
| 35 | 3 | }; | |||||||||||||
| 36 | |||||||||||||||
| 37 | 1 | ▶ | method _generate_reader_method => sub { | ||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.4
| |||||||||||||||
| 38 | 1 | my $meta = shift; | |||||||||||||
| 39 | 1 | my $attr = $meta->associated_attribute; | |||||||||||||
| 40 | 1 | my $package_name = $attr->associated_class->name; | |||||||||||||
| 41 | |||||||||||||||
| 42 | 1 | ▶ | return sub { | ||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=9.2
| |||||||||||||||
| 43 | 1 | my $self = shift; | |||||||||||||
| 44 | 1 | my $caller = (scalar caller()); | |||||||||||||
| 45 | 1 | my $name = $self->meta->name; | |||||||||||||
| 46 | 1 | $meta->$check_method($caller, $attr->name, $package_name, $name); | |||||||||||||
| 47 | 0 | ▶ | confess "Cannot assign a value to a read-only accessor" if @_ > 1; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 48 | 0 | $attr->get_value($self); | |||||||||||||
| 49 | 1 | }; | |||||||||||||
| 50 | 3 | }; | |||||||||||||
| 51 | |||||||||||||||
| 52 | 0 | ▶ | method _generate_writer_method => sub { | ||||||||||||
|
Subroutine
_generate_writer_method: not called CC=1 SCAR=6.9
| |||||||||||||||
| 53 | 0 | my $meta = shift; | |||||||||||||
| 54 | 0 | my $attr = $meta->associated_attribute; | |||||||||||||
| 55 | 0 | my $package_name = $attr->associated_class->name; | |||||||||||||
| 56 | |||||||||||||||
| 57 | 0 | ▶ | return sub { | ||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||
| 58 | 0 | my $self = shift; | |||||||||||||
| 59 | 0 | my $caller = (scalar caller()); | |||||||||||||
| 60 | 0 | my $name = $self->meta->name; | |||||||||||||
| 61 | 0 | $meta->$check_method($caller, $attr->name, $package_name, $name); | |||||||||||||
| 62 | 0 | $attr->set_value($self, $_[1]); | |||||||||||||
| 63 | 0 | }; | |||||||||||||
| 64 | 3 | }; | |||||||||||||
| 65 | |||||||||||||||
| 66 | 1 | ▶ | method _generate_predicate_method => sub { | ||||||||||||
|
Subroutine
_generate_predicate_method: called CC=1 SCAR=0.0
| |||||||||||||||
| 67 | 1 | my $meta = shift; | |||||||||||||
| 68 | 1 | my $attr = $meta->associated_attribute; | |||||||||||||
| 69 | 1 | my $package_name = $attr->associated_class->name; | |||||||||||||
| 70 | |||||||||||||||
| 71 | 3 | ▶ | return sub { | ||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||
| 72 | 3 | my $self = shift; | |||||||||||||
| 73 | 3 | my $caller = (scalar caller()); | |||||||||||||
| 74 | 3 | my $name = $self->meta->name; | |||||||||||||
| 75 | 3 | $meta->$check_method($caller, $attr->name, $package_name, $name); | |||||||||||||
| 76 | 2 | $attr->has_value($self); | |||||||||||||
| 77 | 1 | }; | |||||||||||||
| 78 | 3 | }; | |||||||||||||
| 79 | |||||||||||||||
| 80 | 1 | ▶ | method _generate_clearer_method => sub { | ||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||
| 81 | 1 | my $meta = shift; | |||||||||||||
| 82 | 1 | my $attr = $meta->associated_attribute; | |||||||||||||
| 83 | 1 | my $package_name = $attr->associated_class->name; | |||||||||||||
| 84 | |||||||||||||||
| 85 | 2 | ▶ | return sub { | ||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||
| 86 | 2 | my $self = shift; | |||||||||||||
| 87 | 2 | my $caller = (scalar caller()); | |||||||||||||
| 88 | 2 | my $name = $self->meta->name; | |||||||||||||
| 89 | 2 | $meta->$check_method($caller, $attr->name, $package_name, $name); | |||||||||||||
| 90 | 1 | $attr->clear_value($self); | |||||||||||||
| 91 | 1 | }; | |||||||||||||
| 92 | 3 | }; | |||||||||||||
| 93 | 3 | }; | |||||||||||||
| 94 | |||||||||||||||
| 95 | 3 | 1; | |||||||||||||
| 96 | |||||||||||||||
| 97 | __END__ | ||||||||||||||