App-SimpleBackuper

 view release on metacpan or  search on metacpan

local/lib/perl5/Data/Dump/Trace.pm  view on Meta::CPAN

=item C<O>

both input and output argument

=back

If the return value prototype has C<!> appended, then it signals that
this function sets errno ($!) when it returns a false value.  The
trace will display the current value of errno in that case.

If the return value prototype looks like a variable name (with C<$>
prefix), and the function returns a blessed object, then the variable
name will be used as prefix and the returned object automatically
traced.

=head1 SEE ALSO

L<Data::Dump>

=cut

local/lib/perl5/Module/Build/API.pod  view on Meta::CPAN

If you generate a F<README> in this way, it's probably a good idea to
create a separate F<INSTALL> file if that information isn't in the
generated F<README>.

=item dist_abstract

[version 0.20]

This should be a short description of the distribution.  This is used when
generating metadata for F<META.yml> and PPD files.  If it is not given
then C<Module::Build> looks in the POD of the module from which it gets
the distribution's version.  If it finds a POD section marked "=head1
NAME", then it looks for the first line matching C<\s+-\s+(.+)>,
and uses the captured text as the abstract.

=item dist_author

[version 0.20]

This should be something like "John Doe <jdoe@example.com>", or if
there are multiple authors, an anonymous array of strings may be
specified.  This is used when generating metadata for F<META.yml> and
PPD files.  If this is not specified, then C<Module::Build> looks at
the module from which it gets the distribution's version.  If it finds
a POD section marked "=head1 AUTHOR", then it uses the contents of
this section.

=item dist_name

[version 0.11]

Specifies the name for this distribution.  Most authors won't need to
set this directly, they can use C<module_name> to set C<dist_name> to

local/lib/perl5/Module/Build/API.pod  view on Meta::CPAN


The arguments may be either a scalar or an array reference of file
names.

=item y_n($message, $default)

[version 0.12]

Asks the user a yes/no question using C<prompt()> and returns true or
false accordingly.  The user will be asked the question repeatedly
until they give an answer that looks like "yes" or "no".

The first argument specifies the message to display to the user (for
example, C<"Shall I invest your money for you?">), and the second
argument specifies the default answer (for example, C<"y">).

Note that the default is specified as a string like C<"y"> or C<"n">,
and the return value is a Perl boolean value like 1 or 0.  I thought
about this for a while and this seemed like the most useful way to do
it.

local/lib/perl5/Module/Build/Base.pm  view on Meta::CPAN

    return $status->{have} if $status->{have} and "$status->{have}" ne '<none>';
    return '0 but true';
  }

  $@ = $status->{message};
  return 0;
}

sub make_executable {
  # Perl's chmod() is mapped to useful things on various non-Unix
  # platforms, so we use it in the base class even though it looks
  # Unixish.

  my $self = shift;
  foreach (@_) {
    my $current_mode = (stat $_)[2];
    chmod $current_mode | oct(111), $_;
  }
}

sub is_executable {

local/lib/perl5/Module/Build/Base.pm  view on Meta::CPAN

  if ( grep $opt =~ /^no[-_]?$_$/, @bool_opts ) {
    $opt =~ s/^no-?//;
    return ($opt, 0);
  }

  # non-boolean option; return option unchanged along with its argument
  return ($opt, shift(@$argv)) unless grep $_ eq $opt, @bool_opts;

  # we're punting a bit here, if an option appears followed by a digit
  # we take the digit as the argument for the option. If there is
  # nothing that looks like a digit, we pretend the option is a flag
  # that is being set and has no argument.
  my $arg = 1;
  $arg = shift(@$argv) if @$argv && $argv->[0] =~ /^\d+$/;

  return ($opt, $arg);
}

sub read_args {
  my $self = shift;

local/lib/perl5/Module/Build/Bundling.pod  view on Meta::CPAN

into the distribution's C<inc/> directory.  This is the same approach
used by L<Module::Install>, a modern wrapper around ExtUtils::MakeMaker
for Makefile.PL based distributions.

The "trick" to making this work for Module::Build is making sure the
highest version Module::Build is used, whether this is in C<inc/> or
already installed on the user's system.  This ensures that all necessary
features are available as well as any new bug fixes.  This is done using
the experimental L<inc::latest> module, available on CPAN.

A "normal" Build.PL looks like this (with only the minimum required
fields):

  use Module::Build;

  Module::Build->new(
    module_name => 'Foo::Bar',
    license     => 'perl',
  )->create_build_script;

A "bundling" Build.PL replaces the initial "use" line with a nearly

local/lib/perl5/Module/Build/Bundling.pod  view on Meta::CPAN


  Module::Build->new(
    module_name => 'Foo::Bar',
    license => 'perl',
  )->create_build_script;

The C<inc::latest> module creates bundled directories based on the packlist
file of an installed distribution.  Even though C<inc::latest> takes module
name arguments, it is better to think of it as bundling and making
available entire I<distributions>.  When a module is loaded through
C<inc::latest>, it looks in all bundled distributions in C<inc/> for a
newer module than can be found in the existing C<@INC> array.

Thus, the module-name provided should usually be the "top-level" module
name of a distribution, though this is not strictly required.  For example,
L<Module::Build> has a number of heuristics to map module names to
packlists, allowing users to do things like this:

  use inc::latest 'Devel::AssertOS::Unix';

even though Devel::AssertOS::Unix is contained within the Devel-CheckOS

local/lib/perl5/Module/Build/Compat.pm  view on Meta::CPAN


sub makefile_to_build_args {
  my $class = shift;
  my @out;
  foreach my $arg (@_) {
    next if $arg eq '';

    my ($key, $val) = ($arg =~ /^(\w+)=(.+)/ ? ($1, $2) :
		       die "Malformed argument '$arg'");

    # Do tilde-expansion if it looks like a tilde prefixed path
    ( $val ) = Module::Build->_detildefy( $val ) if $val =~ /^~/;

    if (exists $makefile_to_build{$key}) {
      my $trans = $makefile_to_build{$key};
      push @out, $class->_argvify( ref($trans) ? $trans->($val) : ($trans => $val) );
    } elsif (exists $Config{lc($key)}) {
      push @out, $class->_argvify( config => lc($key) . "=$val" );
    } else {
      # Assume M::B can handle it in lowercase form
      push @out, $class->_argvify("\L$key" => $val);

local/lib/perl5/Net/SFTP/Foreign/Backend/Unix.pm  view on Meta::CPAN

                $ssh_cmd_interface = ( "@open2_cmd" =~ /\bplink\b/i ? 'plink'  :
                                       "@open2_cmd" =~ /\bsshg3\b/i ? 'tectia' :
                                                                      'ssh'    );
            }

            my $port = delete $opts->{port};
	    my $ssh1 = delete $opts->{ssh1};

            my $more = delete $opts->{more};
            defined $more and !ref($more) and $more =~ /^-\w\s+\S/ and
                warnings::warnif("Net::SFTP::Foreign", "'more' argument looks like it should be split first");
            my @more = _ensure_list $more;

            my @preferred_authentications;
            if (defined $key_path) {
                push @preferred_authentications, 'publickey';
                push @open2_cmd, map { -i => $_ } _ensure_list $key_path;
            }

            if ($ssh_cmd_interface eq 'plink') {
                push @open2_cmd, -P => $port if defined $port;

local/lib/perl5/Test/Deep.pm  view on Meta::CPAN


  cmp_deeply(
    \@array,
    [$hash1, $hash2, ignore()],
    "first 2 elements are as expected, ignoring 3"
  );

  cmp_deeply(
    $object,
    noclass({value => 5}),
    "object looks ok, not checking its class"
  );

  cmp_deeply(
    \@result,
    bag('a', 'b', {key => [1, 2]}),
    "array has the 3 things we wanted in some order"
  );

=head1 DESCRIPTION

local/lib/perl5/Test/Deep.pm  view on Meta::CPAN


How Test::Deep works is much easier to understand by seeing some examples.

=head2 Without Test::Deep

Say you want to test a function which returns a string. You know that your
string should be a 7 digit number beginning with 0, C<eq> is no good in this
situation, you need a regular expression. So you could use Test::More's
C<like()> function:

  like($string, qr/^0[0-9]{6}$/, "number looks good");

Similarly, to check that a string looks like a name, you could do:

  like($string, qr/^(Mr|Mrs|Miss) \w+ \w+$/,
    "got title, first and last name");

Now imagine your function produces a hash with some personal details in it.
You want to make sure that there are 2 keys, Name and Phone and that the
name looks like a name and the phone number looks like a phone number. You
could do:

  $hash = make_person();
  like($hash->{Name}, qr/^(Mr|Mrs|Miss) \w+ \w+$/, "name ok");
  like($hash->{Phone}, qr/^0[0-9]{6}$/, "phone ok");
  is(scalar keys %$hash, 2, "correct number of keys");

But that's not quite right, what if make_person has a serious problem and
didn't even return a hash? We really need to write

local/lib/perl5/Test/Deep.pm  view on Meta::CPAN


will fail because although C<\@a> and C<\@b> both contain C<1, 2, 3> they are
references to different arrays.

=head3 noclass

  cmp_deeply( $got, noclass($thing) );

C<$thing> is a structure to be compared against.

This makes Test::Deep ignore the class of objects, so it just looks at the
data they contain. Class checking will be turned off until Test::Deep is
finished comparing C<$got_v> against C<$thing>. Once Test::Deep comes out of
C<$thing> it will go back to its previous setting for checking class.

This can be useful when you want to check that objects have been
constructed correctly but you don't want to write lots of
C<bless>es. If C<@people> is an array of Person objects then

  cmp_deeply(\@people, [
    bless {name => 'John', phone => '555-5555'}, "Person",

local/lib/perl5/Test/Deep.pm  view on Meta::CPAN

C<$number>, even if C<$got_v> is a ref. It is useful for checking the
numerical value of an overloaded reference. If C<$tolerance> is supplied
then this will check that C<$got_v> and C<$exp_v> are less than
C<$tolerance> apart. This is useful when comparing floating point numbers as
rounding errors can make it hard or impossible for C<$got_v> to be exactly
equal to C<$exp_v>. When C<$tolerance> is supplied, the test passes if
C<abs($got_v - $exp_v) <= $tolerance>.

B<Note> in Perl, C<"12blah" == 12> because Perl will be smart and convert
"12blah" into 12. You may not want this. There was a strict mode but that is
now gone. A "looks like a number" test will replace it soon. Until then you
can usually just use the string() comparison to be more strict. This will
work fine for almost all situations, however it will not work when <$got_v>
is an overloaded value who's string and numerical values differ.

=head3 bool, true, false

  cmp_deeply( $got, bool($value) );
  cmp_deeply( $got, true );
  cmp_deeply( $got, false );

local/lib/perl5/Test/Deep.pm  view on Meta::CPAN

#pod
#pod   cmp_deeply(
#pod     \@array,
#pod     [$hash1, $hash2, ignore()],
#pod     "first 2 elements are as expected, ignoring 3"
#pod   );
#pod
#pod   cmp_deeply(
#pod     $object,
#pod     noclass({value => 5}),
#pod     "object looks ok, not checking its class"
#pod   );
#pod
#pod   cmp_deeply(
#pod     \@result,
#pod     bag('a', 'b', {key => [1, 2]}),
#pod     "array has the 3 things we wanted in some order"
#pod   );
#pod
#pod =head1 DESCRIPTION
#pod

local/lib/perl5/Test/Deep.pm  view on Meta::CPAN

#pod
#pod How Test::Deep works is much easier to understand by seeing some examples.
#pod
#pod =head2 Without Test::Deep
#pod
#pod Say you want to test a function which returns a string. You know that your
#pod string should be a 7 digit number beginning with 0, C<eq> is no good in this
#pod situation, you need a regular expression. So you could use Test::More's
#pod C<like()> function:
#pod
#pod   like($string, qr/^0[0-9]{6}$/, "number looks good");
#pod
#pod Similarly, to check that a string looks like a name, you could do:
#pod
#pod   like($string, qr/^(Mr|Mrs|Miss) \w+ \w+$/,
#pod     "got title, first and last name");
#pod
#pod Now imagine your function produces a hash with some personal details in it.
#pod You want to make sure that there are 2 keys, Name and Phone and that the
#pod name looks like a name and the phone number looks like a phone number. You
#pod could do:
#pod
#pod   $hash = make_person();
#pod   like($hash->{Name}, qr/^(Mr|Mrs|Miss) \w+ \w+$/, "name ok");
#pod   like($hash->{Phone}, qr/^0[0-9]{6}$/, "phone ok");
#pod   is(scalar keys %$hash, 2, "correct number of keys");
#pod
#pod But that's not quite right, what if make_person has a serious problem and
#pod didn't even return a hash? We really need to write
#pod

local/lib/perl5/Test/Deep.pm  view on Meta::CPAN

#pod
#pod will fail because although C<\@a> and C<\@b> both contain C<1, 2, 3> they are
#pod references to different arrays.
#pod
#pod =head3 noclass
#pod
#pod   cmp_deeply( $got, noclass($thing) );
#pod
#pod C<$thing> is a structure to be compared against.
#pod
#pod This makes Test::Deep ignore the class of objects, so it just looks at the
#pod data they contain. Class checking will be turned off until Test::Deep is
#pod finished comparing C<$got_v> against C<$thing>. Once Test::Deep comes out of
#pod C<$thing> it will go back to its previous setting for checking class.
#pod
#pod This can be useful when you want to check that objects have been
#pod constructed correctly but you don't want to write lots of
#pod C<bless>es. If C<@people> is an array of Person objects then
#pod
#pod   cmp_deeply(\@people, [
#pod     bless {name => 'John', phone => '555-5555'}, "Person",

local/lib/perl5/Test/Deep.pm  view on Meta::CPAN

#pod C<$number>, even if C<$got_v> is a ref. It is useful for checking the
#pod numerical value of an overloaded reference. If C<$tolerance> is supplied
#pod then this will check that C<$got_v> and C<$exp_v> are less than
#pod C<$tolerance> apart. This is useful when comparing floating point numbers as
#pod rounding errors can make it hard or impossible for C<$got_v> to be exactly
#pod equal to C<$exp_v>. When C<$tolerance> is supplied, the test passes if
#pod C<abs($got_v - $exp_v) <= $tolerance>.
#pod
#pod B<Note> in Perl, C<"12blah" == 12> because Perl will be smart and convert
#pod "12blah" into 12. You may not want this. There was a strict mode but that is
#pod now gone. A "looks like a number" test will replace it soon. Until then you
#pod can usually just use the string() comparison to be more strict. This will
#pod work fine for almost all situations, however it will not work when <$got_v>
#pod is an overloaded value who's string and numerical values differ.
#pod
#pod =head3 bool, true, false
#pod
#pod   cmp_deeply( $got, bool($value) );
#pod   cmp_deeply( $got, true );
#pod   cmp_deeply( $got, false );
#pod

local/lib/perl5/Test/Deep/Set.pm  view on Meta::CPAN

$error
EOM

  return $diag;
}

sub add
{
  # this takes an array.

  # For each element A of the array, it looks for an element, B, already in
  # the set which are deeply equal to A. If no matching B is found then A is
  # added to the set. If a B is found and IgnoreDupes is true, then A will
  # be discarded, if IgnoreDupes is false, then B will be added to the set
  # again.
  
  my $self = shift;

  my @array = @_;

  my $IgnoreDupes = $self->{IgnoreDupes};

local/lib/perl5/Test/Spec/Mocks.pm  view on Meta::CPAN



=item $thing->expects($method)

Installs a mock method named C<$method> onto the class or object C<$thing> and
returns an Test::Spec::Mocks::Expectation object, which you can use to set the
return value with C<returns()> and other expectations. By default, the method
is expected to be called L<at_least_once>.

If the expectation is not met before the enclosing example completes, the
mocked method will raise an exception that looks something like:

  expected foo to be called exactly 1 time, but it was called 0 times

=back

=head1 EXPECTATION ADJUSTMENT METHODS

These are methods of the Test::Spec::Mocks::Expectation class, which you'll
receive by calling C<expects()> on a class or object instance.

local/lib/perl5/Test/Trap/Builder.pm  view on Meta::CPAN

=head2 output_layer NAME, GLOBREF

Registers (by I<NAME> and to the calling trapper) a layer for trapping
output on the file handle of the I<GLOBREF>, using I<NAME> also as the
attribute name.

=head2 capture_strategy NAME, [CODE]

When called with two arguments, registers (by I<NAME> and globally) a
strategy for output trap layers.  When called with a single argument,
looks up and returns the strategy registered by I<NAME> (or undef).

When a layer using this strategy is applied, the I<CODE> will be called
on the trap object, with the layer name and the output handle's fileno
and globref as arguments.

=head2 output_layer_backend SPEC

Back-compat alias of the above.

=head2 first_capture_strategy SPEC



( run in 0.476 second using v1.01-cache-2.11-cpan-64827b87656 )