App-Glacier

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

lib/App/Glacier/Command/DeleteVault.pm
lib/App/Glacier/Command/Get.pm
lib/App/Glacier/Command/Jobs.pm
lib/App/Glacier/Command/ListVault.pm
lib/App/Glacier/Command/Periodic.pm
lib/App/Glacier/Command/Purge.pm
lib/App/Glacier/Command/Put.pm
lib/App/Glacier/Command/Sync.pm
lib/App/Glacier/Config.pm
lib/App/Glacier/Core.pm
lib/App/Glacier/DateTime.pm
lib/App/Glacier/DB.pm
lib/App/Glacier/DB/GDBM.pm
lib/App/Glacier/Directory.pm
lib/App/Glacier/Directory/GDBM.pm
lib/App/Glacier/EclatCreds.pm
lib/App/Glacier/Glob.pm
lib/App/Glacier/HttpCatch.pm
lib/App/Glacier/Job.pm
lib/App/Glacier/Job/ArchiveRetrieval.pm
lib/App/Glacier/Job/FileRetrieval.pm

META.json  view on Meta::CPAN

      },
      "configure" : {
         "requires" : {
            "ExtUtils::MakeMaker" : "0"
         }
      },
      "runtime" : {
         "requires" : {
            "Carp" : "1.26",
            "Data::Dumper" : "2.13506",
            "DateTime" : "1.42",
            "DateTime::Format::ISO8601" : "0.08",
            "Digest::SHA" : "5.85",
            "Exporter" : "5.66",
            "File::Basename" : "2.84",
            "File::Path" : "2.0801",
            "File::stat" : "1.05",
            "GDBM_File" : "1.14",
            "Getopt::Long" : "2.38",
            "JSON" : "2.9",
            "Net::Amazon::Glacier" : "0.15",
            "POSIX" : "1.3",

META.json  view on Meta::CPAN

      },
      "App::Glacier::Core" : {
         "file" : "lib/App/Glacier/Core.pm"
      },
      "App::Glacier::DB" : {
         "file" : "lib/App/Glacier/DB.pm"
      },
      "App::Glacier::DB::GDBM" : {
         "file" : "lib/App/Glacier/DB/GDBM.pm"
      },
      "App::Glacier::DateTime" : {
         "file" : "lib/App/Glacier/DateTime.pm"
      },
      "App::Glacier::Directory" : {
         "file" : "lib/App/Glacier/Directory.pm"
      },
      "App::Glacier::Directory::GDBM" : {
         "file" : "lib/App/Glacier/Directory/GDBM.pm"
      },
      "App::Glacier::EclatCreds" : {
         "file" : "lib/App/Glacier/EclatCreds.pm"
      },

META.yml  view on Meta::CPAN

    file: lib/App/Glacier/Command/Sync.pm
  App::Glacier::Config:
    file: lib/App/Glacier/Config.pm
    version: '1.00'
  App::Glacier::Core:
    file: lib/App/Glacier/Core.pm
  App::Glacier::DB:
    file: lib/App/Glacier/DB.pm
  App::Glacier::DB::GDBM:
    file: lib/App/Glacier/DB/GDBM.pm
  App::Glacier::DateTime:
    file: lib/App/Glacier/DateTime.pm
  App::Glacier::Directory:
    file: lib/App/Glacier/Directory.pm
  App::Glacier::Directory::GDBM:
    file: lib/App/Glacier/Directory/GDBM.pm
  App::Glacier::EclatCreds:
    file: lib/App/Glacier/EclatCreds.pm
  App::Glacier::Glob:
    file: lib/App/Glacier/Glob.pm
  App::Glacier::HttpCatch:
    file: lib/App/Glacier/HttpCatch.pm

META.yml  view on Meta::CPAN

    file: lib/App/Glacier/Roster.pm
  App::Glacier::Roster::GDBM:
    file: lib/App/Glacier/Roster/GDBM.pm
  App::Glacier::Signature:
    file: lib/App/Glacier/Signature.pm
  App::Glacier::Timestamp:
    file: lib/App/Glacier/Timestamp.pm
requires:
  Carp: '1.26'
  Data::Dumper: '2.13506'
  DateTime: '1.42'
  DateTime::Format::ISO8601: '0.08'
  Digest::SHA: '5.85'
  Exporter: '5.66'
  File::Basename: '2.84'
  File::Path: '2.0801'
  File::stat: '1.05'
  GDBM_File: '1.14'
  Getopt::Long: '2.38'
  JSON: '2.9'
  Net::Amazon::Glacier: '0.15'
  POSIX: '1.3'

Makefile.PL  view on Meta::CPAN

use Pod::Usage;

WriteMakefile(NAME => 'App::Glacier',
	      ABSTRACT_FROM => 'lib/App/Glacier.pm',
	      VERSION_FROM => 'lib/App/Glacier.pm',
	      AUTHOR    =>      'Sergey Poznyakoff <gray@gnu.org>',
	      LICENSE   =>      'gpl_3',
	      EXE_FILES =>      [ 'glacier' ],
	      PREREQ_PM =>      { 'Carp' => 1.26,
				  'Data::Dumper' => 2.135_06,
				  'DateTime' => 1.42,
				  'DateTime::Format::ISO8601' => 0.08,
				  'Digest::SHA' => 5.85,
				  'Exporter' => 5.66,
				  'File::Basename' => 2.84,
				  'File::Path' => 2.08_01,
				  'File::stat' => 1.05,
				  'GDBM_File' => 1.14,
				  'Getopt::Long' => 2.38,
				  'JSON' => 2.90,
				  'Net::Amazon::Glacier' => 0.15,
				  'POSIX' => 1.30,

lib/App/Glacier/Command.pm  view on Meta::CPAN

	$in = <STDIN>;
	$in =~ s/^\s+//;
    } while ($in !~ /^[yYnN]/);
        return $in =~ /^[yY]/;
}

sub set_time_style_option {
    my ($self, $style) = @_;
    
    eval {
	use App::Glacier::DateTime;
	my $x = new App::Glacier::DateTime(year=>1970);
	$x->canned_format($style);
    };
    if ($@) {
	$self->abend(EX_USAGE, "unrecognized time style: $style");
    }
    $self->{_options}{time_style} = $style;
}

sub format_date_time {
    my ($self, $obj, $field) = @_;

lib/App/Glacier/Command/Get.pm  view on Meta::CPAN

package App::Glacier::Command::Get;
use strict;
use warnings;
use threads;
use threads::shared;
use App::Glacier::Core;
use App::Glacier::Job::FileRetrieval;
use App::Glacier::DateTime;
use App::Glacier::Progress;
use parent qw(App::Glacier::Command);
use Carp;
use Scalar::Util;
use File::Copy;

=head1 NAME

glacier get - download file from a vault

lib/App/Glacier/Command/ListVault.pm  view on Meta::CPAN

package App::Glacier::Command::ListVault;

use strict;
use warnings;
use App::Glacier::Core;
use parent qw(App::Glacier::Command);
use App::Glacier::DateTime;
use App::Glacier::Timestamp;
use App::Glacier::Glob;
use App::Glacier::Directory qw(:status);

=head1 NAME

glacier ls - list vaults or archives

=head1 SYNOPSIS

lib/App/Glacier/Command/Put.pm  view on Meta::CPAN

package App::Glacier::Command::Put;
use strict;
use warnings;
use App::Glacier::Core;
use App::Glacier::DateTime;
use App::Glacier::Job::InventoryRetrieval;
use App::Glacier::Progress;
use parent qw(App::Glacier::Command);
use File::Basename;
use File::stat;
use Fcntl ':mode';
use Scalar::Util;
use Carp;

=head1 NAME

lib/App/Glacier/Command/Put.pm  view on Meta::CPAN

    }
    
    my $dir = $self->directory($vaultname);
    my $id = ($size < $self->cf_transfer_param(qw(upload single-part-size)))
	       ? $self->_upload_simple($vaultname, $localname, $remotename)
               : $self->_upload_multipart($vaultname, $localname, $remotename);
    return if $self->dry_run;
    $self->debug(1, "ID $id\n");
    $dir->add_version($remotename, { ArchiveId => $id,
				     Size => $size,
				     CreationDate => new App::Glacier::DateTime,
				     ArchiveDescription => $remotename });
}

sub _upload_simple {
    my ($self, $vaultname, $localname, $remotename) = @_;

    $self->debug(1, "uploading $localname in single part");
    return if $self->dry_run;

    my $p = new App::Glacier::Progress(1,

lib/App/Glacier/Command/Sync.pm  view on Meta::CPAN

package App::Glacier::Command::Sync;

use strict;
use warnings;
use App::Glacier::Core;
use parent qw(App::Glacier::Command);
use App::Glacier::DateTime;
use App::Glacier::Timestamp;
use App::Glacier::Job::InventoryRetrieval;
use JSON;

=head1 NAME

glacier sync - synchronize vault inventory cache

=head1 SYNOPSIS

lib/App/Glacier/DateTime.pm  view on Meta::CPAN

package App::Glacier::DateTime;
use strict;
use warnings;
use parent 'DateTime';

use Carp;
use DateTime;

sub new {
    my ($class, @opts) = shift;
    unless (@opts) {
	my ($second, $minute, $hour, $day, $month, $year) = gmtime;
	return $class->SUPER::new(year => 1900 + $year,
				  month => $month + 1,
				  day => $day,
				  hour => $hour,
				  minute => $minute,

lib/App/Glacier/DateTime.pm  view on Meta::CPAN

    }
    return $class->SUPER::new(@_);
}

sub strftime {
    my $self = shift;
    if (@_ > 1) {
	return map { $self->strftime($_) } @_;
    } else {
	my $fmt = shift;
	# DateTime::strftime misinterprets %c. so handle it separately
	$fmt =~ s{(?<!%)%c}
	         {POSIX::strftime('%c',
		                  $self->second,
		                  $self->minute,
		                  $self->hour,
		                  $self->day,
		                  $self->month - 1,
		                  $self->year - 1900,
		                  -1,
		                  -1,

lib/App/Glacier/DateTime.pm  view on Meta::CPAN

	    return $fmt;
	} else {
#	    print "FMT ".$self->year."-".$self->month."-".$self->day."-".$self->hour.';'.$self->minute."\n";
	    return $self->SUPER::strftime($fmt)
	}
    }
}

sub _fmt_default {
    my ($dt) = @_;
    my $now = new App::Glacier::DateTime;
    $dt = $dt->epoch;
    $now = $now->epoch;
    if ($dt < $now && $now - $dt < 6*31*86400) {
	return '%b %d %H:%M';
    } else {	
	return '%b %d  %Y';
    }
}

sub _fmt_iso {
    my ($dt) = @_;
    my $now = new App::Glacier::DateTime;
    $dt = $dt->epoch;
    $now = $now->epoch;
    if ($dt < $now && $now - $dt < 6*31*86400) {
	return '%m-%d %H:%M';
    } else {
	return '%Y-%m-%d';
    }
}

my %format_can = (

lib/App/Glacier/Timestamp.pm  view on Meta::CPAN

package App::Glacier::Timestamp;
use strict;
use warnings;
use Carp;
our @ISA = qw(Exporter);
our @EXPORT = qw(timestamp_deserialize);
use DateTime::Format::ISO8601;
use App::Glacier::DateTime;

sub _to_timestamp {
    my $obj = shift;
    my $ret;
    
    if (ref($obj) eq 'ARRAY') {
        $ret = [ map { _to_timestamp($_) } @{$obj} ];
    } elsif (ref($obj) eq 'HASH') {
        $ret = {map {
            my $v = $obj->{$_};
            if (/Date$/ && defined($v)) {
                $_ => bless DateTime::Format::ISO8601->
                                     parse_datetime($v),
                                   'App::Glacier::DateTime';
            } else {
                $_ => _to_timestamp($v);
            }
        } keys %$obj};
    } else {
        $ret = $obj;
    }
    
    return $ret;
}



( run in 0.350 second using v1.01-cache-2.11-cpan-05444aca049 )