view release on metacpan or search on metacpan
}
},
"runtime" : {
"requires" : {
"Compress::Raw::Lzma" : "0",
"Const::Fast" : "0",
"Crypt::OpenSSL::RSA" : "0",
"Crypt::Rijndael" : "0",
"Net::SFTP::Foreign" : "0",
"Text::Glob" : "0",
"Try::Tiny" : "0",
"perl" : "5.014"
}
},
"test" : {
"requires" : {
"Test::Spec" : "0"
}
}
},
"release_status" : "stable",
directory:
- t
- inc
requires:
Compress::Raw::Lzma: '0'
Const::Fast: '0'
Crypt::OpenSSL::RSA: '0'
Crypt::Rijndael: '0'
Net::SFTP::Foreign: '0'
Text::Glob: '0'
Try::Tiny: '0'
perl: '5.014'
resources:
repository: git://github.com/dmitry-novozhilov/simple-backuper.git
version: v0.2.26
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
Makefile.PL view on Meta::CPAN
LICENSE => 'gpl_3',
test => {TESTS => 't/*.t t/*/*.t'},
TEST_REQUIRES => {'Test::Spec' => 0},
EXE_FILES => ['bin/simple-backuper'],
MIN_PERL_VERSION=> 5.014,
PREREQ_PM => {
'Crypt::Rijndael' => 0,
'Crypt::OpenSSL::RSA' => 0,
'Compress::Raw::Lzma' => 0,
'Text::Glob' => 0,
'Try::Tiny' => 0,
'Net::SFTP::Foreign' => 0,
'Const::Fast' => 0,
},
META_MERGE => {
'meta-spec' => { version => 2 },
resources => {
repository => {
type => 'git',
url => 'git://github.com/dmitry-novozhilov/simple-backuper.git',
web => 'https://github.com/dmitry-novozhilov/simple-backuper',
bin/simple-backuper view on Meta::CPAN
#!/usr/bin/perl
package App::SimpleBackuper;
use strict;
use warnings;
use feature ':5.14';
use Getopt::Long;
use JSON::PP;
use Try::Tiny;
use Crypt::OpenSSL::RSA;
use POSIX qw(strftime);
use Data::Dumper;
use Time::HiRes;
use App::SimpleBackuper::DB;
use App::SimpleBackuper::StorageLocal;
use App::SimpleBackuper::StorageSFTP;
use App::SimpleBackuper::Backup;
use App::SimpleBackuper::Info;
use App::SimpleBackuper::RestoreDB;
requires 'Compress::Raw::Lzma';
requires 'Const::Fast';
requires 'Crypt::OpenSSL::RSA';
requires 'Crypt::Rijndael';
requires 'Net::SFTP::Foreign';
requires 'Text::Glob';
requires 'Try::Tiny';
test_requires 'Test::Spec';
cpanfile.snapshot view on Meta::CPAN
strict 0
warnings 0
Module-Implementation-0.09
pathname: D/DR/DROLSKY/Module-Implementation-0.09.tar.gz
provides:
Module::Implementation 0.09
requirements:
Carp 0
ExtUtils::MakeMaker 0
Module::Runtime 0.012
Try::Tiny 0
strict 0
warnings 0
Module-Runtime-0.016
pathname: Z/ZE/ZEFRAM/Module-Runtime-0.016.tar.gz
provides:
Module::Runtime 0.016
requirements:
Module::Build 0
Test::More 0.41
perl 5.006
cpanfile.snapshot view on Meta::CPAN
Tie-IxHash-1.23
pathname: C/CH/CHORNY/Tie-IxHash-1.23.tar.gz
provides:
Tie::IxHash 1.23
requirements:
Test::More 0
perl 5.005
Try-Tiny-0.31
pathname: E/ET/ETHER/Try-Tiny-0.31.tar.gz
provides:
Try::Tiny 0.31
requirements:
Carp 0
Exporter 5.57
ExtUtils::MakeMaker 0
constant 0
perl 5.006
strict 0
warnings 0
lib/App/SimpleBackuper/Backup.pm view on Meta::CPAN
package App::SimpleBackuper;
use strict;
use warnings;
use feature ':5.14';
use Carp;
use Try::Tiny;
use Time::HiRes qw(time);
use Const::Fast;
use App::SimpleBackuper::BackupDB;
use App::SimpleBackuper::_format;
use App::SimpleBackuper::_BlockDelete;
use App::SimpleBackuper::_BlocksInfo;
const my $SIZE_OF_TOP_FILES => 10;
const my $SAVE_DB_PERIOD => 60 * 60;
const my $PRINT_PROGRESS_PERIOD => 60;
lib/App/SimpleBackuper/DB/FilesTable.pm view on Meta::CPAN
package App::SimpleBackuper::DB::FilesTable;
use strict;
use warnings;
use parent qw(App::SimpleBackuper::DB::BaseTable);
use Try::Tiny;
use Data::Dumper;
use App::SimpleBackuper::DB::PartsTable;
sub _pack_version {
my($version) = @_;
my $p = __PACKAGE__->packer()
->pack(J => 1 => $version->{backup_id_min})
->pack(J => 1 => $version->{backup_id_max})
->pack(J => 1 => $version->{uid})
lib/App/SimpleBackuper/DB/PartsTable.pm view on Meta::CPAN
package App::SimpleBackuper::DB::PartsTable;
use strict;
use warnings;
use parent qw(App::SimpleBackuper::DB::BaseTable);
use Try::Tiny;
use Data::Dumper;
sub pack {
my($self, $data) = @_;
my $p = $self->packer();
$p->pack(H => 128 => $data->{hash});
if(exists $data->{size}) {
$p->pack(J => 1 => $data->{size});
lib/App/SimpleBackuper/StorageSFTP.pm view on Meta::CPAN
package App::SimpleBackuper::StorageSFTP;
use strict;
use warnings;
use Try::Tiny;
use Net::SFTP::Foreign;
use Net::SFTP::Foreign::Constants qw(SSH2_FX_CONNECTION_LOST);
sub new {
my($class, $options) = @_;
my(undef, $user, $host, $path) = $options =~ /^(([^@]+)@)?([^:]+):(.*)$/;
my $self = bless {user => $user, host => $host, path => $path} => $class;
$self->_connect();
local/cache/modules/02packages.details.txt view on Meta::CPAN
Net::SFTP::Foreign::Common 1.76_02 S/SA/SALVA/Net-SFTP-Foreign-1.93.tar.gz
Net::SFTP::Foreign::Compat 1.70_05 S/SA/SALVA/Net-SFTP-Foreign-1.93.tar.gz
Net::SFTP::Foreign::Constants 1.63_05 S/SA/SALVA/Net-SFTP-Foreign-1.93.tar.gz
Net::SFTP::Foreign::DirHandle 1.93 S/SA/SALVA/Net-SFTP-Foreign-1.93.tar.gz
Net::SFTP::Foreign::FileHandle 1.93 S/SA/SALVA/Net-SFTP-Foreign-1.93.tar.gz
Net::SFTP::Foreign::Handle 1.93 S/SA/SALVA/Net-SFTP-Foreign-1.93.tar.gz
Net::SFTP::Foreign::Helpers 1.74_06 S/SA/SALVA/Net-SFTP-Foreign-1.93.tar.gz
Net::SFTP::Foreign::Local 1.57 S/SA/SALVA/Net-SFTP-Foreign-1.93.tar.gz
Sub::Exporter::Progressive 0.001013 F/FR/FREW/Sub-Exporter-Progressive-0.001013.tar.gz
Text::Glob 0.11 R/RC/RCLAMP/Text-Glob-0.11.tar.gz
Try::Tiny 0.31 E/ET/ETHER/Try-Tiny-0.31.tar.gz
local/lib/perl5/Module/Implementation.pm view on Meta::CPAN
package Module::Implementation;
# git description: v0.08-2-gd599347
$Module::Implementation::VERSION = '0.09';
use strict;
use warnings;
use Module::Runtime 0.012 qw( require_module );
use Try::Tiny;
# This is needed for the benefit of Test::CleanNamespaces, which in turn loads
# Package::Stash, which in turn loads this module and expects a minimum
# version.
unless ( exists $Module::Implementation::{VERSION}
&& ${ $Module::Implementation::{VERSION} } ) {
$Module::Implementation::{VERSION} = \42;
}
local/lib/perl5/Try/Tiny.pm view on Meta::CPAN
package Try::Tiny; # git description: v0.30-11-g1b81d0a
use 5.006;
# ABSTRACT: Minimal try/catch with proper preservation of $@
our $VERSION = '0.31';
use strict;
use warnings;
use Exporter 5.57 'import';
our @EXPORT = our @EXPORT_OK = qw(try catch finally);
local/lib/perl5/Try/Tiny.pm view on Meta::CPAN
my $wantarray = wantarray;
# work around perl bug by explicitly initializing these, due to the likelyhood
# this will be used in global destruction (perl rt#119311)
my ( $catch, @finally ) = ();
# find labeled blocks in the argument list.
# catch and finally tag the blocks by blessing a scalar reference to them.
foreach my $code_ref (@code_refs) {
if ( ref($code_ref) eq 'Try::Tiny::Catch' ) {
croak 'A try() may not be followed by multiple catch() blocks'
if $catch;
$catch = ${$code_ref};
} elsif ( ref($code_ref) eq 'Try::Tiny::Finally' ) {
push @finally, ${$code_ref};
} else {
croak(
'try() encountered an unexpected argument ('
. ( defined $code_ref ? $code_ref : 'undef' )
. ') - perhaps a missing semi-colon before or'
);
}
}
local/lib/perl5/Try/Tiny.pm view on Meta::CPAN
# name the blocks if we have Sub::Name installed
_subname(caller().'::try {...} ' => $try)
if _HAS_SUBNAME;
# set up scope guards to invoke the finally blocks at the end.
# this should really be a function scope lexical variable instead of
# file scope + local but that causes issues with perls < 5.20 due to
# perl rt#119311
local $_finally_guards{guards} = [
map Try::Tiny::ScopeGuard->_new($_),
@finally
];
# save the value of $@ so we can set $@ back to it in the beginning of the eval
# and restore $@ after the eval finishes
my $prev_error = $@;
my ( @ret, $error );
# failed will be true if the eval dies, because 1 will not be returned
local/lib/perl5/Try/Tiny.pm view on Meta::CPAN
}
sub catch (&;@) {
my ( $block, @rest ) = @_;
croak 'Useless bare catch()' unless wantarray;
_subname(caller().'::catch {...} ' => $block)
if _HAS_SUBNAME;
return (
bless(\$block, 'Try::Tiny::Catch'),
@rest,
);
}
sub finally (&;@) {
my ( $block, @rest ) = @_;
croak 'Useless bare finally()' unless wantarray;
_subname(caller().'::finally {...} ' => $block)
if _HAS_SUBNAME;
return (
bless(\$block, 'Try::Tiny::Finally'),
@rest,
);
}
{
package # hide from PAUSE
Try::Tiny::ScopeGuard;
use constant UNSTABLE_DOLLARAT => ("$]" < '5.013002') ? 1 : 0;
sub _new {
shift;
bless [ @_ ];
}
sub DESTROY {
my ($code, @args) = @{ $_[0] };
local/lib/perl5/Try/Tiny.pm view on Meta::CPAN
__PACKAGE__
__END__
=pod
=encoding UTF-8
=head1 NAME
Try::Tiny - Minimal try/catch with proper preservation of $@
=head1 VERSION
version 0.31
=head1 SYNOPSIS
You can use Try::Tiny's C<try> and C<catch> to expect and handle exceptional
conditions, avoiding quirks in Perl and common mistakes:
# handle errors with a catch handler
try {
die "foo";
} catch {
warn "caught error: $_"; # not $@
};
You can also use it like a standalone C<eval> to catch and ignore any error
local/lib/perl5/Try/Tiny.pm view on Meta::CPAN
Note that the error may be false, but if that happens the C<catch> block will
still be invoked.
Once all execution is finished then the C<finally> block, if given, will execute.
=item catch (&;@)
Intended to be used in the second argument position of C<try>.
Returns a reference to the subroutine it was given but blessed as
C<Try::Tiny::Catch> which allows try to decode correctly what to do
with this code reference.
catch { ... }
Inside the C<catch> block the caught error is stored in C<$_>, while previous
value of C<$@> is still available for use. This value may or may not be
meaningful depending on what happened before the C<try>, but it might be a good
idea to preserve it in an error stack.
For code that captures C<$@> when throwing new errors (i.e.
local/lib/perl5/Try/Tiny.pm view on Meta::CPAN
} catch {
# ...code run in case of error
} finally {
if (@_) {
print "The try block died with: @_\n";
} else {
print "The try block ran without error.\n";
}
};
B<You must always do your own error handling in the C<finally> block>. C<Try::Tiny> will
not do anything about handling possible errors coming from code located in these
blocks.
Furthermore B<exceptions in C<finally> blocks are not trappable and are unable
to influence the execution of your program>. This is due to limitation of
C<DESTROY>-based scope guards, which C<finally> is implemented on top of. This
may change in a future version of Try::Tiny.
In the same way C<catch()> blesses the code reference this subroutine does the same
except it bless them as C<Try::Tiny::Finally>.
=back
=head1 BACKGROUND
There are a number of issues with C<eval>.
=head2 Clobbering $@
When you run an C<eval> block and it succeeds, C<$@> will be cleared, potentially
local/lib/perl5/x86_64-linux-gnu-thread-multi/.meta/Try-Tiny-0.31/install.json view on Meta::CPAN
{"pathname":"E/ET/ETHER/Try-Tiny-0.31.tar.gz","provides":{"Try::Tiny":{"version":"0.31","file":"lib/Try/Tiny.pm"}},"dist":"Try-Tiny-0.31","target":"Try::Tiny","name":"Try::Tiny","version":"0.31"}
local/lib/perl5/x86_64-linux-gnu-thread-multi/perllocal.pod view on Meta::CPAN
=item *
C<VERSION: 0.001013>
=item *
C<EXE_FILES: >
=back
=head2 Fri Jan 12 21:22:54 2024: C<Module> L<Try::Tiny|Try::Tiny>
=over 4
=item *
C<installed into: /home/me/dev/simple-backuper/local/lib/perl5>
=item *
C<LINKTYPE: dynamic>