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

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Mon Oct 9 10:11:31 EDT 2006


Author: gaal
Date: Mon Oct  9 10:11:29 2006
New Revision: 2008

Modified:
   Jifty-DBI/trunk/Changes
   Jifty-DBI/trunk/lib/Jifty/DBI/Schema.pm

Log:
* avoid a warning in Jifty::DBI::Schema when our user is executing
  a .pm file. When that is the case, caller(1) is not defined.


Modified: Jifty-DBI/trunk/Changes
==============================================================================
--- Jifty-DBI/trunk/Changes	(original)
+++ Jifty-DBI/trunk/Changes	Mon Oct  9 10:11:29 2006
@@ -1,3 +1,6 @@
+ * avoid a warning in Jifty::DBI::Schema when our user is executing a
+   .pm file
+ 
 Revision history for Perl extension Jifty::DBI.
 
 0.25 Tue Sep 12 23:52:45 BST 2006

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	Mon Oct  9 10:11:29 2006
@@ -166,7 +166,9 @@
     # then we know that we are going to initialize methods later
     # through the &schema wrapper, so we defer initialization here
     # to not upset column names such as "label" and "type".
-    return if caller(1) eq __PACKAGE__;
+    # (We may not *have* a caller(1) if the user is executing a .pm file.)
+    my $caller1 = caller(1);
+    return if defined $caller1 && $caller1 eq __PACKAGE__;
 
     $from->_init_methods_for_column($column)
 }


More information about the Jifty-commit mailing list