From: Adam Kennedy Date: Thu, 7 Sep 2006 05:59:54 +0000 (+0000) Subject: Removing the use of UNIVERSAL::require X-Git-Tag: 0_14~13 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMoose.git;a=commitdiff_plain;h=3c2bc5e2dc448e36704a71f25d66503cef8831fb;hp=e95c7c42186441314d04af44f7e65562772d9d83 Removing the use of UNIVERSAL::require --- diff --git a/Build.PL b/Build.PL index 13c519e..3dea010 100644 --- a/Build.PL +++ b/Build.PL @@ -2,15 +2,17 @@ use Module::Build; use strict; +# Scalar::Util 1.18 doesn't work on Windows +my $win32 = !! ( $^O eq 'Win32' or $^O eq 'cygwin' ); + my $build = Module::Build->new( module_name => 'Moose', license => 'perl', requires => { - 'Scalar::Util' => '1.18', + 'Scalar::Util' => $win32 ? '1.17' : '1.18', 'Carp' => '0', 'Class::MOP' => '0.34', 'Sub::Name' => '0.02', - 'UNIVERSAL::require' => '0.10', 'Sub::Exporter' => '0.954', 'Sub::Install' => '0.92', 'B' => '0', diff --git a/Changes b/Changes index da21afd..4f5c417 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,10 @@ Revision history for Perl extension Moose 0.13 + * Moose + - Removed the use of UNIVERSAL::require to be a better + symbol table citizen and remove a dependency. + * Moose::Cookbook - added a FAQ and WTF files to document frequently asked questions and common problems @@ -9,6 +13,10 @@ Revision history for Perl extension Moose - properly capturing error when type constraint is not found + * Build.PL + - Scalar::Util 1.18 is bad on Win32, so temporarily + only require version 1.17 for Win32 and cygwin. + 0.12 Sat. Sept. 1, 2006 * Moose::Cookbook - Recipe5 (subtypes & coercion) has been written diff --git a/lib/Moose.pm b/lib/Moose.pm index 80204a9..8f6d75e 100644 --- a/lib/Moose.pm +++ b/lib/Moose.pm @@ -11,7 +11,6 @@ use Carp 'confess'; use Sub::Name 'subname'; use B 'svref_2object'; -use UNIVERSAL::require; use Sub::Exporter; use Class::MOP; @@ -224,9 +223,13 @@ sub _load_all_classes { # loading has a locally defined # &require, we make sure that we # use the on in UNIVERSAL - ($super->UNIVERSAL::require) - || confess "Could not load module '$super' because : " . $UNIVERSAL::require::ERROR; - } + my $file = $class . '.pm'; + $file =~ s{::}{/}g; + eval { CORE::require($file) }; + confess( + "Could not load module '$super' because : $@" + ) if $@; + } } sub _is_class_already_loaded { @@ -237,7 +240,7 @@ sub _is_class_already_loaded { next if substr($_, -2, 2) eq '::'; return 1 if defined &{"${name}::$_"}; } - return 0; + return 0; } 1;