On Sun, Feb 12, 2006 at 04:15:03PM -0500, Dan Lenski wrote:
> I've recently learned to use the error-catching feature of
> Embperl::Object's Execute command.  The thing I'm wondering is if it's
> possible to make it return just the string or object that I pass to
> the croak/die command, rather than the complete Embperl error message.
> 
> I would like to be able to do:
> 
> # base.html
> Execute({inputfile=>"*", errors=>[EMAIL PROTECTED]);
> foreach (@errors) {
>   if ($_ eq "FIXME") {
>     # respond to this error
>   }
> }
> 
> # foo.html
> [- die "FIXME"; -]
> 
> But right now, the error array gets filled with long hard-to-parse
> strings such as:
> 
> [7594]ERR:  24:  Error in Perl code: FIXME!! at /foo/bar/baz/foo.html line 1
> 
Why is that hard to parse?  Use perl regular expressions, that's one of
the things it is good at.

You'd just have to go

foreach (@errors) {
   if (/FIXME/) {
     # respond to this error
   }
}

That should enable you to respond to all the "FIXME" errors.

Kathryn Andersen
-- 
 _--_|\     | Kathryn Andersen  <http://www.katspace.com>
/      \    | 
\_.--.*/    | GenFicCrit mailing list <http://www.katspace.com/gen_fic_crit/>
      v     | 
------------| Melbourne -> Victoria -> Australia -> Southern Hemisphere
Maranatha!  |   -> Earth -> Sol -> Milky Way Galaxy -> Universe

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to