Exceptions or long jump mechanism

In python, you can use this style.

try:
   statements
except name:
   statements
else:
   statements
On oontrary, perl has this style. But perl has eval $@ form. Please use this.
# try
eval {
   statement;
   croak(""); # raise
}
# except
unless ($@) {
   statements for exception;
}
# else 
else {
   statements;
}

There is a perl module which provides catch and throw style. But we do not use this.

throw info from croak().

How to throw up info from croak() ?

One style is

croak("__ERROR_$keyword__");
croak("__ERROR_$keyword__: $reason");
For example,
croak("__ERROR_cgi.insecure__: $reason");
$keyword is the key of this message. But how about parameters for the key ? hmm, ...

my homepage is www.fml.org/home/fukachan/.
my free softwares are found at www.fml.org/software/.
fml 4.0 project homepage is www.fml.org/fml/menu.ja.html.
fml 8.0 (fml-devel) project homepage is www.fml.org/software/fml8/.
about one floppy bsd routers, see www.bsdrouter.org/.
Also, visit nuinui's world :) at www.nuinui.net.
For questions about me, e-mail <fukachan@fml.org>.
Copyright (C) 1993-2008 Ken'ichi Fukamachi

Powered by NetBSD.