[Jifty-commit] r1561 - in Jifty-DBI/trunk: lib/Jifty/DBI

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Thu Jul 13 16:55:50 EDT 2006


Author: audreyt
Date: Thu Jul 13 16:55:50 2006
New Revision: 1561

Modified:
   Jifty-DBI/trunk/lib/Jifty/DBI/Schema.pm
   Jifty-DBI/trunk/t/testmodels.pl

Log:
* Lift the call of schema to BEGIN time:

    use base schema {
        ...
    };

  as otherwise it can't work with "sub label {...}" defined below.


Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Schema.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Schema.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Schema.pm	Thu Jul 13 16:55:50 2006
@@ -11,8 +11,7 @@
 
     package Wifty::Model::Page;
     use Jifty::DBI::Schema;
-
-    schema {
+    use base schema {
     # ... your columns here ...
     };
 
@@ -57,7 +56,9 @@
 =head2 schema
 
 Takes a block with schema declarations.  Unimports all helper functions after
-executing the code block.
+executing the code block.  Usually used at C<BEGIN> time via this idiom:
+
+    use base schema { ... };
 
 =cut
 
@@ -65,7 +66,7 @@
     my $code = shift;
 
     # First we run the code as usual.
-    my $rv   = $code->();
+    $code->();
 
     # Unimport all our symbols from the calling package.
     my $from = (caller)[0];
@@ -74,7 +75,7 @@
         undef *{"$from\::$sym"};
     }
 
-    return $rv;
+    return ();
 }
 
 =head2 column

Modified: Jifty-DBI/trunk/t/testmodels.pl
==============================================================================
--- Jifty-DBI/trunk/t/testmodels.pl	(original)
+++ Jifty-DBI/trunk/t/testmodels.pl	Thu Jul 13 16:55:50 2006
@@ -1,8 +1,7 @@
 package Sample::Employee;
 use Jifty::DBI::Schema;
 use base qw/Jifty::DBI::Record/;
-
-schema {
+use base schema {
 
 column dexterity => type is 'integer';
 column name      => type is 'varchar';


More information about the Jifty-commit mailing list