[Jifty-commit] r2759 - in Template-Declare: lib/Template/Declare t

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Wed Feb 7 03:29:03 EST 2007


Author: clkao
Date: Wed Feb  7 03:29:02 2007
New Revision: 2759

Modified:
   Template-Declare/lib/Template/Declare.pm
   Template-Declare/lib/Template/Declare/Tags.pm
   Template-Declare/t/aliasing.t
   Template-Declare/t/importing.t

Log:
* Fix $self for importing.
* Rename import to import_templates for now as it's conflicting with
  jifty::view::declare's import.


Modified: Template-Declare/lib/Template/Declare.pm
==============================================================================
--- Template-Declare/lib/Template/Declare.pm	(original)
+++ Template-Declare/lib/Template/Declare.pm	Wed Feb  7 03:29:02 2007
@@ -221,16 +221,16 @@
 }
 
 
-=head2 import
+=head2 import_templates
 
 
- import Wifty::UI::something under '/something';
+ import_templates Wifty::UI::something under '/something';
 
 
 =cut
 
 
-sub import {
+sub import_templates {
     return undef if $_[0] eq 'Template::Declare';
     my $import_into      = caller(0);
     my $import_from_base = shift;

Modified: Template-Declare/lib/Template/Declare/Tags.pm
==============================================================================
--- Template-Declare/lib/Template/Declare/Tags.pm	(original)
+++ Template-Declare/lib/Template/Declare/Tags.pm	Wed Feb  7 03:29:02 2007
@@ -43,7 +43,9 @@
 
     # template "foo" ==> CallerPkg::_jifty_template_foo;
     # template "foo/bar" ==> CallerPkg::_jifty_template_foo/bar;
-    my $codesub = sub { my $self = shift if ($_[0]); &$coderef($self) };
+    my $codesub = sub { local $self = $_[0] || $self || $template_class;
+			#local $self = $template_class unless $self;
+                        &$coderef($self) };
 
     if (wantarray) { 
         # We're being called by something like private that doesn't want us to register ourselves

Modified: Template-Declare/t/aliasing.t
==============================================================================
--- Template-Declare/t/aliasing.t	(original)
+++ Template-Declare/t/aliasing.t	Wed Feb  7 03:29:02 2007
@@ -55,7 +55,6 @@
 ok( Template::Declare->has_template('aliased_subclass_pkg/aliased'), "When you subclass and then alias, the superclass's aliass are there" );
 
 {
-    local $Template::Declare::Tags::self = 'Wifty::UI';
     my $simple = ( show('aliased_pkg/aliased') );
     like( $simple, qr'This is aliased' );
     like( $simple, qr'Wifty::UI::aliased_pkg',
@@ -65,7 +64,6 @@
 
 
 {
-    local $Template::Declare::Tags::self = 'Wifty::UI';
     my $simple = ( show('aliased_subclass_pkg/aliased') );
     like(
         $simple,

Modified: Template-Declare/t/importing.t
==============================================================================
--- Template-Declare/t/importing.t	(original)
+++ Template-Declare/t/importing.t	Wed Feb  7 03:29:02 2007
@@ -34,8 +34,8 @@
     };
 };
 
-import Wifty::UI::imported_pkg under '/imported_pkg';
-import Wifty::UI::imported_subclass_pkg under '/imported_subclass_pkg';
+import_templates Wifty::UI::imported_pkg under '/imported_pkg';
+import_templates Wifty::UI::imported_subclass_pkg under '/imported_subclass_pkg';
 
 package main;
 use Template::Declare::Tags;
@@ -51,7 +51,6 @@
 ok( Template::Declare->has_template('imported_subclass_pkg/imported'), "When you subclass and then import, the superclass's imports are there" );
 
 {
-    local $Template::Declare::Tags::self = 'Wifty::UI';
     my $simple = ( show('imported_pkg/imported') );
     like( $simple, qr'This is imported' );
     like( $simple, qr'Wifty::UI',
@@ -60,7 +59,6 @@
 }
 
 {
-    local $Template::Declare::Tags::self = 'Wifty::UI';
     my $simple = ( show('imported_subclass_pkg/imported') );
     like(
         $simple,


More information about the Jifty-commit mailing list