1 # Copyright 2002-2007 Interchange Development Group and others
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version. See the LICENSE file for details.
8 # $Id: catch.coretag,v 1.7 2007-03-30 23:40:49 pajamian Exp $
10 UserTag catch Order label
12 UserTag catch hasEndTag
13 UserTag catch Version $Revision: 1.7 $
14 UserTag catch Routine <<EOR
16 my ($label, $opt, $body) = @_;
17 $label = 'default' unless $label;
20 return pull_else($body)
21 unless $error = $Vend::Session->{try}{$label};
23 $body = pull_if($body);
25 if ( $opt->{exact} ) {
26 #----------------------------------------------------------------
27 # Convert multiple errors to 'or' list and compile it.
28 # Note also the " at (eval ...)" kludge to strip the line numbers
30 $patt =~ s/(?: +at +\(eval .+\).+)?\n\s*/|/g;
34 #----------------------------------------------------------------
55 next unless $error =~ $re;
61 $body = join $opt->{joiner} || "\n", @found;
64 $body =~ s/\$ERROR\$/$error/g;
70 if($opt->{error_set}) {
71 set_error($body, $opt->{error_set});
73 if($opt->{error_scratch}) {
74 $::Scratch->{$opt->{error_scratch}} = 1;
77 return '' if $opt->{hide};