On 2018/11/14 19:59, sisyphus wrote:
> On Wed, Nov 14, 2018 at 9:08 PM Tetsuo Handa 
> <penguin-ker...@i-love.sakura.ne.jp> wrote
> 
>>  how can I pass $sb->size to Math::BigInt->new() as a string (assuming that 
>> $sb->size is an integer) ?
> 
> To answer the question, you can do:
> 
> my $x = $sb->size;
> $value = Math::BigInt->new("$x");

Wow! I didn't notice that quoting a variable makes a string...

> 
> But doing so is likely to be completely pointless.
> I'm thinking that the real problem is "How, on a 32-bit integer build of
> perl, does one get lstat() to return a correct value for 'size' when the
> size of the file is greater than 4294967295 bytes ?"

Even on 32bit environments (at least for Linux), lstat() calls 64bit version,
and thus capable of storing $sb->size > 4GB. Thus, I think it is no problem.

  strace perl -e 'use File::stat; my $sb = 
lstat("CentOS-5.11-x86_64-bin-DVD-1of2.iso"); print $sb->size;'
  lstat64("CentOS-5.11-x86_64-bin-DVD-1of2.iso", {st_mode=S_IFREG|0644, 
st_size=4674615296, ...}) = 0
  write(1, "4674615296", 10)              = 10

Thank you.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to