dzil-ize
[gitmo/MooseX-InsideOut.git] / lib / MooseX / InsideOut.pm
CommitLineData
64468268 1use strict;
2use warnings;
3
4package MooseX::InsideOut;
fff3c901 5# ABSTRACT: inside-out objects with Moose
64468268 6
fda3c8a5 7use MooseX::InsideOut::Meta::Class;
8BEGIN { require Moose }
9use Carp;
64468268 10
fda3c8a5 11sub import {
12 my $class = shift;
13
14 if (@_) { Carp::confess "$class has no exports" }
15
16 my $into = caller;
17
18 return if $into eq 'main';
19
20 Moose::init_meta(
21 $into,
22 'Moose::Object',
23 'MooseX::InsideOut::Meta::Class',
24 );
25
26 Moose->import({ into => $into });
27
28 return;
29}
0a374e17 30
64468268 311;
32__END__
33
64468268 34=head1 SYNOPSIS
35
36 package My::Object;
37
fda3c8a5 38 use MooseX::InsideOut;
64468268 39
40 # ... normal Moose functionality
41 # or ...
42
43 package My::Subclass;
44
45 use metaclass 'MooseX::InsideOut::Meta::Class';
46 use Moose;
fda3c8a5 47 extends 'Some::Other::Class';
64468268 48
49=head1 DESCRIPTION
50
51MooseX::InsideOut provides a metaclass and an instance metaclass for inside-out
52objects.
53
fda3c8a5 54You can use MooseX::InsideOut, as in the first example in the L</SYNOPSIS>.
55This sets up the metaclass and instance metaclass for you, as well as importing
56all of the normal Moose goodies.
64468268 57
58You can also use the metaclass C<MooseX::InsideOut::Meta::Class> directly, as
59in the second example. This is most useful when extending a non-Moose class,
60whose internals you either don't want to care about or aren't hash-based.
61
62=head1 TODO
63
64=over
65
66=item * dumping (for debugging purposes)
67
68=item * serialization (for e.g. storable)
69
70=item * (your suggestions here)
71
72=back
73
64468268 74=cut