line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
32207
|
use strict; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
69
|
|
2
|
2
|
|
|
2
|
|
13
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
96
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package MooseX::InsideOut; |
5
|
|
|
|
|
|
|
BEGIN { |
6
|
2
|
|
|
2
|
|
43
|
$MooseX::InsideOut::VERSION = '0.106'; |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
# ABSTRACT: inside-out objects with Moose |
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
910
|
use Moose (); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use Moose::Exporter; |
12
|
|
|
|
|
|
|
use Moose::Util::MetaRole; |
13
|
|
|
|
|
|
|
use MooseX::InsideOut::Role::Meta::Instance; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Moose::Exporter->setup_import_methods( |
16
|
|
|
|
|
|
|
also => [ 'Moose' ], |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub init_meta { |
20
|
|
|
|
|
|
|
shift; |
21
|
|
|
|
|
|
|
my %p = @_; |
22
|
|
|
|
|
|
|
Moose->init_meta(%p); |
23
|
|
|
|
|
|
|
Moose::Util::MetaRole::apply_metaroles( |
24
|
|
|
|
|
|
|
for => $p{for_class}, |
25
|
|
|
|
|
|
|
class_metaroles => { |
26
|
|
|
|
|
|
|
instance => [ 'MooseX::InsideOut::Role::Meta::Instance' ], |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=pod |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 NAME |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
MooseX::InsideOut - inside-out objects with Moose |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 VERSION |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
version 0.106 |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 SYNOPSIS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
package My::Object; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
use MooseX::InsideOut; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# ... normal Moose functionality |
51
|
|
|
|
|
|
|
# or ... |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
package My::Subclass; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
use MooseX::InsideOut; |
56
|
|
|
|
|
|
|
extends 'Some::Other::Class'; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 DESCRIPTION |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
MooseX::InsideOut provides metaroles for inside-out objects. That is, it sets |
61
|
|
|
|
|
|
|
up attribute slot storage somewhere other than inside C<$self>. This means |
62
|
|
|
|
|
|
|
that you can extend non-Moose classes, whose internals you either don't want to |
63
|
|
|
|
|
|
|
care about or aren't hash-based. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 METHODS |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 init_meta |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Apply the instance metarole necessary for inside-out storage. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 TODO |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=over |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item * dumping (for debugging purposes) |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item * serialization (for e.g. storable) |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item * (your suggestions here) |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=back |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 AUTHOR |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Hans Dieter Pearcey <hdp@cpan.org> |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This software is copyright (c) 2011 by Hans Dieter Pearcey <hdp@cpan.org>. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
92
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
__END__ |
98
|
|
|
|
|
|
|
|