Michael,

If the problems are with errors within the subs themselves, I would
definitely have a look at the Carp module. It gives you more information
about exactly where an error/exception occurred and what caused it. Of
course, you'll need to incorporate the Carp functions
(carp/cluck/croak/confess) into the actual sub()s themselves in order to
take full advantage.

Again a lot of this is guessing - so much depends on what is in the subs,
how you're calling them, etc. etc. Hopefully this points you in a useful
direction at least.

Barry

> -----Original Message-----
> From: Michael Huebner [mailto:[EMAIL PROTECTED] 
> Sent: Monday, September 29, 2003 2:58 PM
> To: [EMAIL PROTECTED]; Hemphill, Barry
> Subject: RE: eval(xx) line yz - errors hard to debug
> 
> 
> 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


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
the latest virus scan software available for the presence of computer
viruses.
**********************************************************************

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to