in reply to Sharing Variables and Routines between modules

add use My::Globals (and so) to every package that use it. Otherwise you will be in trouble if you forgot to use it in main script :-)
  • Comment on Re: Sharing Variables and Routines between modules

Replies are listed 'Best First'.
Re^2: Sharing Variables and Routines between modules
by Anonymous Monk on Nov 01, 2010 at 18:45 UTC
    I thought about that but then I end up cross-using modules.

    package My::Database;
    use My::Globals;
    use My::Package_A;
    use My::Package_B;
    ------------------
    package My::Globals;
    use My::Database;
    use My::Package_A;
    use My::Package_B;
    --------------------
    etc.etc
    Then when I want to add My::Package_C I have to go through every single module and add it to the list...
      Globals requires Package_A ?
      package My::Package_A; use My::Globals; use My::Database;
      and so on ...