[Bast-commits] r4709 - DBIx-Class-Journal/1.000/trunk/lib/DBIx/Class/Schema

matthewt at dev.catalyst.perl.org matthewt at dev.catalyst.perl.org
Fri Aug 1 04:41:59 BST 2008


Author: matthewt
Date: 2008-08-01 04:41:59 +0100 (Fri, 01 Aug 2008)
New Revision: 4709

Modified:
   DBIx-Class-Journal/1.000/trunk/lib/DBIx/Class/Schema/Journal.pm
Log:
factor journal schema proto construction out so compose_namespace only runs once

Modified: DBIx-Class-Journal/1.000/trunk/lib/DBIx/Class/Schema/Journal.pm
===================================================================
--- DBIx-Class-Journal/1.000/trunk/lib/DBIx/Class/Schema/Journal.pm	2008-08-01 03:39:01 UTC (rev 4708)
+++ DBIx-Class-Journal/1.000/trunk/lib/DBIx/Class/Schema/Journal.pm	2008-08-01 03:41:59 UTC (rev 4709)
@@ -10,6 +10,8 @@
 __PACKAGE__->mk_classdata('journal_deploy_on_connect');
 __PACKAGE__->mk_classdata('journal_sources'); ## [ source names ]
 __PACKAGE__->mk_classdata('journal_user'); ## [ class, field for user id ]
+__PACKAGE__->mk_classdata('journal_single_schema');
+__PACKAGE__->mk_classdata('__journal_schema_prototype');
 __PACKAGE__->mk_classdata('_journal_schema'); ## schema object for journal
 __PACKAGE__->mk_classdata('journal_component');
 __PACKAGE__->mk_classdata('journal_nested_changesets');
@@ -38,6 +40,22 @@
     
 # }
 
+sub _journal_schema_prototype
+{
+    my $self = shift;
+    if (my $proto = $self->__journal_schema_prototype)
+    {
+          return $proto;
+    }
+    $self->__journal_schema_prototype
+    (
+        DBIx::Class::Schema::Journal::DB->compose_namespace
+        (
+            blessed($self) . '::Journal'
+        )
+    );
+}
+
 sub connection
 {
     my $self = shift;
@@ -45,7 +63,7 @@
 
 #   print STDERR join(":", $self->sources), "\n";
 
-    my $journal_schema = DBIx::Class::Schema::Journal::DB->compose_namespace(blessed($self) . '::Journal');
+    my $journal_schema = $self->_journal_schema_prototype;
 
     if($self->journal_connection)
     {




More information about the Bast-commits mailing list