Lyle Brooks <[EMAIL PROTECTED]> said something to this effect on 01/24/2002:
> There is a object method Template::Provider::include_path that
> will do this.

But the problem there is that a Template::Context instance has
potentially more than one Template::Provider instance, in the
LOAD_TEMPLATES data member:

     66 # ...If nothing is defined, then we
     67 # iterate through the LOAD_TEMPLATES providers list as a 'chain of 
     68 # responsibility' (see Design Patterns) asking each object to fetch() 
     69 # the template if it can.

And then it is used as such:

    121     $providers = $self->{ PREFIX_MAP }->{ default }
    122               || $self->{ LOAD_TEMPLATES }
    123         unless $providers;
    124    
    125     # finally we try the regular template providers which will 
    126     # handle references to files, text, etc., as well as templates
    127     # reference by name
    128     foreach my $provider (@$providers) {
    129         ($template, $error) = $provider->fetch($name);

Thus, a method that sets the INCLUDE_PATH would need to set it in
each of the elements of LOAD_TEMPLATES.  You could, of course, do
something like:

package Template::Content;
sub include_path {
    my $self = shift;
    my $paths = isa($_[0], 'ARRAY') ? shift : [ @_ ];

    for my $provider (@{$self->{ LOAD_TEMPLATES }}) {
        $provider->include_path($paths);
    }

    return $paths;
}

But is that The Right Thing To Do?

(darren)

-- 
An operating system is just a name you give the features you left
out of your editor.
    -- Per Abrahamsen in comp.emacs


Reply via email to