On Jan 28, 2004, at 10:32 AM, [EMAIL PROTECTED] wrote:
Hi, this question has to do with importing names from one package into another.[..]
outcome:[..]
--------
This obviously won't work because 'use' expects a module name, not a package name. Same issue with 'require'.
Can't locate SomePackage.pm in @INC (@INC contains: d:/app/xampp/perl/lib D:/app/xampp/perl/lib D:/app/xampp/perl/site/lib .) at test_import.pl line 3.
BEGIN failed--compilation aborted at test_import.pl line 3.
That's it. Any ideas?
first off my complements on the most excellent work so far.
Well there are a couple of basic solutions here.
a. decide the perl modules should be in an external file so that one can simply use the
use SomePackage;
approach that simply requires that the module be external.
b. decide that the 'package' approach needs to be in the perl script itself and adopt the oo-ish type of approach so that one winds up accessing the methods by indirection through say a blessed reference, rather than by importation into the package main.
for more details you might want to
a. pick up the perl modules and reference book. <http://www.oreilly.com/catalog/lrnperlorm/>
b. see my stock rant <http://www.wetware.com/drieux/CS/lang/Perl/PM/quick_pm.html>
Since basically I go with the idea that perl modules really belong as perl modules and then one has a simpler overall management problem. First because then multiple scripts can use the package, then as you so elegantly have demonstrated, because it winds up becomeing so much simpler than trying to work around managing the namespace issues on one's own.
ciao drieux
---
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>