Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^4: Sub calling sadness

by nefigah (Monk)
on Mar 08, 2008 at 08:09 UTC ( #672951=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Sub calling sadness
in thread Sub calling sadness

Fair enough, here it all is, shortened as short as possible:

Contents of MyFile.pm

#!/usr/bin/env perl use warnings; use strict; use feature ':5.10'; package ThatPackage; sub parse { } # Yep, even empty the error occurs, because it never eve +n gets as far as calling it
Contents of unit_test.pl
#!/usr/bin/env perl -w use feature ':5.10'; use Test::More 'no_plan'; require 'MyFile.pm'; my $foo = "blah"; my $bar = " blah"; ok( ThatPackage::parse $foo, " this is a test" ); # fine, test doesn't + pass but runs fine ok( ThatPackage::parse($bar), " this is a test" ); # also fine ok( ThatPackage::parse $bar, " this is a test" ); # error here: 'Can't + call method "ThatPackage::parse" without a package or object referen +ce at unit_test.pl line 43.'


Comment on Re^4: Sub calling sadness
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://672951]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (13)
As of 2015-07-28 09:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (254 votes), past polls