[Jifty-commit] r2691 - in jifty/branches/virtual-models: lib/Jifty/Module

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sun Jan 28 09:56:22 EST 2007


Author: jesse
Date: Sun Jan 28 09:56:21 2007
New Revision: 2691

Modified:
   jifty/branches/virtual-models/   (props changed)
   jifty/branches/virtual-models/lib/Jifty/Module/Pluggable.pm

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


Modified: jifty/branches/virtual-models/lib/Jifty/Module/Pluggable.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Module/Pluggable.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Module/Pluggable.pm	Sun Jan 28 09:56:21 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