Problems? Is your data what you think it is? | |
PerlMonks |
Prototypes being ignored with use_ok() from Test:More ?by JPMH (Novice) |
on Nov 13, 2012 at 16:08 UTC ( [id://1003647]=perlquestion: print w/replies, xml ) | Need Help?? |
JPMH has asked for the wisdom of the Perl Monks concerning the following question:
I've got some weirdness I don't understand when I load a module with Test::More's use_ok()
I was using an array-reference prototype to pass an array by reference without the module user having to fuss about it -- but when I load the module with Test::More's use_ok() all the prototypes seem to be getting ignored. What is it I'm missing ? Here's a cut-down example module, CST2.pm: and a calling script,
With use CST2 everything works fine. But if I change to BEGIN:{ use_ok('CST2'); }, then I get an error: 'Can't use string ("one") as an ARRAY ref while "strict refs" in use at CST2.pm line 12.' To make the error go away, I have to change the call in the script to explicitly pass a reference my $count = ArrayCount(\@patternList); Why is this happening? What is it I've missed, and should have done differently? For what it's worth, perl --version tells me I'm running perl 5, version 14, subversion 2 (v5.14.2) built for cygwin-thread-multi-64int (with 7 registered patches, see perl -V for more detail); and it's version 0.98 of Test::More Thanks in advance, JH.
Back to
Seekers of Perl Wisdom
|
|