Test::Builder::Util - Internal tools for Test::Builder and friends
Tools for generating accessors and other object bits and pieces.
#Imports a sub named 'new' and all the other tools. use Test::Builder::Util; # Define some exports export 'foo'; # Export the 'foo' sub export bar => sub { ... }; # export an anon sub named bar # Generate some accessors accessors qw/yabba dabba doo/;
Generic constructor method, can be used in almost any package. Takes key/value pairs as arguments. Key is assumed to be the name of a method or accessor. The method named for the key is called with the value as an argument. You can also define an 'init' method which this will call for you on the newly created object.
Importing this method lets you define exports.
Export @names to the package $dest_package
Export the subs named in @names.
Export a sub named $name. Optionally a coderef may be used.
Define an accessor. A default value can be specified via a coderef.
Define several read/write accessors at once.
Define a read/write accessor that transforms whatever you assign to it via the given coderef. $attr is optional and defaults to $name. $attr is the key inside the blessed object hash used to store the field.
A delta accessor is an accessor that adds the numeric argument to the current value. Optionally a default value can be specified, otherwise 0 is used.
The atomic variations are thread-safe.
Eval the codeblock, return success or failure, and optionally the error message. This code protects $@ and $!, they will be restored by the end of the run. This code also temporarily blocks $SIG{DIE} handlers.
Similar to try, except that it does not catch exceptions. The idea here is to protect $@ and $! from changes. $@ and $! will be restored to whatever they were before the run so long as it is successful. If the run fails $! will still be restored, but $@ will contain the exception being thrown.
Find a sub in a package, returns the coderef if it is present, otherwise it returns undef. This is similar to $package->can($subname) except that it ignores inheritance.
$package->can($subname)
Check if a package is a tester, return the metadata if it is.
Check if a package is a provider, return the metadata if it is.
Find the Test::Builder instance to use.
The source code repository for Test::More can be found at http://github.com/Test-More/test-more/.
Copyright 2014 Chad Granum <exodist7@gmail.com>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html
To install Test::Simple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Simple
CPAN shell
perl -MCPAN -e shell install Test::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.