| 1 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | |||
| 4 | package MooseX::InsideOut; | ||
| 5 | 2 | ▶ | BEGIN { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 2 | $MooseX::InsideOut::VERSION = '0.106'; | |
| 7 | } | ||
| 8 | # ABSTRACT: inside-out objects with Moose | ||
| 9 | |||
| 10 | 2 | ▶ | use Moose (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 2 | ▶ | use Moose::Exporter; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 2 | ▶ | use Moose::Util::MetaRole; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | 2 | ▶ | use MooseX::InsideOut::Role::Meta::Instance; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | |||
| 15 | 2 | Moose::Exporter->setup_import_methods( | |
| 16 | also => [ 'Moose' ], | ||
| 17 | ); | ||
| 18 | |||
| 19 | 6 | ▶ | sub init_meta { |
|
Subroutine
init_meta: called CC=1 SCAR=0.0
Pod
documented
| |||
| 20 | 6 | shift; | |
| 21 | 6 | my %p = @_; | |
| 22 | 6 | Moose->init_meta(%p); | |
| 23 | Moose::Util::MetaRole::apply_metaroles( | ||
| 24 | for => $p{for_class}, | ||
| 25 | 6 | class_metaroles => { | |
| 26 | instance => [ 'MooseX::InsideOut::Role::Meta::Instance' ], | ||
| 27 | }, | ||
| 28 | ); | ||
| 29 | } | ||
| 30 | |||
| 31 | 2 | 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__ | ||