On Mon, Jul 19, 2004 at 12:43:58PM -0700, Edward Peschko wrote:
> On Fri, Jul 16, 2004 at 02:26:14PM +0100, Tim Bunce wrote:
> > On Fri, Jul 16, 2004 at 03:41:15PM +0400, [EMAIL PROTECTED] wrote:
> > > 
> > > Hi,
> > > 
> > > just my 2 cents. How about something like this:
> > > 
> > >   while(($line = eval { $sth->fetchrow_arrayref() }) || $@)
> > >   {
> > >     next unless $line;
> > >     ...
> > >   }
> > 
> > Checking $sth->{Active} adds extra safety. Something like this:
> > 
> >   while(($row = eval { $sth->fetchrow_arrayref }) || ($@ && $sth->{Active})) {
> >     next unless $row;
> >     ..
> >   }
> > 
> > Tim.
> 
> but that was my original point.. that I *didn't* want to add an eval loop around each
> statement..

My original reply gave a non-eval based approach.

> it increases the performance penalty especially on very tight loops. 
> If its unavoidable, I'll use it.. otherwise it would be nice to have a workaround.

Have you benchmarked the difference? I think you'll be surprised. eval BLOCK is
very cheap (especially compared with eval STRING).

Tim.

Reply via email to