Hi Luca, I am hoping someone else can speak to this more than I can, but I messed around with your code and did a bit of reading on File::Util, and was able to get the code to execute properly as follows:
#!/usr/bin/env perl use Modern::Perl 2011; use autodie; use File::Util; my $max_file_size = int( 1024 * 1024 * 1024 ); my $handle_file = File::Util->new( readlimit => $max_file_size ); my $files_for = {}; say $handle_file->readlimit(); # Did it work? __END__ You might try passing the readlimit to new instead of setting it after the fact, and see if that helps you out any. Regards, Peter ________________________________________ From: fluca1...@gmail.com [fluca1...@gmail.com] On Behalf Of Luca Ferrari [fluca1...@infinito.it] Sent: Wednesday, May 08, 2013 9:49 AM To: beginners@perl.org Subject: problem with File::Util::readlimit Hello, 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 Bad call to File::Util::readlimit(). This method can only be called with a numeric value (bytes). Non-integer numbers will be converted to integer format if specified (numbers like 5.2), but don't do that, it's inefficient. This operation aborted. Origin: This is a human error. Solution: A human must fix the programming flaw. ARG _pak = File::Util ARG bad = 1073741824 1. File::Util::_throw -called at line (1518) of /usr/local/share/perl/5.14.2/File/Util.pm -was called with args -was not called to evaluate anything 2. File::Util::readlimit -called at line (16) of test.pl -was called with args -was not called to evaluate anything The documentation for File::Util::readlimit states that: readlimit => positive integer Optionally specify this option to the File::Util::new method to instruct the new object that it should never attempt to open and read in a file greater than the number of bytes you specify. Obviously this argument can only be a numeric integer value, otherwise it will be silently ignored. The default readlimit for File::Util objects is 52428800 bytes (50 megabytes). Any idea about what I'm missing? Thanks, Luca -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/ Confidentiality Notice: This e-mail may contain proprietary information some of which may be legally privileged. It is for the intended recipient(s) only. If you believe that it has been sent to you in error, please notify the sender by reply e-mail and delete the message. Any disclosure, copying, distribution or use of this information by someone other than the intended recipient(s) is prohibited and may be unlawful. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/