[Jifty-commit] r3268 - in Template-Declare: lib/Template

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sun May 20 15:35:56 EDT 2007


Author: jesse
Date: Sun May 20 15:35:56 2007
New Revision: 3268

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

Log:
 r56989 at 232:  jesse | 2007-05-20 15:35:32 -0400
 * mnore minor simplifications. Working ot decrease needless complexity
 
 


Modified: Template-Declare/lib/Template/Declare.pm
==============================================================================
--- Template-Declare/lib/Template/Declare.pm	(original)
+++ Template-Declare/lib/Template/Declare.pm	Sun May 20 15:35:56 2007
@@ -254,29 +254,19 @@
         @packages = ( @{ $import_from_base . "::ISA" }, $import_from_base );
     }
     foreach my $import_from (@packages) {
-        foreach my $template_name (
-            @{ __PACKAGE__->templates()->{$import_from} } )
-        {
-            $import_into->register_template(
-                $prepend_path . "/" . $template_name,
-                $import_from->_find_template_sub(
-                    _template_name_to_sub($template_name)
-                )
-            );
+        foreach my $template_name ( @{ __PACKAGE__->templates()->{$import_from} } ) {
+            my $code = $import_from->_find_template_sub( _template_name_to_sub($template_name));
+            $import_into->register_template( $prepend_path . "/" . $template_name, $code );
         }
-        foreach my $template_name (
-            @{ __PACKAGE__->private_templates()->{$import_from} } )
-        {
-            my $code = $import_from->_find_template_sub(
-                _template_name_to_private_sub($template_name) );
-            $import_into->register_private_template(
-                $prepend_path . "/" . $template_name, $code );
+        foreach my $template_name ( @{ __PACKAGE__->private_templates()->{$import_from} } ) {
+            my $code = $import_from->_find_template_sub( _template_name_to_private_sub($template_name) );
+            $import_into->register_private_template( $prepend_path . "/" . $template_name, $code );
         }
     }
 
 }
 
-=head2 path_for
+=head2 path_for $template
 
  Returns the path for the template name to be used for show, adjusted
  with paths used in import_templates.
@@ -284,23 +274,21 @@
 =cut
 
 sub path_for {
-    my ( $class, $template ) = @_;
-    my $prepend = $class->imported_into;
-    $prepend = '' unless defined $prepend;
-    return $prepend . '/' . $template;
+    my $class = shift;
+    my $template = shift;
+    return ($class->imported_into ||'') . '/' . $template;
 }
 
 =head2 has_template PACKAGE TEMPLATE_NAME SHOW_PRIVATE
 
 Takes a package, template name and a boolean. The boolean determines whether to show private templates.
 
-Returns a reference to the template's code if found. Otherwise, 
-returns undef.
+Returns a reference to the template's code if found. Otherwise, returns undef.
 
 =cut
 
 sub has_template {
-    resolve_template(@_) || _has_template(@_);
+   return resolve_template(@_);
 }
 
 sub _has_template {


More information about the Jifty-commit mailing list