Write own Test Perl Module that use Test::More -
i need write own test module (testown) use test::more module. code of testown.pm like:
package testown; use test::more; 1;
then try use package in 1 of test file (test01.t);
use lib -e 't' ? 't' : 'test'; use testown; .... done_testing();
but when test run have error:
t/test01.t .. undefined subroutine &main::done_testing
so seems functions in test::more not imported in test file use testown command.
by default, nothing in module exported code calls it. design, exporting rather dangerous activity result in name clashes.
you have define things export default (and can give user of module control of behavior). see exporter.
you could export methods of module, isn't idea. if uses module , test::more
? better option create own wrappers around test::more
functions think needed, export those. should limit exporting as possible. there better alternatives, such using oo design methods. see above documentation more discussion of this.
the calling code can access stuff not exported using module::function()
.
Comments
Post a Comment