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.
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.