G'day SuzuBell,

I'm not familiar with Eclipse. I can't you help you with that; however, the problem may not be related to Eclipse.

Your script error "Compilation failed in require" is described in perldiag: as you can see, this is a generic message. I recommend you always use the warnings pragma: use warnings; near the top of your scripts; perl ... -Mwarnings ... -e '...' on the command line. Without knowing what the problem is, I can't tell whether this will provide a more specific message in this instance.

Assuming you're confident that the path to these modules is correctly set up, check that the user running the script has read access to both files.

Next, you should check that the package namespace is correct in both modules and that each module returns a TRUE value (usually just 1; on the last line). They should start and end like this:

package pmFile1; ... 1;
package pmFile2; ... 1;

For your command line example, there's a discrepancy between the code you show ('use pmFile1;' [has ";"]) and the error message you show ("use pmFile1." [has "."]). Perhaps that was just a typo. It's best to actually copy and paste code and output, and put both between <code>...</code> tags. That way, we see a verbatim copy of what you're seeing.

-- Ken


In reply to Re: Error "Compilation failed in require" with "use" syntax by kcott
in thread Error "Compilation failed in require" with "use" syntax by SuzuBell

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.