Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Importing vars from one script to another

by BillKSmith (Vicar)
on Dec 11, 2012 at 23:03 UTC ( #1008419=note: print w/replies, xml ) Need Help??


in reply to Importing vars from one script to another

Your 'constants' are not constants at all, but normal global variables. They should work as shown. In order to satisify warnings, I had to add a use Lib '.'; to your main script to let perl find the constants.pl file. I also had to add a final 1 to the constants.pl file.

I recommend using the Readonly module to make all the constants truly constant.

Bill

Replies are listed 'Best First'.
Re^2: Importing vars from one script to another
by edbewald (Beadle) on Dec 11, 2012 at 23:52 UTC

    That did it! I thought I had tried everything but I was missing the '1'. Now it works.

    And I agree 100% that these are hardly constants. I usually use Readonly module for that and will do so with this.

    Thanks for all the answers everyone gave. I really appreciate it

      That did it! I thought I had tried everything but I was missing the '1'. Now it works.
      Whatever was the reason, this one can't be it.

      If you require a file, the last expression in the included file must return a value which evaluates to true, otherwise your program dies. Therefore: If you had a value which evaluated to false in your earlier version, your program would not have executed, and you would have got an error message pointing out the problem. But if it already evaluated to true in your earlier version, adding a 1 doesn't change anything.

      -- 
      Ronald Fischer <ynnor@mm.st>

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1008419]
help
Chatterbox?
[Eily]: LanX well since the onion is your eye you should see it everywhere
[marto]: sounds eye watering
[LanX]: oh your talking about my pic?
[Eily]: marto #SoSad
[holli]: duh
[marto]: I expect you to take a nice photo in Glasgow to replace this one :P
[Eily]: LanX yup, saw it when I checked your current rank
[LanX]: obviously the message is not clear enough if you only notice the onion now. ...
[Eily]: might have noticed before and forgotten
LanX has ideas for more similar pics

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (13)
As of 2017-12-14 16:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (398 votes). Check out past polls.

    Notices?