added Mouse::Meta::Class->create(_anon_class)?
[gitmo/Mouse.git] / lib / Mouse / Util.pm
index 77cbb2a..f1c0862 100644 (file)
@@ -2,7 +2,7 @@
 package Mouse::Util;
 use strict;
 use warnings;
-use Exporter 'import';
+use base qw/Exporter/;
 use Carp;
 
 our @EXPORT_OK = qw(
@@ -20,7 +20,9 @@ our %EXPORT_TAGS = (
 # We only have to do this nastiness if we haven't loaded XS version of
 # Mouse.pm, so check if we're running under PurePerl or not
 BEGIN {
-    if ($Mouse::PurePerl) {
+    # Checking for undefinedness will ensure that our functions are
+    # properly loaded without loading Mouse, but this is kind of ugly
+    if ($Mouse::PurePerl || ! defined $Mouse::PurePerl) {
         my %dependencies = (
             'Scalar::Util' => {
     #       VVVVV   CODE TAKEN FROM SCALAR::UTIL   VVVVV
@@ -173,7 +175,7 @@ BEGIN {
         #   weaken
         # other functions need to be loaded from our respective sources
 
-        if (defined &Scalar::Util::openhandle || eval { require Scalar::Util; 1 }) {
+        if (defined &Scalar::Util::openhandle) {
             *openhandle = \&Scalar::Util::openhandle;
         } else {
             # XXX - room for improvement