On Sat, 10 Jul 2004, Nishikant Kapoor wrote:

> I would like to catch this error and do a graceful exit by displaying
> "'my.tmpl' not found!" message back to user.

Easily done.  Just use eval{} to catch the die() and check $@ to
examine any error:

    my $template;
    eval {
      $template = HTML::Template->new(filename => 'my.tmpl');
    };

    if ($@ and $@ =~ /file not found/) {
        print "my.tmpl not found!";
        exit; # or return as appropriate
    } elsif ($@) {
        die $@;
    }

-sam


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to