I am working on an extensive project that heavily exploits object-oriented Perl. Recently I have been having trouble creating objects via the "new" method between the many different modules. Up until now I have been able to use the prefix form of
my $object = new Some::Random::Module();
and everything worked fine. However, after a few module additions, I have been getting this error:
Undefined subroutine &Some::Random::Module called at /perlmodules/Anot +her/Different/Module.pm line 92.
To correct this error I simply have to change my above syntax to
my $object = Some::Random::Module->new();
and everything continues on fine. This error has been continually poping up over the course of today and is trying my patience-- is there a reason why I must use one syntax over another, and is there any technical difference between the two syntaxes?


The collection of modules in the project has many interdependencies between them. I have tried different combinations of use, require and BEGIN, and the problem never completely goes away. Yes, I have checked to make sure that all of the correct files have the appropriate use/require statements in them.

In reply to Perl modules and "new" by mreeske

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.