On Sun, 1 Jun 2003, Andy Wardley wrote:

> > The problem: if TEXT contains an invalid tt2 directive the whole page is 
> > affected. I tried to surround the text with TRY/CATCH but it does not work 
> > for syntax errors. Have I missed something? 
> 
> Works for me.
> 
> [% TRY;
>      INCLUDE badfile;
>    CATCH;
>      "Caught error:  $error\n";
>    END
> %]

sorry, I was not clear enough. I have a tt2 fragment in a variable, and 

[% TRY;
 TEXT | eval; 
    CATCH;
      "Caught error:  $error\n";
    END
 %]

does not work. Is is possible to INSERT/INCLUDE/PROCESS a variable as a 
block (except that INSERT does not work with blocks)?   

> Apart from in the second paragraph of Template::Manual::Config... :-)

true. :(

I profit again: I am now trying to insert a callback in the _load code of 
Provider.pm, later I'll try to overload the method. Here is a simple 
diff,

191d190
< 
638,642d636
<               if (defined($self->{PARAMS}->{LOAD}) and 
<                       ref($self->{PARAMS}->{LOAD}) eq "CODE" and  
<                       $data = &{$self->{PARAMS}->{LOAD}}($self, $name)) 
{
<                               $error = Template::Constants::STATUS_ERROR;
<               } else {
659d652
<               }

Maybe one could provide a generic _load method for all plugins? 

-- 
Franco Bagnoli (franchino) <[EMAIL PROTECTED]> ([EMAIL PROTECTED])
virtual location: Dipartimento di Energetica "S. Stecco"
real location: Dip. Matematica Applicata "G. Sansone", Universita' Firenze,
Via S. Marta, 3 I-50139 Firenze, Italy. Tel. +39 0554796422, fax: +39 055471787
GPG Key fingerprint = 169D 9EA5 8FD3 7EDA E43A  9830 255F BCEC 0D63 3728






_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to