[Templates-cvs] cvs commit: TT3/lib/Template Context.pm
cvs@template-toolkit.org
cvs@template-toolkit.org
Wed, 15 Dec 2004 17:19:56 +0000
cvs 04/12/15 17:19:56
Modified: lib/Template Context.pm
Log:
* removed old docs
Revision Changes Path
1.11 +22 -63 TT3/lib/Template/Context.pm
Index: Context.pm
===================================================================
RCS file: /template-toolkit/TT3/lib/Template/Context.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Context.pm 2004/12/12 16:22:35 1.10
+++ Context.pm 2004/12/15 17:19:56 1.11
@@ -16,7 +16,7 @@
# modify it under the same terms as Perl itself.
#
# REVISION
-# $Id: Context.pm,v 1.10 2004/12/12 16:22:35 abw Exp $
+# $Id: Context.pm,v 1.11 2004/12/15 17:19:56 abw Exp $
#
#========================================================================
@@ -38,7 +38,7 @@
use constant FETCH => 'fetch';
use constant GET => 'get';
-our $VERSION = sprintf("%d.%02d", q$Revision: 1.10 $ =~ /(\d+)\.(\d+)/);
+our $VERSION = sprintf("%d.%02d", q$Revision: 1.11 $ =~ /(\d+)\.(\d+)/);
our $DEBUG = 0 unless defined $DEBUG;
our $ERROR = '';
our $THROW = 'context';
@@ -137,10 +137,27 @@
sub id { $_[0]->{ id } }
sub name { $_[0]->{ name } }
-sub path { $_[0]->{ path } }
sub time { $_[0]->{ time } }
+sub path { $_[0]->{ path } }
+
+
+sub new_template {
+ my ($self, $name, @args) = @_;
+ my $debug = $self->{ DEBUG };
+
+ $self->debug("template($name, ", join(', ', @args), ")\n") if $debug;
+
+ # get the template resource manager
+ my $resource = $self->{ resource }->{ template }
+ || $self->resource('template') || return;
+
+ # call the resource's fetch() method
+ return $resource->fetch($self, $name, @args)
+ || $self->decline($resource->error());
+}
+
sub catch {
my ($self, $error, $output) = @_;
@@ -195,7 +212,7 @@
=head1 NAME
-Template::Component - TODO
+Template::Context - TODO
=head1 SYNOPSIS
@@ -207,64 +224,6 @@
=head1 METHODS
-=head2 run(\%options)
-
-Method to run the current template component.
-
- # list of named options
- $component->run(
- args => { pi => 3.14, e => 2.718 },
- caller => $caller,
- import => 1
- );
-
- # hashref of named options
- $component->run({
- args => { pi => 3.14, e => 2.718 },
- caller => $caller,
- import => 1,
- });
-
-
-=head2 execute(\%args, \%options)
-
-Method to process the current template component. This is a wrapper
-around the run() method which accepts arguments and options in the
-style of the process() method, described below, for the sake of
-consistency between these methods.
-
- $component->execute( a => 10, b => 20 )
- $component->execute({ a => 10, b => 20 })
- $component->execute({ a => 10, b => 20 }, { import => 1 })
-
-=head2 process($template, \%args, \%options)
-
-Method to process another template component. The first argument is
-the name of a template or a reference to a template component, or
-something that can be turned into a template component (e.g. template
-text, subroutine reference, etc). The name can be followed by a list
-of named arguments or a hash reference to the same. These define the
-values of the local variables for the template. Any additional
-processing options can be provided by reference to a hash array,
-passed as the third argument. Again, the method will accept a list of
-named options instead of a hash reference.
-
- # all arguments are variable definitions
- $comp->process('header', a => 10, b => 20)
-
- # same, but passed by hash reference
- $comp->process('header', { a => 10, b => 20 })
-
- # additional options follow as a list
- $comp->process('header', { a => 10, b => 20 }, import => 1)
-
- # additional options follow as a hash reference
- $comp->process('header', { a => 10, b => 20 }, import => 1)
-
-The method is flexible in accept a list of arguments or options
-instead of a reference to a hash array. However, if you want to
-pass additional processing options to the method then the
-
TODO
=head1 AUTHOR
@@ -273,7 +232,7 @@
=head1 VERSION
-$Revision: 1.10 $
+$Revision: 1.11 $
=head1 COPYRIGHT