At the download of a file: does it make sense to check the filesize?

Posted by sid_com on Stack Overflow See other posts from Stack Overflow or by sid_com
Published on 2010-04-28T12:45:37Z Indexed on 2010/04/28 14:53 UTC
Read the original article Hit count: 211

Filed under:
|
|

Does the test of the file-size make sense here? I tried to cut the connection while downloading, but it looks like the size-test is never reached.

#!/usr/bin/env perl
use warnings; 
use strict;
use 5.012;
use LWP::Simple;

my $file_size = '2342'; 
my $response = getstore( 'url', 'filename' );
if ( is_success $response ) {
    if ( $file_size == -s 'filename' ) {
        say "OK";
    }
}

© Stack Overflow or respective owner

Related posts about perl

Related posts about download