[Jifty-commit] r2406 - in Template-Declare: lib/Template
lib/Template/Declare
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Tue Dec 19 03:08:34 EST 2006
Author: jesse
Date: Tue Dec 19 03:08:34 2006
New Revision: 2406
Modified:
Template-Declare/ (props changed)
Template-Declare/lib/Template/Declare.pm
Template-Declare/lib/Template/Declare/Tags.pm
Log:
r46259 at pinglin: jesse | 2006-12-19 03:02:51 -0500
* show is no longer called as a method
* better handling of client code calling templates with a leading /
r46267 at pinglin: jesse | 2006-12-19 03:08:30 -0500
* warning avoidance
Modified: Template-Declare/lib/Template/Declare.pm
==============================================================================
--- Template-Declare/lib/Template/Declare.pm (original)
+++ Template-Declare/lib/Template/Declare.pm Tue Dec 19 03:08:34 2006
@@ -80,7 +80,6 @@
my $show_private = shift || 0;
foreach my $package (reverse @{Template::Declare->roots}) {
-
if ( my $coderef = $package->can( _template_name_to_sub($template_name) ) ) {
return $coderef;
}
@@ -93,15 +92,20 @@
}
sub _template_name_to_sub {
- my $template_name =shift;
- return "_jifty_template_".$template_name;
+ return _subname( "_jifty_template_", shift);
}
sub _template_name_to_private_sub {
my $template_name =shift;
- return "_jifty_private_template_".$template_name;
+ return _subname( "_jifty_private_template_", shift);
}
-
+sub _subname {
+ my $prefix = shift;
+ my $template = shift ||'';
+ $template =~ s{^/+}{};
+ $template =~ s{/+}{/}g;
+ return join ('', $prefix,$template);
+}
1;
Modified: Template-Declare/lib/Template/Declare/Tags.pm
==============================================================================
--- Template-Declare/lib/Template/Declare/Tags.pm (original)
+++ Template-Declare/lib/Template/Declare/Tags.pm Tue Dec 19 03:08:34 2006
@@ -237,13 +237,6 @@
=cut
sub show {
- my $saved_self;
-
- if ( $_[0]->isa('Template::Declare') ) {
- $saved_self = $self;
- $self = shift;
- }
-
my $template = shift;
my $buf = '';
@@ -270,10 +263,6 @@
$buf = $BUFFER;
}
- # Restore the old $self if we were called in an OO style, but only
- # if there were already an $self before we enter the call.
- $self = $saved_self if $saved_self;
-
$BUFFER .= $buf;
return $buf;
}
More information about the Jifty-commit
mailing list