Perl Question
Rob Nagler
nagler at bivio.com
Wed Jul 12 12:14:32 CDT 2000
> Well, that is difficult to give you. We generate the code on the fly using
> a Database field.
You'll probably want to have a trace or debug output, so you can actually
see what the problem is.
> Here is the problem that we are trying to solve:
> We don't know what tee code will be in the sub prior to run time.
> We want to dynamically create the code at runtime according to code
> listed in the database.
If you plan on calling the code repeatedly:
eval {
my($sub) = eval("sub { $my_code_from_db }") || die $@;
my($result) = &$sub(my,arguments);
} || die("error in code store: $@\n$my_code_from_db");
If you only need to call it once:
my($res) = eval($my_code_from_db)
|| die("error in code store: $@\n$my_code_from_db");
We do this kind of thing all the time. As long as you know what you are
putting in the DB. If you are executing arbitrary code, you may want
to consider:
http://www.perl.com/pub/doc/manual/html/lib/Safe.html
More information about the Pikes-peak-pm
mailing list