guard against double import
[gitmo/Moo.git] / lib / Moo.pm
index 31727fe..cc8de95 100644 (file)
@@ -3,13 +3,18 @@ package Moo;
 use strictures 1;
 use Moo::_Utils;
 
+our $VERSION = '0.009001'; # 0.9.1
+$VERSION = eval $VERSION;
+
 our %MAKERS;
 
 sub import {
   my $target = caller;
   my $class = shift;
   strictures->import;
+  return if $MAKERS{$target}; # already exported into this package
   *{_getglob("${target}::extends")} = sub {
+    _load_module($_) for @_;
     *{_getglob("${target}::ISA")} = \@_;
   };
   *{_getglob("${target}::with")} = sub {
@@ -29,6 +34,7 @@ sub import {
   };
   foreach my $type (qw(before after around)) {
     *{_getglob "${target}::${type}"} = sub {
+      require Class::Method::Modifiers;
       _install_modifier($target, $type, @_);
     };
   }