Hi Barry,
> I'm not 100% sure I understand what you're doing - are you saying that you
> are pulling strings from a MySQL database which are perl sub()s? If that's
> the case
Yes
> some sample of the code you're using would *really* help.
here it is:
sub getFunctions{
my $dbh = shift; #the db connection
$sth = $dbh->prepare("SELECT * FROM functions") or die $dbh->errstr;
$sth->execute or die $sth->errstr;
while($ref = $sth->fetchrow_hashref()){
$FUNCTIONS{$ref->{'id'}} = eval($ref->{'perl_function'});
print $ref->{'id'}."\n" if $ini{"trace"};
}
$sth->finish();
}
the table in the DB looks like this:
ids|perl_function
------------------------
id1|sub{...some code...}
id2|sub{...some other code...}
a call to one of this functions is for example
$FUNCTIONS{'id1'}->($parameter1);
thats all.
> <do DB query to get sub() to be eval'd in $mysub>
>
> eval { $mysub };
> if ($@)
> {
> print "ERROR in sub: $mysub $@ ";
> }
>
The problem that I've is not if the eval() finds an error in the code.
The problems are runtime errors ;(
> If you want to dig more into runtime errors happening within the subs
> themselves, the Carp module may(?) be of use as well.
I'll try this ;)
Do you have some other suggestions?
Thank you
Michael
______________________________________________________________________________
Die Besten ihrer Klasse! WEB.DE FreeMail (1,7) und WEB.DE Club (1,9) -
bei der Stiftung Warentest - ein Doppelsieg! http://f.web.de/?mc=021184
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs