Compilation failed on require

abadi wrote on Fri Nov 25 13:05:49 CET 2005:
Just upgraded to Eclipse 3.11 and Epic 0.3.12, from 3.01 and 0.3.0 on Fedora
Core 3. This went smoothly enough, except that syntax checking seems to
have taken exception to the venerable CPAN module Error.pm. It issues the
complaint 'Compilation failed on require' wherever it is in 'use'. However,
this does not happen if I copy Error.pm to MyError.pm and use it instead.
As our project makes extensive use of Error.pm, this issue is a bit of a
show stopper.

Thanks for your help.
jploski wrote on Fri Nov 25 19:02:39 CET 2005:
I was unable to reproduce it with 3.1.0 and 0.3.12 on Linux. Some suggestions:
run "perl -c yourscript.pl" from terminal to see if it produces any error
messages. Next invoke "Project/Clean..." on the project in Eclipse and wait
until the "Checking Perl syntax" job finishes to see if it clears the error
messages (just opening and saving a single file also re-checks it). The
problem might be also related to the way how EPIC 0.3.12 determines its
@INC path - it basically adds all folders in your project to it; maybe some
other "Error.pm" is getting into your way.
abadi wrote on Mon Nov 28 16:06:59 CET 2005:
Thanks for your quick response.

The project compiles OK from the command line, it is only the Epic syntax
checker that is not quite happy with the code.

I run some tests which indicate that the problem arises when a class is
inheriting from Error.pm and not using it directly, so it appears that @INC
is not at the bottom of it. For the test I defined a class 'Spooler::Error'
and then issued different combinations of 'use' instructions. Here are the
results:

package Spooler::Error;
use strict;
use Error;
use base qw(Error);
1;

RESULT: Compilation failed on require

package Spooler::Error;
use strict;
use Error;
our @ISA = qw(Error);
1;

RESULT: Can't locate package Error for @Spooler::Error::ISA

package Spooler::Error;
use strict;
use Error;
use base qw(MyError);
1;

RESULT: Epic syntax checker happy

package Spooler::Error;
use strict;
use MyError;
use base qw(Error);
1;

RESULT: Compilation failed on require

package Spooler::Error;
use strict;
use MyError;
use base qw(MyError);
1;

RESULT: Epic syntax checker happy

You will need to use Spooler::Error from another class to see the complaints
of the syntax checker.

Thanks again for your help.
abadi wrote on Sun Dec  4 17:30:00 CET 2005:
Jan, if it is of any help, the syntax checker is issuing the same complaint
about IO::Socket. By the way, have you managed to reproduce the problem
using the examples in my previous post?

Thanks.
jploski wrote on Mon Dec  5 19:42:04 CET 2005:
Hi,

I was unable to reproduce the problem using your provided examples. The
first two examples cause no compilation error on my machine (with 0.3.12).
Are you checking them inside of your bigger project or inside of an extra
test project?

The direct route to fixing the problem would be to check out the source
from CVS and try reproducing it in a hosted workbench on an extra copy of
your workspace. If you succeed, then you could set a breakpoint in PerlValidatorBase.java:97
(or somewhere near) to determine the reason of your compilation error.
abadi wrote on Tue Dec  6 18:49:37 CET 2005:
Yes, I have managed to reproduce the problem in a different workspace with
a new project built straight from CVS. However, while testing various combinations,
I found out that building the project within a sub directory of the project
directory (e.g. in '../workspace/project_name/project_name' instead of '../workspace/project_name')
cures the problem. I haven't a clue why...

Again thanks for your help.

Note: The above is an archived snapshot of a forum thread. Use the original thread at sf.net to post comments.