[svn:p5ee] r9386 - p5ee/trunk/App-Repository/lib/App

[email protected]
Newsgroups perl.cvs.p5ee
Message-ID <[email protected]>
Author: spadkins
Date: Mon Apr  9 11:37:16 2007
New Revision: 9386

Modified:
   p5ee/trunk/App-Repository/lib/App/Repository.pm

Log:
allow a repository to be made up of multiple *.pl files, one for each table (including overlays)

Modified: p5ee/trunk/App-Repository/lib/App/Repository.pm
==============================================================================
--- p5ee/trunk/App-Repository/lib/App/Repository.pm	(original)
+++ p5ee/trunk/App-Repository/lib/App/Repository.pm	Mon Apr  9 11:37:16 2007
@@ -3554,7 +3554,6 @@
 
     # if it's already been loaded, don't do it again
     return if (defined $self->{table}{$table}{loaded});
-    $self->{table}{$table}{loaded} = 1;   # mark it as having been loaded
 
     my ($table_def, $columns, $column, $column_def, $idx, $native_column);
 
@@ -3566,10 +3565,18 @@
         my $table_file = "$prefix/etc/app/Repository/$self->{name}/$table.$conf_type";
         if (-r $table_file) {
             $table_def = App::Conf::File->create({ conf_file => $table_file });
-            $self->{table}{$table} = $table_def;
+            if ($table_def->{overlay}) {
+                delete $table_def->{overlay};
+                App::Reference->overlay($self->{context}{conf}, $table_def); # Caution. Use with care.
+            }
+            else {
+                $self->{table}{$table} = $table_def;
+            }
         }
     }
 
+    $self->{table}{$table}{loaded} = 1;   # mark it as having been loaded
+
     return if (!defined $table_def);
 
     # load up all additional information from the native metadata
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.