[Jifty-commit] r2690 - in jifty/trunk: lib/Jifty/Module

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sun Jan 28 09:52:47 EST 2007


Author: jesse
Date: Sun Jan 28 09:52:47 2007
New Revision: 2690

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Module/Pluggable.pm

Log:
 r21628 at hualien:  jesse | 2007-01-28 22:52:22 +0800
 * A better implementation of our Module::Pluggable custom 'require' method.


Modified: jifty/trunk/lib/Jifty/Module/Pluggable.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Module/Pluggable.pm	(original)
+++ jifty/trunk/lib/Jifty/Module/Pluggable.pm	Sun Jan 28 09:52:47 2007
@@ -30,13 +30,29 @@
 was done. 
 
 
+=head3  But Simon is lying...
+
+What we actually need to override is Module::Pluggable::Object::_require, which we do below.
+
+
 =cut
 
 
-sub require {
+use Module::Pluggable::Object;
+sub Module::Pluggable::Object::_require {
     my $self = shift;
     my $module = shift;
-    Jifty::Util->require($module);
-}
+
+    # Module::Pluggable::Object::_require expects a true value (the error message) on failure
+    # On success, it expects you to return undef.
+
+    if (!Jifty::Util->require($module) ) {
+        return $UNIVERSAL::require::ERROR;
+    } else {
+        return undef;
+    }
+
+
+} 
 
 1;


More information about the Jifty-commit mailing list