Hello,
I am greatly simplifying the description of this problem. I believe the best solution would be to fix the "old code", but there is so much of it that this is not feasible.
I have 2 packages:
packageA.pm:
package PackageA;
require "libraries/somelib.pl";
... variables, functions, etc
1;
packageB.pm:
package PackageB;
require "libraries/somelib.pl"; #NOTE: Same library as included in pac
+kageA
... variables, functions, etc
1;
.. Now I want to use both of these packages in a script:
#!/usr/bin/perl -w
use strict;
use PackageA;
use PackageB;
The problem is that the require in packageB never got executed. None of the functions or variables in somelib.pl exist within that namespace.
Is there some reasonable solution to this problem? Again, I feel compelled to mention that the problem is far bigger then this small example I have show here. If the real world were this small I would just change somelib.pl into a module or something appropriate along those lines.
I have tried using "do"s, but unfortunately many of these libraries "require" other libraries which creates a situation where adding a "do" to one package can actually break another package because although the "do" is executed, none of the requires within the "done" file are..
I hope this makes sense!
- Greg
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.