Re: Mail::Box significant reducation in memory usage

Mark Overmeer <[email protected]> Tue, 21 Sep 2004 23:11:58 +0200
Newsgroups gmane.comp.lang.perl.modules.mail-box
Organization MARKOV Solutions
Message-ID <[email protected]>
* Andy Maas ([email protected]) [040921 20:28]:
> 1. For getlines compatibility (non FastScalar getlines doesn't work in 
> scalar context). Replace this line
> 
>     {   # File without separators.
>         $lines = $file->getlines;
> 
>    with
> 
>         {   # File without separators.
>             eval {
>                 $lines = $file->getlines;
>             };
>             if ($@) {
>                 if ($@ =~ /scalar context/) {
>                     $lines = [$file->getlines];
>                 }
>                 else {
>                     die $@;
>                 }
>             }
>         }

Why?  $lines = [ $file->getlines ]  is slower than $lines = $file->getlines?
-- 
               MarkOv

------------------------------------------------------------------------
drs Mark A.C.J. Overmeer                                MARKOV Solutions
       [email protected]                          [email protected]
http://Mark.Overmeer.net                   http://solutions.overmeer.net