Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: Undefined Subroutine & Global symbol requires explicit package name

by tobyink (Canon)
on Jan 24, 2012 at 16:48 UTC ( [id://949727]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    # this code is in Foo/Bar.pm
    package Foo::Bar;
    ...
    our @EXPORT = qw/baz/;
    sub baz { "Hello world"; }
    1;
    
  2. or download this
    use 5.010;
    use strict;
    use foo::bar;
    say Foo::Bar::baz(); # says "Hello world"
    
  3. or download this
    use 5.010;
    use strict;
    use Foo::Bar;
    say baz(); # says "Hello world"
    
  4. or download this
    use 5.010;
    use strict;
    use foo::bar;
    say baz(); # dies - undefined subroutine main::baz
    
  5. or download this
    use 5.010;
    use strict;
    use foo::bar;
    say foo::bar::baz(); # dies - undefined subroutine again
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-24 19:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found