I have a Perl module that appears to compile fine by itself, but is causing other programs to fail compilation when it is included:
me@host:~/code $ perl -c -Imodules modules/Rebat/Store.pm
modules/Rebat/Store.pm syntax OK
me@host:~/code $ perl -c -Imodules bin/rebat-report-status
Attempt to reload Rebat/Store.pm aborted
Compilation failed in require at bin/rebat-report-status line 4.
BEGIN failed--compilation aborted at bin/rebat-report-status line 4.
The first few lines of rebat-report-status are
...
3 use Rebat;
4 use Rebat::Store;
5 use strict;
...
Edit (for posterity): Another reason for this to occur, and perhaps the most common reason, is that there is a circular dependency among the modules you are using.
Look in
Rebat/Store.pmfor clues. Your log says attempt to reload was aborted. MaybeRebatalready importsRebat::Store, andRebat::Storehas some package-scope check against being loaded twice.This code demonstrates the kind of situation I mean:
The code will compile (and print 42) if you just remove the
use M1::M2line inm1.pl. In your case, you might not need to explicitlyuse Rebat::Storein your program.