App-SimpleBackuper
view release on metacpan or search on metacpan
local/lib/perl5/Net/SFTP/Foreign.pm view on Meta::CPAN
those options have the opposite result to their C<wanted> counterparts:
my $no_hidden = $sftp->ls( '/home/homer',
no_wanted => qr/^\./ )
or die "ls failed";
When both C<no_wanted> and C<wanted> rules are used, the C<no_wanted>
rule is applied first and then the C<wanted> one (order is important
if the callbacks have side effects, experiment!).
=item ordered =E<gt> 1
the list of entries is ordered by filename.
=item follow_links =E<gt> 1
by default, the attributes on the listing correspond to a C<lstat>
operation, setting this option causes the method to perform C<stat>
requests instead. C<lstat> attributes will still appear for links
local/lib/perl5/Net/SFTP/Foreign.pm view on Meta::CPAN
=item atomic_readdir =E<gt> 1
reading a directory is not an atomic SFTP operation and the protocol
draft does not define what happens if C<readdir> requests and write
operations (for instance C<remove> or C<open>) affecting the same
directory are intermixed.
This flag ensures that no callback call (C<wanted>, C<no_wanted>) is
performed in the middle of reading a directory and has to be set if
any of the callbacks can modify the file system.
=item realpath =E<gt> 1
for every file object, performs a realpath operation and populates the
C<realpath> entry.
=item names_only =E<gt> 1
makes the method return a simple array containing the file names from
the remote directory only. For instance, these two sentences are
local/lib/perl5/Net/SFTP/Foreign.pm view on Meta::CPAN
=item wanted =E<gt> sub { ... }
=item no_wanted =E<gt> qr/.../
=item no_wanted =E<gt> sub { ... }
These options have the same effect as on the C<ls> method, allowing to
filter out unwanted entries (note that filename keys contain B<full
paths> here).
The callbacks can also be used to perform some action instead of
creating the full listing of entries in memory (that could use huge
amounts of RAM for big file trees):
$sftp->find($src_dir,
wanted => sub {
my $fn = $_[1]->{filename}
print "$fn\n" if $fn =~ /\.p[ml]$/;
return undef # so it is discarded
});
local/lib/perl5/Test/Trap/Builder.pm view on Meta::CPAN
$B->accessor( simple => [ $layer_name ] );
$B->multi_layer( $multi_name => @names );
$B->test( $test_name => 'trap, predicate, name', \&test_function );
=head1 DESCRIPTION
L<Test::Trap> neither traps nor tests everything you may want to trap
or test. So, Test::Trap::Builder provides methods to write your own
trap layers, accessors, and test callbacks -- preferably for use with
your own modules (trappers).
Note that layers are methods with mangled names (names are prefixed
with C<layer:>), and so inherited like any other method, while
accessors are ordinary methods. Meanwhile, test callbacks are not
referenced in the symbol table by themselves, but only in combinations
with accessors, all methods of the form I<ACCESSOR>_I<TEST>.
=head1 EXPORTS
Trappers should not inherit from Test::Trap::Builder, but may import a
few convenience methods for use in building the trap. Do not use them
as methods of Test::Trap::Builder -- they are intended to be methods
of trap objects. (If you inherit from another trapper, you need not,
and probably should not, import these yourself -- you should inherit
these methods like any other.)
Trappers may import any number of these methods, or all of them by way
of the C<:methods> tag.
Layers should be implemented as methods, and while they need not call
any of these convenience methods in turn, that likely makes for more
readable code than any alternative. Likewise, test callbacks may use
convenience methods for more readable code.
Of course, certain convenience methods may also be useful in more
generic methods messing with trap or builder objects.
=head2 Prop [PACKAGE]
A method returning a reference to a hash, holding the I<PACKAGE>'s (by
default the caller's) tag-on properties for the (current) trap object.
Currently, Test::Trap::Builder defines the following properties:
local/lib/perl5/Test/Trap/Builder.pm view on Meta::CPAN
If your layer wants to clean up its setup, it may use this method to
register any number of tear-down actions, to be performed (in reverse
registration order) once the user code has been executed. Should only
be called in a dynamic context in which layers are being applied.
=head2 TestAccessor
Returns a string of the form C<"I<NAME>(I<INDEX>)">, where I<NAME> and
I<INDEX> are the name of the accessor and the index (if any) being
tested. Should only be called in the dynamic context of test
callbacks.
This is intended for diagnostics:
diag( sprintf 'Expected %s in %s; got %s',
$expected, $self->TestAccessor, dump($got),
);
=head2 TestFailure
Runs the C<on_test_failure> tag-on property (if any) on the trap
local/lib/perl5/Test/Trap/Builder.pm view on Meta::CPAN
Should be a reference to a hash. For each pair, a name and an
implementation, an accessor is generated and registered.
=back
=head2 test NAME, ARGSPEC, CODE
Registers a test callback by I<NAME> and to the calling trapper.
Trappers inherit test callbacks like methods (though they are not
implemented as such; don't expect to find them in the symbol table).
Test methods of the form I<ACCESSOR>_I<TEST> will be made available
(directly or by inheritance) to every trapper that registers or
inherits both the accessor named I<ACCESSOR> and the test named
I<TEST>.
(In more detail, the method will be generated in every trapper that
either (1) registers both the test and the accessor, or (2) registers
either and inherits the other.)
( run in 0.245 second using v1.01-cache-2.11-cpan-bf8d7bb2d05 )