switch interfaces to be less weird
[gitmo/MooseX-InsideOut.git] / lib / MooseX / InsideOut.pm
index 4f993f5..2f0c41f 100644 (file)
@@ -3,10 +3,31 @@ use warnings;
 
 package MooseX::InsideOut;
 
-use metaclass 'MooseX::InsideOut::Meta::Class';
-use Moose;
+use MooseX::InsideOut::Meta::Class;
+BEGIN { require Moose }
+use Carp;
 
-our $VERSION = '0.001';
+our $VERSION = '0.002';
+
+sub import {
+  my $class = shift;
+  
+  if (@_) { Carp::confess "$class has no exports" }
+
+  my $into = caller;
+
+  return if $into eq 'main';
+
+  Moose::init_meta(
+    $into,
+    'Moose::Object',
+    'MooseX::InsideOut::Meta::Class',
+  );
+
+  Moose->import({ into => $into });
+
+  return;
+}
 
 1;
 __END__
@@ -17,14 +38,13 @@ MooseX::InsideOut - inside-out objects with Moose
 
 =head1 VERSION
 
-Version 0.001
+Version 0.002
 
 =head1 SYNOPSIS
 
   package My::Object;
 
-  use Moose;
-  extends 'MooseX::InsideOut';
+  use MooseX::InsideOut;
 
   # ... normal Moose functionality
   # or ...
@@ -33,15 +53,16 @@ Version 0.001
 
   use metaclass 'MooseX::InsideOut::Meta::Class';
   use Moose;
-  extends 'Some::Other::Class;
+  extends 'Some::Other::Class';
 
 =head1 DESCRIPTION
 
 MooseX::InsideOut provides a metaclass and an instance metaclass for inside-out
 objects.
 
-You can use MooseX::InsideOut as a normal base class, as in the first example
-in the L</SYNOPSIS>.
+You can use MooseX::InsideOut, as in the first example in the L</SYNOPSIS>.
+This sets up the metaclass and instance metaclass for you, as well as importing
+all of the normal Moose goodies.
 
 You can also use the metaclass C<MooseX::InsideOut::Meta::Class> directly, as
 in the second example.  This is most useful when extending a non-Moose class,