Commit | Line | Data |
64468268 |
1 | use strict; |
2 | use warnings; |
3 | |
4 | package MooseX::InsideOut; |
fff3c901 |
5 | # ABSTRACT: inside-out objects with Moose |
64468268 |
6 | |
71d2a8c6 |
7 | use Moose (); |
8 | use Moose::Exporter; |
9 | use Moose::Util::MetaRole; |
10 | use MooseX::InsideOut::Role::Meta::Instance; |
11 | |
12 | Moose::Exporter->setup_import_methods( |
13 | also => [ 'Moose' ], |
14 | ); |
15 | |
16 | sub init_meta { |
17 | shift; |
18 | my %p = @_; |
19 | Moose->init_meta(%p); |
20 | Moose::Util::MetaRole::apply_metaclass_roles( |
21 | for_class => $p{for_class}, |
22 | instance_metaclass_roles => [ 'MooseX::InsideOut::Role::Meta::Instance' ], |
fda3c8a5 |
23 | ); |
fda3c8a5 |
24 | } |
0a374e17 |
25 | |
64468268 |
26 | 1; |
27 | __END__ |
28 | |
64468268 |
29 | =head1 SYNOPSIS |
30 | |
31 | package My::Object; |
32 | |
fda3c8a5 |
33 | use MooseX::InsideOut; |
64468268 |
34 | |
35 | # ... normal Moose functionality |
36 | # or ... |
37 | |
38 | package My::Subclass; |
39 | |
71d2a8c6 |
40 | use MooseX::InsideOut; |
fda3c8a5 |
41 | extends 'Some::Other::Class'; |
64468268 |
42 | |
43 | =head1 DESCRIPTION |
44 | |
71d2a8c6 |
45 | MooseX::InsideOut provides metaroles for inside-out objects. That is, it sets |
46 | up attribute slot storage somewhere other than inside C<$self>. This means |
47 | that you can extend non-Moose classes, whose internals you either don't want to |
48 | care about or aren't hash-based. |
64468268 |
49 | |
71d2a8c6 |
50 | =method init_meta |
64468268 |
51 | |
71d2a8c6 |
52 | Apply the instance metarole necessary for inside-out storage. |
64468268 |
53 | |
54 | =head1 TODO |
55 | |
56 | =over |
57 | |
58 | =item * dumping (for debugging purposes) |
59 | |
60 | =item * serialization (for e.g. storable) |
61 | |
62 | =item * (your suggestions here) |
63 | |
64 | =back |
65 | |
64468268 |
66 | =cut |