From: Uri Guttman Date: Sun, 14 Dec 2008 07:43:32 +0000 (-0500) Subject: loops and hashes are working X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=89bd07c7c8709988903e8d3eb4380edc42f91c09;p=urisagit%2FTemplate-Simple.git loops and hashes are working added get_source method (needs pod) need to add tests, pod --- diff --git a/lib/Template/Simple.pm b/lib/Template/Simple.pm index d4804ba..277195b 100644 --- a/lib/Template/Simple.pm +++ b/lib/Template/Simple.pm @@ -108,7 +108,7 @@ sub compile { my $code_body = $self->_compile_chunk( '', "${$tmpl_ref}", "\t" ) ; - $self->{source} = <{source_cache}{$template_name} = $self->{source} ; - print $self->{source} ; +#print $source ; - my $code_ref = eval $self->{source} ; + my $code_ref = eval $source ; die $@ if $@ ; $self->{compiled_cache}{$template_name} = $code_ref ; + $self->{source_cache}{$template_name} = $source ; +} + +sub get_source { + + my( $self, $template_name ) = @_ ; + + return $self->{source_cache}{$template_name} ; }