bin/imager.save
changeset 74 a8495233e04c
parent 72 2a7ab8422dd6
child 77 e65d90b1682d
equal deleted inserted replaced
73:0315e75a049d 74:a8495233e04c
    12 use Sys::Hostname;
    12 use Sys::Hostname;
    13 use IO::Compress::Gzip qw(gzip $GzipError :level :strategy);
    13 use IO::Compress::Gzip qw(gzip $GzipError :level :strategy);
    14 use Hash::Util qw(lock_keys);
    14 use Hash::Util qw(lock_keys);
    15 use Getopt::Long;
    15 use Getopt::Long;
    16 use Pod::Usage;
    16 use Pod::Usage;
       
    17 use Imager 0.1;
    17 
    18 
    18 use constant KiB      => 1024;
    19 use constant KiB      => 1024;
    19 use constant MiB      => 1024 * KiB;
    20 use constant MiB      => 1024 * KiB;
    20 use constant GiB      => 1024 * MiB;
    21 use constant GiB      => 1024 * MiB;
    21 use constant NOW      => time();
    22 use constant NOW      => time();
   152 
   153 
   153         # the extension we do not put into the index
   154         # the extension we do not put into the index
   154         push @{ $index{BLOCKS} }, sprintf "%12d %s %s" => ($. - 1),
   155         push @{ $index{BLOCKS} }, sprintf "%12d %s %s" => ($. - 1),
   155           $cs,                    $file;
   156           $cs,                    $file;
   156 
   157 
   157         if (
   158         if (not Imager::get_file("$data/$file")) {
   158             not(   -e "$data/$file"
       
   159                 or -e "$data/$file.gz"
       
   160                 or -e "$data/$file.x"
       
   161                 or -e "$data/$file.gz.x"
       
   162                 or -e "$data/$file.x.gz")
       
   163           )
       
   164         {
       
   165             mkpath dirname("$data/$file");
   159             mkpath dirname("$data/$file");
   166             my $out = File::Temp->new(
   160             my $out = File::Temp->new(
   167                 TEMPLATE => "tmp-XXXXXXX",
   161                 TEMPLATE => "tmp-XXXXXXX",
   168                 DIR      => dirname("$data/$file")
   162                 DIR      => dirname("$data/$file")
   169             );
   163             );