in reply to Passing an array between multiple modules?

I'm trying to split the contents of a certain entry in the database into an array, which is then passed to another module, which then passes the array to another module.
I smell a bad design.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

  • Comment on •Re: Passing an array between multiple modules?

Replies are listed 'Best First'.
Re^2: Passing an array between multiple modules?
by Spidy (Chaplain) on Sep 30, 2004 at 02:53 UTC
    Well, there are actions being performed on the array as it passes through each module. Basically, I just need to figure out how to pass it around.

    And it probably is a bad design, but it's what I have to work with right now.
      s/probably is/definitely is/

      In 3 different modules you have 3 things named @stats. They are different. That means that no matter how you're thinking about your code, at least two of them have confusing names. For more detail, see the advice on variable naming in Code Complete II.

      To answer your original question, there are three likely confusions that I can see. One is that you're trying to call functions in another module without calling use or require first. The second is that you've written the module but didn't use the package command to make the module name match the names of its functions. The third is that you've somewhere built up a data structure in a function but forgot to return it.

      Still think about merlyn's design comment. Even if you don't know how to avoid a bad design right now, understanding what he reacted to will help you learn.