I find Test is quite adequate. If you want you can bundle a copy of Test::More or even Test::Lincoln::Stein in your distro to avoid this problem. Asking permission for Test::More would be politic. See the CGI distribution to see Lincoln Stein roll his own test suite and include it. If you want complex tests you can have them just using Test:
use Test; BEGIN { plan tests => 42 } use Widget; ok(1) # module loaded OK my $w = new Widget; $reply = $w->method; @reply = $w->method; ok( $reply ); ok( @reply ); ok( $reply =~ m/something/ ); ok( $reply eq 'some string' ); ok( scalar @reply == 42 ); ok( join '', @reply eq 'some list of stuff' );
When you make a disto start like this:
$ h2xs -X Foo::Bar
This will write module stubs for you automatically. You will get:
Foo/Bar/Makefile.PL Foo/Bar/Bar.pm Foo/Bar/Changes Foo/Bar/test.pl Foo/Bar/MANIFEST Foo/Bar/README
You should then rename the Bar direcory Foo-Bar-0.01 if you want to follow the norms. You throw away the Foo dir :-) This writes you the stubs of your code which you can then just edit! Note if you just h2xs -X Bar then you will avoid generating the extra directory but you will need to edit your Makefile.PL it will have:
'NAME' => 'Bar' # but you need 'NAME' => 'Foo::Bar'
Package like this:
$ tar -cf Foo-Bar-0.01.tar Foo-Bar-0.01 $ gzip Foo-Bar-0.01.tar
Test like this:
$ tar -xzvf Foo-Bar-0.01.tar.gz $ perl Makefile.PL $ make $ make test $ make install
You will find that when you are playing with your distro you will repeat a number of steps over and over. I have a little script called make_manifest.pl which does a whole lot of things like:
Finally use Carp; see Carp for why and use the carp() and croak methods instead of warn() and die() which will put these messages in the perspective of the caller rather than the module.
Good luck.
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In reply to Re: Use a standard module or a "better" one, and how to make installing it troublefree.
by tachyon
in thread Use a standard module or a "better" one, and how to make installing it troublefree.
by Dog and Pony
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |