[open-ils-commits] r8970 - trunk/Open-ILS/src/perlmods/OpenILS/Application

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Mar 11 13:23:08 EDT 2008


Author: miker
Date: 2008-03-11 12:49:55 -0400 (Tue, 11 Mar 2008)
New Revision: 8970

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/PermaCrud.pm
Log:
generate methods after loading the IDL

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/PermaCrud.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/PermaCrud.pm	2008-03-11 16:36:32 UTC (rev 8969)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/PermaCrud.pm	2008-03-11 16:49:55 UTC (rev 8970)
@@ -46,6 +46,8 @@
     $idl = $parser->parse_file( $idl_file );
 
     $log->debug( 'IDL XML file loaded' );
+
+    generate_methods();
 }
 sub child_init {}
 
@@ -169,31 +171,32 @@
     return undef;
 }
 
-for my $class_node ( $xpc->findnodes( '//idl:class[perm:permacrud]', $idl->documentElement ) ) {
-    my $hint = $class_node->getAttribute('id');
-
-    for my $action_node ( $xpc->findnodes( "perm:permacrud/perm:actions/perm:*", $class_node ) ) {
-        my $method = $action_node->localname =~ s/^.+:(.+)$/$1/o;
-
-        __PACKAGE__->register_method(
-            method          => 'CRUD_action_object_permcheck',
-            api_name        => 'open-ils.permacrud.' . $method . '.' . $hint,
-            authoritative   => 1,
-            class_hint      => $hint,
-        );
-
-        if ($method eq 'retrieve') {
+sub generate_methods {
+    for my $class_node ( $xpc->findnodes( '//idl:class[perm:permacrud]', $idl->documentElement ) ) {
+        my $hint = $class_node->getAttribute('id');
+    
+        for my $action_node ( $xpc->findnodes( "perm:permacrud/perm:actions/perm:*", $class_node ) ) {
+            my $method = $action_node->localname =~ s/^.+:(.+)$/$1/o;
+    
             __PACKAGE__->register_method(
-                method      => 'search_permcheck',
-                api_name    => 'open-ils.permacrud.search.' . $hint,
-                class_hint  => $hint,
-                retriever   => 'open-ils.permacrud.retrieve.' . $hint,
-                stream      => 1
+                method          => 'CRUD_action_object_permcheck',
+                api_name        => 'open-ils.permacrud.' . $method . '.' . $hint,
+                authoritative   => 1,
+                class_hint      => $hint,
             );
+    
+            if ($method eq 'retrieve') {
+                __PACKAGE__->register_method(
+                    method      => 'search_permcheck',
+                    api_name    => 'open-ils.permacrud.search.' . $hint,
+                    class_hint  => $hint,
+                    retriever   => 'open-ils.permacrud.retrieve.' . $hint,
+                    stream      => 1
+                );
+            }
         }
     }
 }
-    
 
 
 1;



More information about the open-ils-commits mailing list