First off I need to admit when it comes to modules I am dumb as a brick. That having been said, I have a friend who is developing an application for a project we are working on. I am co-developing. He is doing something that I have never seen before and am still a little bit weary of it. Admittedly, I am weary not because I can think of an adversity to using this method but that I am simply not used to this.

What he is doing is modularizing. This is good except that every module he's creating he's calling it 'package main;' essentially (I believe) placing every module as a piece of the calling main body. Ok, in theory this is what sounds like is happening, however, I am running into a snag.

Whenever I try to edit my piece of the pie and then execute it, my subs get compiled and *run*!!! thus failing because, well, nothing is being passed to them yet, or in other words, a bunch of undefs are being seen hence unitialized variables in the symbol table when I try to do something in the sub with a variable. Technically, though, I'd think that nothing should be being done with these subs yet anyway. At least not until the main body calls my code. *shrug*. Im not sure. I've read the docs but I must either be missing something or the package main; being placed at the top of every module is throwing me off.

Any foresight would be greatly appreciated!

TIA

_ _ _ _ _ _ _ _ _ _
- Jim
Insert clever comment here...

2002-04-21 Edit by Corion - moved from Meditation to SoPW


In reply to A lil module creation advice by snafu

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.