allow either fleshed or unfleshed module objects
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 28 Jan 2009 01:59:53 +0000 (01:59 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 28 Jan 2009 01:59:53 +0000 (01:59 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@12004 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Trigger/ModRunner.pm

index f5a0fe1..e8d4163 100644 (file)
@@ -7,12 +7,11 @@ sub new {
     my $class = shift;
     $class = ref($class) || $class;
 
-    my $mod_thing = shift;
-    return undef unless ($mod_thing);
+    my $mod = shift;
+    return undef unless ($mod);
 
     my $self = bless {
-        mod_thing => $mod_thing,
-        module => $mod_thing->module(),
+        module => ref $mod ? $mod->module() : $mod,
         handler => 'handler'
     } => $class;
 
@@ -76,6 +75,15 @@ sub load {
                 }
             } else {
                 $loaded = $m->use;
+
+                # The following is an escape hatch for builtin dummy handlers
+                if (!$loaded) {
+                    $loaded = $self->prefix->use;
+                    if ($loaded && $self->prefix->can( $self->module ) ) {
+                        $m = $self->prefix;
+                        $h = $self->module;
+                    }
+                }
             }
         } else {
             $m = $builtin_m;