App-SimpleBackuper
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/App/SimpleBackuper/DB/BaseTable.pm view on Meta::CPAN
use warnings FATAL => qw( all );
use Carp;
use Data::Dumper;
sub new {
my($class, $number_of_records) = @_;
$number_of_records //= 0;
my @arr = (undef) x $number_of_records;
return bless \@arr => $class;
}
sub find_row {
my $self = shift;
my($from, $to) = $self->_find(@_);
die "Found more then one" if $to > $from;
return undef if $from > $to;
return $self->unpack( $self->[ $from ] );
}
lib/App/SimpleBackuper/StorageLocal.pm view on Meta::CPAN
use strict;
use warnings;
sub new {
my($class, $path) = @_;
die "Storage path '$path' doesn't exists" if ! -e $path;
die "Storage path '$path' is not a directory" if ! -d $path;
return bless { path => $path } => $class;
}
sub put {
my($self, $name, $content_ref) = @_;
open(my $fh, ">", "$self->{path}/$name") or die "Can't write to $self->{path}/$name: $!";
print $fh $$content_ref;
close($fh);
return $self;
lib/App/SimpleBackuper/StorageSFTP.pm view on Meta::CPAN
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();
return $self;
}
sub _connect {
my($self) = @_;
$self->{sftp} = Net::SFTP::Foreign->new(host => $self->{host}, ($self->{user} ? (user => $self->{user}) : ()), timeout => 30);
$self->{sftp}->die_on_error("SFTP connect error");
local/lib/perl5/Data/Dump/Filtered.pm view on Meta::CPAN
=item object => $value
dump the given value instead of the one visited and passed in as $object.
Basically the same as specifying C<< dump => Data::Dump::dump($value) >>.
=item comment => $comment
prefix the value with the given comment string
=item bless => $class
make it look as if the current object is of the given $class
instead of the class it really has (if any). The internals of the object
is dumped in the regular way. The $class can be the empty string
to make Data::Dump pretend the object wasn't blessed at all.
=item hide_keys => ['key1', 'key2',...]
=item hide_keys => \&code
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.095 second using v1.00-cache-2.02-grep-82fe00e-cpan-4185a24d4ac )