testing
Richard Foley
Richard.Foley at rfi.net
Mon Nov 3 14:36:43 GMT 2008
This is one of the many reasons we use Perl, because it's so flexible, and one
of the reasons many other people don't. Still doesn't mean you should
though...
--
Richard Foley
Ciao - shorter than aufwiedersehen
http://www.rfi.net/
On Monday 03 November 2008 14:57:01 Jonathan Stowe wrote:
> 2008/11/3 Christopher Jones <c.jones at ucl.ac.uk>:
> > Should you be able to create and call methods from a package in a test
> > script? i.e Should something like this work? (i.e.i.e. it doesn't seem to
> > for me right now).
> >
> >
> > #!/usr/bin/perl -w
> > use strict;
> >
> > use Test::More tests => 2;
> >
> > BEGIN {
> > use_ok('My::Module'); # contains a package called 'my_mod'
> > };
> > test 'object init' => sub {
> > ok(my $object = my_test_mod->new(),'init');
> > };
> >
> > { package my_test_mod;
> > our @ISA = qw( my_mod );
> > }
> >
>
> It is highly un-recommended to have have a module file which contains
> a differently named package. That is to say your "$LIB/My/Module.pm"
> should contain the package "My::Module".
>
More information about the london.pm
mailing list