abhishekv has asked for the wisdom of the Perl Monks concerning the following question:

I am using perl version v5.20.3 . Using QNAP machine

Problem in cheking the existence of file. error : Value too large for defined data type

#!/opt/bin/perl use strict; use warnings; my $fileName = '/share/CACHEDEV1_DATA/Download/testFile.avi'; if (! -e $fileName){ print "Error ".$!."\n"; } else{ print "\nSuccess $!\n"; }

For text files its working fine. How to check the existance of '.avi' files?

  • Comment on error : Value too large for defined data type while checking file existence in perl
  • Download Code

Replies are listed 'Best First'.
Re: error : Value too large for defined data type while checking file existence in perl
by marto (Cardinal) on Feb 28, 2017 at 11:26 UTC

    On some platforms things are shipped without large file support, you should be able to see it listed in the output of perl -V, for example:

    Characteristics of this binary (from libperl): Compile-time options: HAS_TIMES HAVE_INTERP_INTERN MULTIPLICITY PERLIO_LAYERS PERL_DONT_CREATE_GVSV PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS PERL_MALLOC_WRAP PERL_NEW_COPY_ON_WRITE PERL_PRESERVE_IVUV USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF

    See also: http://search.cpan.org/~shay/perl-5.24.1/INSTALL#Large_file_support

Re: error : Value too large for defined data type while checking file existence in perl
by Discipulus (Canon) on Feb 28, 2017 at 11:23 UTC
    hello abhishekv

    This seems to me an OS error: has your OS the support for large data file (more than 2Gb)?

    see GNU coreutils-faq

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

      Worth checking, but all the QNAP kit I've seen are NAS systems, I'd be surprised if they couldn't deal with large files.

        Infact the Perl USE_LARGE_FILES seems a better suggestion..

        Googling the problem i found this post that say The issues described below were caused by a combination of bad RAM, a split-level that was one-folder too high in the tree and an unRAID disk that was around 90% full. so I guessed that even a nas system can spit out such errors. Here another example of Value too large.. error on qnap

        L*

        There are no rules, there are no thumbs..
        Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re: error : Value too large for defined data type while checking file existence in perl
by haukex (Archbishop) on Feb 28, 2017 at 11:32 UTC

    You've already got some good answers, I just wanted to point out that in print "\nSuccess $!\n"; it doesn't make sense to show the value of $!, since as a general rule, it is only set on failure, and not cleared on success.

    $ perl -wMstrict -le '$!=42; -e "/tmp" or die; print "<$!>"' <No message of desired type>
Re: error : Value too large for defined data type while checking file existence in perl
by Anonymous Monk on Feb 28, 2017 at 16:24 UTC
    If installing a new perl is not in the cards, what about
    a) try opening the file for reading
    b) put an eval around the -e

      Ignore b, maybe try something like this:

      use Errno; $! = 0; if (-e $file || $! == Errno::EOVERFLOW) { # exists } else { # doesn't }