App-SimpleBackuper
view release on metacpan or search on metacpan
local/lib/perl5/Net/SFTP/Foreign.pm view on Meta::CPAN
278279280281282283284285286287288289290291292293294295296297298sub
disconnect {
my
$sftp
=
shift
;
my
$pid
=
delete
$sftp
->{pid};
$debug
and
$debug
& 4 and _debug(
"$sftp->disconnect called (ssh pid: "
.(
$pid
||
''
).
")"
);
local
$sftp
->{_autodie};
$sftp
->_conn_lost;
if
(
defined
$pid
) {
close
$sftp
->{ssh_out}
if
(
defined
$sftp
->{ssh_out} and not
$sftp
->{_ssh_out_is_not_dupped});
close
$sftp
->{ssh_in}
if
defined
$sftp
->{ssh_in};
if
(
$windows
) {
kill
KILL
=>
$pid
and
waitpid
(
$pid
, 0);
$debug
and
$debug
& 4 and _debug
"process $pid reaped"
;
}
else
{
my
$dirty
= (
defined
$sftp
->{_dirty_cleanup}
?
$sftp
->{_dirty_cleanup}
:
$dirty_cleanup
);
local/lib/perl5/Net/SFTP/Foreign.pm view on Meta::CPAN
32693270327132723273327432753276327732783279328032813282328332843285328632873288
return
@ret
;
}
else
{
my
$ret
=
$sftp
->
$method
(
@_
);
$sftp
->_set_errno
unless
defined
$ret
;
return
$ret
;
}
}
};
my
$gen_not_supported
=
sub
{
sub
{
$! = Errno::ENOTSUP();
undef
}
};
sub
TIEHANDLE {
return
shift
}
# sub UNTIE {}
local/lib/perl5/Net/SFTP/Foreign.pm view on Meta::CPAN
34893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511sub
_cache { *{
shift
()}{ARRAY}[4] }
*CLOSEDIR
=
$gen_proxy_method
->(
'closedir'
);
*READDIR
=
$gen_proxy_method
->(
'_readdir'
);
sub
OPENDIR {
shift
->CLOSEDIR;
undef
;
}
*REWINDDIR
=
$gen_not_supported
->();
*TELLDIR
=
$gen_not_supported
->();
*SEEKDIR
=
$gen_not_supported
->();
sub
DESTROY {
local
($@, $!, $?);
my
$self
=
shift
;
my
$sftp
=
$self
->_sftp;
$debug
and
$debug
& 4 and Net::SFTP::Foreign::_debug(
"$self->DESTROY called (sftp: "
.(
$sftp
||
''
).
")"
);
if
(
$self
->_check and
$sftp
) {
local
$sftp
->{_autodie};
local/lib/perl5/Net/SFTP/Foreign/Backend/Unix.pm view on Meta::CPAN
114115116117118119120121122123124125126127128129130131132133134my
(
$backend
,
$sftp
,
$opts
) =
@_
;
my
$transport
=
delete
$opts
->{transport};
if
(
defined
$transport
) {
if
(
ref
$transport
eq
'ARRAY'
) {
@{
$sftp
}{
qw(ssh_in ssh_out pid)
} =
@$transport
;
}
else
{
$sftp
->{ssh_in} =
$sftp
->{ssh_out} =
$transport
;
$sftp
->{_ssh_out_is_not_dupped} = 1;
}
}
else
{
my
$user
=
delete
$opts
->{user};
my
$pass
=
delete
$opts
->{passphrase};
my
$ask_for_username_at_login
;
my
$pass_is_passphrase
;
my
$password_prompt
;
if
(
defined
$pass
) {
$pass_is_passphrase
= 1;
local/lib/perl5/Test/Trap/Builder.pm view on Meta::CPAN
697071727374757677787980818283848586878889
}
sub
Exception {
my
$self
=
shift
;
$self
->ExceptionFunction->(
@_
);
}
}
# Utility functions and methods on the builder class/object:
sub
_carpnot_for (@) {
my
%seen
= ( __PACKAGE__, 1 );
my
@pkg
=
grep
{ !
$seen
{
$_
}++ }
@_
;
return
@pkg
;
}
sub
new {
$builder
}
sub
trap {
my
$self
=
shift
;
my
(
$trapper
,
$glob
,
$layers
,
$code
) =
@_
;
local/lib/perl5/Test/Trap/Builder.pm view on Meta::CPAN
99100101102103104105106107108109110111112113114115116117118119
for
(
reverse
@{
$trap
->Prop->{teardown}}) {
TEST_TRAP_BUILDER_INTERNAL_EXCEPTION: {
eval
{
$_
->(); 1} or
$trap
->Exception(
"Rethrowing teardown exception: $@"
);
}
}
last
if
@{
$trap
->Prop->{exception}||[]};
${
*$glob
} =
$trap
;
my
@return
=
eval
{ @{
$trap
->
return
} };
return
$wantarray
?
@return
:
$return
[0];
}
local
( GOT_CARP_NOT ?
@CARP_NOT
:
@ISA
) = _carpnot_for
$trapper
,
scalar
caller
;
croak
join
"\n"
, @{
$trap
->Prop->{exception}};
}
BEGIN {
# The register (private) functions:
my
%register
;
sub
_register {
my
(
$type
,
$package
,
$name
,
$val
) =
@_
;
$register
{
$type
}{
$package
}{
$name
} =
$val
;
}
sub
_register_packages {
local/lib/perl5/Test/Trap/Builder.pm view on Meta::CPAN
345346347348349350351352353354355356357358359360361362363364365
my
$strategy
=
$self
->capture_strategy(
$_
);
return
$strategy
if
$strategy
;
}
croak
"No capture strategy found for "
.
dump
(
@strategy
);
}
}
sub
layer_implementation {
my
$self
=
shift
;
# Directly querying layer implementation, we should know what we're doing:
local
( GOT_CARP_NOT ?
@CARP_NOT
:
@ISA
) = _carpnot_for
caller
;
my
$trapper
=
shift
;
my
@r
;
for
(
@_
) {
if
(
length
ref
and
eval
{
exists
&$_
} ) {
push
@r
,
$_
;
next
;
}
my
(
$name
,
$arg
) =
/^ ( [^\(]+ )
# layer name: anything but '('
(?:
# begin optional group
( run in 0.316 second using v1.01-cache-2.11-cpan-bb97c1e446a )