in reply to Error "Compilation failed in require" with "use" syntax

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

Replies are listed 'Best First'.
Re^2: Error "Compilation failed in require" with "use" syntax
by SuzuBell (Acolyte) on Oct 03, 2013 at 22:22 UTC
    Thanks Ken. Sorry for a slow reply.

    1) I added the use warnings;

    2) I checked that the user (me) has read access to both files (At least, I right-clicked on their icon in Package Explorer of Eclipse, and saw that all three groups - Owner, Group, Other - had "Read" checked)

    3) I do not know how to check the package namespace is correct in both files. I tried typing "package pmFile1;" into command line terminal but did not get a return value of 1. (I do not use terminal and command line much, I am sorry.) Could you tell me more specifically how I can check this?

    Thanks again

      You seem to have very limited knowledge about your operating system and Perl. I suggest you look at the following:

      "3) I do not know how to check the package namespace is correct in both files."

      Just look at the code.

      -- Ken