line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
use strict; |
2
|
1
|
|
|
1
|
|
9375
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
3
|
1
|
|
|
1
|
|
5
|
use MooX::ReturnModifiers; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
19
|
|
4
|
1
|
|
|
1
|
|
403
|
our $VERSION = '1.01'; |
|
1
|
|
|
|
|
398
|
|
|
1
|
|
|
|
|
153
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
my $target = caller; |
7
|
|
|
|
|
|
|
my %modifiers = return_modifiers( $target, [qw/before around/] ); |
8
|
1
|
|
|
1
|
|
7
|
$modifiers{around}->( |
9
|
1
|
|
|
|
|
3
|
'has', |
10
|
|
|
|
|
|
|
sub { |
11
|
|
|
|
|
|
|
my ( $orig, $attr, %opts ) = @_; |
12
|
|
|
|
|
|
|
my $private = delete $opts{private}; |
13
|
2
|
|
|
2
|
|
2234
|
$orig->( $attr, %opts ); |
14
|
2
|
|
|
|
|
4
|
$modifiers{before}->( |
15
|
2
|
|
|
|
|
8
|
$attr, |
16
|
|
|
|
|
|
|
sub { |
17
|
|
|
|
|
|
|
my $private_caller = caller(1); |
18
|
|
|
|
|
|
|
if ( $private_caller ne $target ) { |
19
|
5
|
|
|
|
|
5943
|
die |
20
|
5
|
100
|
|
|
|
51
|
"cannot call private attribute $attr from $private_caller"; |
21
|
2
|
|
|
|
|
16
|
} |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
) if $private; |
24
|
|
|
|
|
|
|
} |
25
|
2
|
100
|
|
|
|
17775
|
); |
26
|
|
|
|
|
|
|
} |
27
|
1
|
|
|
|
|
27
|
|
28
|
|
|
|
|
|
|
1; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 NAME |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
MooX::Private::Attribute - private attributes |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 VERSION |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Version 1.01 |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 SYNOPSIS |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
package Lays; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
use Moo; |
46
|
|
|
|
|
|
|
use MooX::Private::Attribute; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
has size => ( |
49
|
|
|
|
|
|
|
is => 'ro', |
50
|
|
|
|
|
|
|
private => 1 |
51
|
|
|
|
|
|
|
); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
has flavour => ( |
54
|
|
|
|
|
|
|
is => 'ro', |
55
|
|
|
|
|
|
|
private => 1 |
56
|
|
|
|
|
|
|
); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub bag { |
59
|
|
|
|
|
|
|
return { |
60
|
|
|
|
|
|
|
size => $_[0]->size, |
61
|
|
|
|
|
|
|
flavour => $_[0]->flavour |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
.... |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
my $salt = Lays->new( |
68
|
|
|
|
|
|
|
size => q|οικογένεια|, |
69
|
|
|
|
|
|
|
flavour => q|τυρί & κρεμμύδι| |
70
|
|
|
|
|
|
|
); |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
$salt->bag # works |
73
|
|
|
|
|
|
|
$salt->size # errors |
74
|
|
|
|
|
|
|
$salt->flavour # errors |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head2 import |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
call import method. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
$obj->import() |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 AUTHOR |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
LNATION, C<< <email at lnation.org> >> |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 BUGS |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Please report any bugs or feature requests to C<bug-moox::private::attribute at rt.cpan.org>, or through |
91
|
|
|
|
|
|
|
the web interface at L<https://rt.cpan.org/NoAuth/ReportBug.html?Queue=MooX-Private-Attribute>. I will be notified, and then you'll |
92
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 SUPPORT |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
perldoc MooX::Private::Attribute |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
You can also look for information at: |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=over 4 |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=MooX-Private-Attribute> |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
L<http://annocpan.org/dist/MooX-Private-Attribute> |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item * CPAN Ratings |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
L<https://cpanratings.perl.org/d/MooX-Private-Attribute> |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item * Search CPAN |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
L<https://metacpan.org/release/MooX-Private-Attribute> |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=back |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
This software is Copyright (c) 2020-2021 by LNATION. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
This is free software, licensed under: |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=cut |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|