Subject: | [bamccaig@gmail.com: Re: problem with File::Util::readlimit] |
Date: | Wed, 8 May 2013 14:37:39 -0400 |
To: | bug-File-Util [...] rt.cpan.org |
From: | Brandon McCaig <bamccaig [...] gmail.com> |
Looks like we've discovered a bug in File::Util over on the
beginners@perl.org list. I'm running perl 5.16.3. File::Util
appears to be 3.39. See forwarded message below. The problem can
be demonstrated with this one-liner:
perl -MFile::Util -E 'File::Util->new()->readlimit(1024 ** 2);'
Regards,
--
Brandon McCaig <bamccaig@gmail.com> <bamccaig@castopulence.org>
Castopulence Software <https://www.castopulence.org/>
Blog <http://www.bamccaig.com/>
perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }.
q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.};
tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say'
----- Forwarded message from Brandon McCaig <bamccaig@gmail.com> -----
Date: Wed, 8 May 2013 14:24:59 -0400
From: Brandon McCaig <bamccaig@gmail.com>
To: Luca Ferrari <fluca1978@infinito.it>
Cc: beginners@perl.org
Subject: Re: problem with File::Util::readlimit
User-Agent: Mutt/1.5.20 (2009-06-14)
Mail-Followup-To: Luca Ferrari <fluca1978@infinito.it>, beginners@perl.org
On Wed, May 08, 2013 at 06:49:48PM +0200, Luca Ferrari wrote:
Show quoted text
> Hello,
Hello,
Show quoted text> I'm encountering a problem with File::Util that I'm not able to
> see, and I'm sure it's trivial:
>
> my $handle_file = new File::Util;
> my $files_for = {};
> my $max_file_size = int( 1024 * 1024 * 1024 );
> $handle_file->readlimit( $max_file_size );
>
> that once run produces the following trace:
>
> PROCESS TERMINATED DUE TO ERRORS
*snip*
Show quoted text> Any idea about what I'm missing?
Looks like a module bug to me.
A freshly installed File/Util.pm said:
Show quoted text> sub readlimit {
> my $arg = _myargs( @_ );
>
> if ( defined $arg ) {
>
> return File::Util->new()->_throw
> (
> 'bad readlimit' => { bad => $arg }
> ) if $arg !~ /\D/o;
>
> $READLIMIT = $arg;
> }
>
> return $READLIMIT;
> }
Looks like it raises an exception if the argument doesn't match a
NON-"digit" character. Which seems like the opposite of what is
wanted.
Regards,
--
Brandon McCaig <bamccaig@gmail.com> <bamccaig@castopulence.org>
Castopulence Software <https://www.castopulence.org/>
Blog <http://www.bamccaig.com/>
perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }.
q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.};
tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say'
Show quoted text----- End forwarded message -----
Message body not shown because it is not plain text.