[Jifty-commit] r6703 - in Template-Declare/trunk: .

Jifty commits jifty-commit at lists.jifty.org
Wed Mar 25 16:04:36 EDT 2009


Author: alexmv
Date: Wed Mar 25 16:04:36 2009
New Revision: 6703

Modified:
   Template-Declare/trunk/   (props changed)
   Template-Declare/trunk/lib/Template/Declare/Tags.pm

Log:
 r43623 at kohr-ah:  chmrr | 2009-03-25 15:43:55 -0400
 Work around a couple calls to buffer->length, which is too slow


Modified: Template-Declare/trunk/lib/Template/Declare/Tags.pm
==============================================================================
--- Template-Declare/trunk/lib/Template/Declare/Tags.pm	(original)
+++ Template-Declare/trunk/lib/Template/Declare/Tags.pm	Wed Mar 25 16:04:36 2009
@@ -584,7 +584,7 @@
     my $coderef = shift;
 
     Template::Declare->buffer->append("\n");
-    Template::Declare->buffer->push( from => "T::D tag wrapper");
+    Template::Declare->buffer->push( from => "T::D tag wrapper", private => 1 );
 
     my %attr = %ATTRIBUTES;
     %ATTRIBUTES = ();                              # prevent leakage
@@ -593,9 +593,9 @@
         map { ref($_) ? $_ : _postprocess($_) }    #
         $coderef->(%attr);
 
-    my $has_content = Template::Declare->buffer->length;
-    Template::Declare->buffer->pop;
-    Template::Declare->buffer->append( "$last" ) if not $has_content and length $last;
+    my $content = Template::Declare->buffer->pop;
+    $content .= "$last" if not length $content and length $last;
+    Template::Declare->buffer->append( $content ) ;
 
     return '';
 }
@@ -626,6 +626,7 @@
     );
 
     my $attrs = "";
+    my $last;
     {
         no warnings qw( uninitialized redefine once );
 
@@ -655,10 +656,10 @@
         local $TAG_NEST_DEPTH = $TAG_NEST_DEPTH + 1;
         %ATTRIBUTES = ();
         Template::Declare->buffer->push( private => 1, from => "T::D tag $tag" );
-        my $last = join '', map { ref($_) && $_->isa('Template::Declare::Tag') ? $_ : _postprocess($_) } $code->();
-        Template::Declare->buffer->append("$last") if not Template::Declare->buffer->length and length $last;
+        $last = join '', map { ref($_) && $_->isa('Template::Declare::Tag') ? $_ : _postprocess($_) } $code->();
     }
     my $content = Template::Declare->buffer->pop;
+    $content .= "$last" if not length $content and length $last;
     Template::Declare->buffer->append($attrs);
 
     if (length $content) {


More information about the Jifty-commit mailing list