http://www.perlmonks.org?node_id=727113


in reply to Circular dependencies when using the perl syntax checker

This is a bit of a late post, but I've just stumbled on this thread because I had the same problem. Other posts explained the cause of it, so I won't go into that. I'd just like to point out a workaround which seems to work for me: Say, we have module Foo which resides in its own file Foo.pm. You can put the following code right below the package statement.

BEGIN { $INC{"Foo.pm"} ||= __FILE__ }

Essentially, this forces an entry in %INC when the file is compiled. Use with care.

Cheers,
Steffen

Replies are listed 'Best First'.
Re^2: Circular dependencies when using the perl syntax checker
by rlucas (Scribe) on Nov 14, 2009 at 02:22 UTC
    I had this specific problem with Class::MethodMaker as well. Perhaps because I had my files inside of subdirs (e.g. My::Module in My/Module.pm), Steffen's fix didn't work. I had to take another step, and make sure I had the filename just so:

    BEGIN { use strict; use File::Spec; $INC{"My/Module.pm"} ||= File::Spe +c->rel2abs(__FILE__); }

    (OK, the "use strict" is just a bit of belt-and-suspenders ;)