switch interfaces to be less weird
[gitmo/MooseX-InsideOut.git] / lib / MooseX / InsideOut.pm
1 use strict;
2 use warnings;
3
4 package MooseX::InsideOut;
5
6 use MooseX::InsideOut::Meta::Class;
7 BEGIN { require Moose }
8 use Carp;
9
10 our $VERSION = '0.002';
11
12 sub import {
13   my $class = shift;
14   
15   if (@_) { Carp::confess "$class has no exports" }
16
17   my $into = caller;
18
19   return if $into eq 'main';
20
21   Moose::init_meta(
22     $into,
23     'Moose::Object',
24     'MooseX::InsideOut::Meta::Class',
25   );
26
27   Moose->import({ into => $into });
28
29   return;
30 }
31
32 1;
33 __END__
34
35 =head1 NAME
36
37 MooseX::InsideOut - inside-out objects with Moose
38
39 =head1 VERSION
40
41 Version 0.002
42
43 =head1 SYNOPSIS
44
45   package My::Object;
46
47   use MooseX::InsideOut;
48
49   # ... normal Moose functionality
50   # or ...
51
52   package My::Subclass;
53
54   use metaclass 'MooseX::InsideOut::Meta::Class';
55   use Moose;
56   extends 'Some::Other::Class';
57
58 =head1 DESCRIPTION
59
60 MooseX::InsideOut provides a metaclass and an instance metaclass for inside-out
61 objects.
62
63 You can use MooseX::InsideOut, as in the first example in the L</SYNOPSIS>.
64 This sets up the metaclass and instance metaclass for you, as well as importing
65 all of the normal Moose goodies.
66
67 You can also use the metaclass C<MooseX::InsideOut::Meta::Class> directly, as
68 in the second example.  This is most useful when extending a non-Moose class,
69 whose internals you either don't want to care about or aren't hash-based.
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, C<< <hdp at pobox.com> >>
86
87 =head1 BUGS
88
89 Please report any bugs or feature requests to C<bug-moosex-insideout at rt.cpan.org>, or through
90 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MooseX-InsideOut>.  I will be notified, and then you'll
91 automatically be notified of progress on your bug as I make changes.
92
93 =head1 SUPPORT
94
95 You can find documentation for this module with the perldoc command.
96
97     perldoc MooseX::InsideOut
98
99
100 You can also look for information at:
101
102 =over 4
103
104 =item * RT: CPAN's request tracker
105
106 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=MooseX-InsideOut>
107
108 =item * AnnoCPAN: Annotated CPAN documentation
109
110 L<http://annocpan.org/dist/MooseX-InsideOut>
111
112 =item * CPAN Ratings
113
114 L<http://cpanratings.perl.org/d/MooseX-InsideOut>
115
116 =item * Search CPAN
117
118 L<http://search.cpan.org/dist/MooseX-InsideOut>
119
120 =back
121
122
123 =head1 ACKNOWLEDGEMENTS
124
125
126 =head1 COPYRIGHT & LICENSE
127
128 Copyright 2008 Hans Dieter Pearcey.
129
130 This program is free software; you can redistribute it and/or modify it
131 under the same terms as Perl itself.
132
133 =cut