Consider this structure:
Generate[.pl]
pm/Foo.pm
pm/Bar.pm
Generate is using both Foo and Bar:
use Foo;
use Bar;
Foo also uses Bar. If I put 'use Bar;' in Foo, however, I get:
ServerDude-2:/www/cgi/jenny rip$ ./Generate types
Subroutine LWXBar redefined at pm/Bar.pm line 73.
Undefined subroutine &Foo::LWXBar called at pm/Foo.pm line 116.
ServerDude-2:/www/cgi/jenny rip$
So, in one run, it is complaining that the undefined sub has been redefined.
If I leave the 'use Bar;' out of Foo.pm, then it simply dies with the undefined sub &Foo::LWXBar() message.
I can fqualify &Bar::LWXBar() in Foo.pm and it works:
ServerDude-2:/www/cgi/jenny rip$ ./Generate types
Undefined subroutine &main::LWXBar called at ./Generate line 89.
ServerDude-2:/www/cgi/jenny rip$
As you can see it has now proceeded beyond the &Bar::LWXBar() in Foo, but it's tanked in the main script, again with an undefined LWXBar sub.
If I try to fqualify it in the main script, I get
ServerDude-2:/www/cgi/jenny rip$ ./Generate types
Undefined subroutine &Bar::LWXBar called at ./Generate line 89.
Thoughts? Suggestions?
BTW, I have a third module, pm/Baz.pm. It also uses LWXBar -- unqualified -- without any trouble at all.
All three modules use BEGIN blocks to set 'use Exporter ()', as copied (and massaged) from the Perl docs (this is "Foo":
BEGIN {
use Exporter ();
our ($VERSION, @ISA, @EXPORT);
# set the version for version checking
$VERSION = "01.f";
@ISA = qw(Exporter);
@EXPORT = qw(&GeneratorConfig &Generate
&GetWidthFromType &GetWidthFromFormat);
}
(MacOS 4.11, perl v5.8.8 darwin-2level)
Am I missing something fundamental?
Thanks for any comments,
rip
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.