App-Glacier
view release on metacpan or search on metacpan
lib/App/Glacier.pm view on Meta::CPAN
},
ls => sub {
require App::Glacier::Command::ListVault;
return new App::Glacier::Command::ListVault(@_);
},
sync => sub {
require App::Glacier::Command::Sync;
return new App::Glacier::Command::Sync(@_);
},
put => sub {
require App::Glacier::Command::Put;
return new App::Glacier::Command::Put(@_);
},
rmvault => sub {
require App::Glacier::Command::DeleteVault;
return new App::Glacier::Command::DeleteVault(@_);
},
rm => sub {
require App::Glacier::Command::DeleteFile;
return new App::Glacier::Command::DeleteFile(@_);
},
purge => sub {
require App::Glacier::Command::Purge;
return new App::Glacier::Command::Purge(@_);
},
get => sub {
require App::Glacier::Command::Get;
return new App::Glacier::Command::Get(@_);
},
jobs => sub {
require App::Glacier::Command::Jobs;
return new App::Glacier::Command::Jobs(@_);
},
periodic => sub {
require App::Glacier::Command::Periodic;
return new App::Glacier::Command::Periodic(@_);
}
);
sub getcom {
my ($self, $com) = @_;
while (defined($comtab{$com}) and ref($comtab{$com}) ne 'CODE') {
$com = $comtab{$com};
}
croak "internal error: unresolved command alias" unless defined $com;
return $comtab{$com} if exists $comtab{$com};
my @v = map { /^$com/ ? $_ : () } sort keys %comtab;
if ($#v == -1) {
$self->usage_error("unrecognized command");
} elsif ($#v > 0) {
$self->usage_error("ambiguous command: ".join(', ', @v));
}
return $self->getcom($v[0]);
}
sub new {
my ($class, $argref) = shift;
my $self = $class->SUPER::new(
$argref,
optmap => {
'config-file|f=s' => 'config',
'account=s' => 'account',
'region=s' => 'region'
});
my $com = shift @{$self->argv}
or $self->usage_error("no command name");
&{$self->getcom($com)}($self->argv,
debug => $self->{_debug},
dry_run => $self->dry_run,
progname => $self->progname,
%{$self->{_options} // {}});
}
__END__
=head1 NAME
App::Glacier - command line utility for accessing Amazon Glacier storage
=head1 SYNOPSIS
B<glacier>
[B<-?dn>]
[B<-f> I<FILE>]
[B<--account=>I<STRING>]
[B<--config-file=>I<FILE>]
[B<--debug>]
[B<--dry-run>]
[B<--help>]
[B<--region=>I<STRING>]
[B<--usage>]
I<COMMAND> [I<OPTIONS>] I<ARG>...
=head1 DESCRIPTION
Command line tool for working with the Amazon Glacier storage. The I<COMMAND>
instructs it what kind of manipulation is required. Its action can be
modified by I<OPTIONS> supplied after the command name. Options occurring
before it affect the behavior of the program as a whole and are common
for all commands.
The following is a short summary of existing commands. For a detailed
description about any particular I<command>, please refer to the
corresponding manual page (B<glacier-I<command>>), or run
B<glacier I<command> --help>.
=head2 On file versioning
In the discussion below, I<FILE> stands for the name of the file to which
the command in question applies. In contrast to the UNIX filesystem, where
each file name is unique within the directory, B<Glacier> vaults can keep
multiple copies of the same file. To discern between them, the I<version
number> is used. When a file B<FILE> is first stored in a vault, it is
assigned version number B<1>. The version numbed of this copy is incremented
each time a new copy of the same file is added to the vault. The most recently
stored copy always has the version number of B<1>.
Each command by default operates on the most recent copy of the file, i.e.
( run in 1.716 second using v1.01-cache-2.11-cpan-302cb4679cc )