Is there a particular reason why Template::process doesn't check for
whether its first is defined?

  sub process {
      my ($self, $template, $vars, $outstream) = @_;
      my ($output, $error);

      $output = $self->{ SERVICE }->process($template, $vars);
      ...

Template::Service::process blindly accepts $template:

  sub process {
      my ($self, $template, $params) = @_;
      my $context = $self->{ CONTEXT };

      ...

      eval { $template = $context->template($template) };

And Template::Context::template does no defined checks:

sub template {
    my ($self, $name) = @_;

    $self->debug("template($name)") if $self->{ DEBUG };

    return $name
        if UNIVERSAL::isa($name, 'Template::Document')
            || ref($name) eq 'CODE';

    $shortname = $name;

    unless (ref $name) {
        ...

Does it make sense to modify Template::process like so:

  sub process {
      my ($self, $template, $vars, $outstream) = @_;
      my ($output, $error);

      # This is the added line:
      $template = \*STDIN unless defined $template;
      $output = $self->{ SERVICE }->process($template, $vars);

tpage does this internally, and I think it's a pretty reasonable
default.  Comments?

(darren)

-- 
I invented the term "Object-Oriented", and I can tell you,
I didn't have C++ in mind.
    -- Alan Kay

_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.ourshack.com/mailman/listinfo/templates

Reply via email to