[Jifty-commit] r7546 - Template-Declare/branches/mixmaster/lib/Template

Jifty commits jifty-commit at lists.jifty.org
Sat Oct 10 21:27:39 EDT 2009


Author: theory
Date: Sat Oct 10 21:27:38 2009
New Revision: 7546

Modified:
   Template-Declare/branches/mixmaster/lib/Template/Declare.pm

Log:
Better name for the variable containign the class being mixed in. Also fixed a
bug in the assigning of the package variables and restored the `shift` that
gets reid of the pased in `$self` class in such mixed-in templates.


Modified: Template-Declare/branches/mixmaster/lib/Template/Declare.pm
==============================================================================
--- Template-Declare/branches/mixmaster/lib/Template/Declare.pm	(original)
+++ Template-Declare/branches/mixmaster/lib/Template/Declare.pm	Sat Oct 10 21:27:38 2009
@@ -869,15 +869,14 @@
 }
 
 sub _import_code {
-    my ($tname, $from, $to, $vars) = @_;
+    my ($tname, $from, $mixin, $vars) = @_;
     my $code = $from->_find_template_sub( _template_name_to_sub($tname) );
-    return $to eq $from ? $code : sub { $code->($to, @_) }
+    return $mixin eq $from ? $code : sub { shift; $code->($mixin, @_) }
         unless $vars;
     return sub {
-        # XXX This does not seem to be needed.
-        # shift @_;  # Get rid of the passed-in "$self" class.
-        local $TEMPLATE_VARS->{$from} = $vars;
-        $code->($to, @_);
+        shift @_;  # Get rid of the passed-in "$self" class.
+        local $TEMPLATE_VARS->{$mixin} = $vars;
+        $code->($mixin, @_);
     };
 }
 


More information about the Jifty-commit mailing list