Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Importing variables (not functions) from in-file packages

by choroba (Cardinal)
on Feb 12, 2014 at 15:46 UTC ( [id://1074638]=note: print w/replies, xml ) Need Help??


in reply to Importing variables (not functions) from in-file packages

The error "... requires explicit package name" is a compile time error. It means Perl was not able to find where the variable was declared when compiling the script. Just put all the packages before the main package and everything will work.
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: Importing variables (not functions) from in-file packages
by puterboy (Scribe) on Feb 12, 2014 at 15:55 UTC
    Thanks. I hadn't realized (and perhaps still don't fully understand) the difference between compile time vs. run time errors for variables and functions. But now that I think of it, I suppose this is consistent with the fact that variables need to be declared ahead of usage (if using strict) while function definitions can follow their usage.

    Is there any analogy to the run-time "BEGIN" to tell the compiler to start (or branch elsewhere)?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-03-19 02:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found