in reply to Variable declaration in 'required' file doesn't work under 'strict'?

Lexical (i.e. "my") variables have file scope if you declare them outside any brackets. Basically, you can't directly access lexical variables in another file.

If you really want to do this, you should use global variables instead. (I.e. use "our" instead of "my")

  • Comment on Re: Variable declaration in 'required' file doesn't work under 'strict'?

Replies are listed 'Best First'.
Re^2: Variable declaration in 'required' file doesn't work under 'strict'?
by punch_card_don (Curate) on Mar 11, 2007 at 21:07 UTC
    Thanks for the suggestion.

    Just did a "search and replace" on my config file, replacing all "my" with "our", and re-ran it.

    Same thing. With the declarations in the config file => non-declaration error messages. Copy and paste the declarations to the main script, runs fine.

    Hmmm...




    Forget that fear of gravity,
    Get a little savagery in your life.