[Jifty-commit] r2215 - Template-Declare/lib/Template

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Wed Nov 29 08:44:20 EST 2006


Author: audreyt
Date: Wed Nov 29 08:44:19 2006
New Revision: 2215

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

Log:
* Template::Declare - Allow has_template('foo/bar') and has_template('foo::bar').
* Also, negative version numbers is really hard to deploy.  Make it positive.

Modified: Template-Declare/lib/Template/Declare.pm
==============================================================================
--- Template-Declare/lib/Template/Declare.pm	(original)
+++ Template-Declare/lib/Template/Declare.pm	Wed Nov 29 08:44:19 2006
@@ -3,7 +3,7 @@
 
 package Template::Declare;
 
-$Template::Declare::VERSION = "-1.00_01";
+$Template::Declare::VERSION = "0.00_01";
 
 =head1 NAME
 
@@ -31,10 +31,17 @@
 
 sub has_template {
     my $pkg = shift;
-    my $templatename = shift;
+    my $template_name = shift;
+    $template_name =~ s{/}{::}g;
 
-    my $callable = "_jifty_template_".$templatename;
-    return $pkg->can($callable);
+    if ($template_name =~ /(.*)::(.*)/) {
+        # Qualified name
+        return "$pkg\::$1"->can("_jifty_template_$2");
+    }
+    else {
+        # Unqualifid name
+        return $pkg->can("_jifty_template_$template_name");
+    }
 
 }
 


More information about the Jifty-commit mailing list