[Templates-cvs] cvs commit: TT3/lib/Template Component.pm
cvs@template-toolkit.org
cvs@template-toolkit.org
Mon, 13 Dec 2004 13:32:55 +0000
cvs 04/12/13 13:32:55
Modified: lib/Template Component.pm
Log:
* added id back in to make caching and storing work, but
it's a temporary hack
Revision Changes Path
1.10 +10 -5 TT3/lib/Template/Component.pm
Index: Component.pm
===================================================================
RCS file: /template-toolkit/TT3/lib/Template/Component.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Component.pm 2004/12/10 18:51:39 1.9
+++ Component.pm 2004/12/13 13:32:55 1.10
@@ -15,7 +15,7 @@
# modify it under the same terms as Perl itself.
#
# REVISION
-# $Id: Component.pm,v 1.9 2004/12/10 18:51:39 abw Exp $
+# $Id: Component.pm,v 1.10 2004/12/13 13:32:55 abw Exp $
#
#========================================================================
@@ -27,7 +27,7 @@
use Template::Base;
use base qw( Template::Base );
-our $VERSION = sprintf("%d.%02d", q$Revision: 1.9 $ =~ /(\d+)\.(\d+)/);
+our $VERSION = sprintf("%d.%02d", q$Revision: 1.10 $ =~ /(\d+)\.(\d+)/);
our $DEBUG = 0 unless defined $DEBUG;
our $ERROR = '';
our $THROW = 'component';
@@ -58,6 +58,8 @@
sub init {
my ($self, $config) = @_;
+ $self->{ id } = $config->{ id };
+
# path is a mandatory parameter
return $self->error("mandatory path parameter not defined")
unless defined ($self->{ path } = $config->{ path });
@@ -181,7 +183,8 @@
return $self->decline("cache option not set for $self->{ name } component")
unless $self->{ cache };
- defined $cache->set($self->{ id }, $self)
+ # TODO: is 'id' always set?
+ defined $cache->set($self->{ id } || $self->{ path }, $self)
|| return $self->error( "failed to cache $self->{ name } component: ",
$cache->error() );
@@ -216,7 +219,9 @@
return $self->decline("source code not available for component: $self->{ name }")
unless ($code = $source->code());
- defined $store->set($self->{ id }, $code)
+ # TODO: changed this from 'id' to 'name' but should be id?
+
+ defined $store->set($self->{ id } || $self->{ path }, $code)
|| return $self->error( "failed to store $self->{ name } component: ",
$store->error() );
@@ -340,7 +345,7 @@
=head1 VERSION
-$Revision: 1.9 $
+$Revision: 1.10 $
=head1 COPYRIGHT