in reply to Recursive use causes subroutine redefinition
Nothing is wrong with your recursive uses; the problem is that you are also loading Foo.pm as a script, bypassing the multiple load checks that exist for require or use.
The same thing happens without the recursion:
If you are going to use the same file both via use or require and as a main script or via do, you should manually put a "BEGIN { $INC{Module.pm} ||= __FILE__ }" in Module.pm before any possible use/require.$ cat>Baz.pm package Baz; use strict; use warnings; use Baz; sub baz { } 1; $ perl Baz.pm Subroutine baz redefined at Baz.pm line 5.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Recursive use causes subroutine redefinition
by prowler (Friar) on Sep 08, 2004 at 14:38 UTC |
In Section
Seekers of Perl Wisdom