package Mouse::Util;
use strict;
use warnings;
-use Exporter 'import';
+use base qw/Exporter/;
use Carp;
our @EXPORT_OK = qw(
# 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
# 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