testing

Christopher Jones c.jones at ucl.ac.uk
Mon Nov 3 13:43:56 GMT 2008


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 );
}




Chris



Gynaecological Cancer Research Laboratories,
UCL EGA Institute for Women's Health,
University College London,
Paul O'Gorman Building,
72 Huntley Street,
London WC1E 6DD
United Kingdom

Telephone: 020 3108 2007





More information about the london.pm mailing list