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

Jifty commits jifty-commit at lists.jifty.org
Sat Oct 10 07:38:26 EDT 2009


Author: ruz
Date: Sat Oct 10 07:38:26 2009
New Revision: 7538

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

Log:
the if/else block was there for perfomance reasons, now there is no point in it

Earlier else branch didn't need buffers so it was faster. Now we use buffers
in any case, so code can be merged.


Modified: Template-Declare/branches/mixmaster/lib/Template/Declare/Tags.pm
==============================================================================
--- Template-Declare/branches/mixmaster/lib/Template/Declare/Tags.pm	(original)
+++ Template-Declare/branches/mixmaster/lib/Template/Declare/Tags.pm	Sat Oct 10 07:38:26 2009
@@ -783,18 +783,13 @@
     my $template = shift;
     my $args = \@_;
 
-    if (defined wantarray) {
-        Template::Declare->buffer->push( private => 1, from => "T::D path $template" );
-        _show_template( $template, 0, $args );
-        %ELEMENT_ID_CACHE = ();
-        return Template::Declare->buffer->pop;
-    } else {
-        Template::Declare->buffer->push( from => "T::D path $template" );
-        _show_template( $template, 0, $args );
-        %ELEMENT_ID_CACHE = ();
-        Template::Declare->buffer->pop;
-        return undef;
-    }
+    Template::Declare->buffer->push(
+        private => defined wantarray,
+        from => "T::D path $template",
+    );
+    _show_template( $template, 0, $args );
+    %ELEMENT_ID_CACHE = ();
+    return Template::Declare->buffer->pop;
 }
 
 sub _resolve_template_path {


More information about the Jifty-commit mailing list