From: Dave Rolsky Date: Sat, 12 Sep 2009 23:20:03 +0000 (-0500) Subject: make load_class return true for the benefit of dumb code in the wild X-Git-Tag: 0.93~21 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=674d9359dc0852c96f2b666bc3f371bda80c065c;p=gitmo%2FClass-MOP.git make load_class return true for the benefit of dumb code in the wild --- diff --git a/Changes b/Changes index b204afb..90f0b99 100644 --- a/Changes +++ b/Changes @@ -5,10 +5,10 @@ Next - Applied an MS VC++ compilation fix from Taro Nishino. RT #48072 * Class::MOP - - The load_class function no longer returns a value, since it's return - value was confusing (either a metaclass object or a class name). It - either loads a class or dies trying. Addresses RT #45883. (Dave - Rolsky) + - The load_class function just returns true, since it's return value was + confusing (either a metaclass object or a class name). It either loads + a class or dies trying. In the future, this may change to not return + anything. Addresses RT #45883. (Dave Rolsky) 0.92_01 Thu, Sep 10, 2009 * Class::MOP::Package diff --git a/lib/Class/MOP.pm b/lib/Class/MOP.pm index 3ea4fbd..b8437ac 100644 --- a/lib/Class/MOP.pm +++ b/lib/Class/MOP.pm @@ -134,7 +134,10 @@ sub _try_load_one_class { sub load_class { load_first_existing_class($_[0]); - return; + # This is done to avoid breaking code which checked the return value. Said + # code is dumb. The return value was _always_ true, since it dies on + # failure! + return 1; } sub _is_valid_class_name { @@ -914,6 +917,10 @@ loaded (as reported by C). This function can be used in place of tricks like C or using C unconditionally. +If the module cannot be loaded, an exception is thrown. + +For historical reasons, this function returns explicitly returns a true value. + =item B Returns a boolean indicating whether or not C<$class_name> has been