You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Gerald Richter <ri...@ecos.de> on 2002/04/17 08:51:43 UTC

Re: eval (was: Embperl 2.0b7 approx. 10 times slower than 1.3.x)

> >
> > 1. I'm unsure whether it's good to use eval around so much code... is
> > it the most efficient method?  You could wrap it just around the
> > ->prepare and ->execute. Actually, you don't eval at all. The critical
> > DBI method calls return true or false, which you can catch:
> >

There are two ways to use eval:

a.) eval "foo"

This compiles the string "foo" every time and executes it. This is for
"selfwriting programms". Since it is compiled every time, it is slower

b.) eval { foo }

This compiles foo only once, like any other Perl code. This is only for
catching expections (thrown via die). This executes at the same speed as
normal Perl code and it doesn't matter how large { foo } is

Gerald

-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------




---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org