Andrew P's test program does indeed "work" with Perl 5.8.0
on both Unix and Windows with a test name of 'sample.t' in
THDriver.pl, yet changing it to './sample.t' results in a
failure of: Can't call method "SUPER::runtests" without a
package or object reference. But why?

The snippet below (tested with Perl 5.8.0) is hopefully a
simplified example. Can anyone explain what is going on?

----------snip-----------snip-----------snip-----------------------
#!/usr/bin/perl
use strict;
use warnings;

sub my_fn { print "in sub my_fn, args='@_'\n" }

# This happily calls my_fn(): the parameters received by my_fn are
# 'sample.t' and 'def'. But why?

'sample.t'->main::my_fn('def');

# ... yet this fails with: Can't call method "main::my_fn" without
# a package or object reference

'./sample.t'->main::my_fn('def');

# And this fails with: Can't locate object method "my_fn" via
# package "sample.t" (perhaps you forgot to load "sample.t"?)

'sample.t'->my_fn('def');
----------snip-----------snip-----------snip-----------------------

/-\



http://personals.yahoo.com.au - Yahoo! Personals
-  New people, new possibilities! Try Yahoo! Personals, FREE for a limited period!

Reply via email to