Code Comments
Programming Forum and web based access to our favorite programming groups.i have 4 packages:
PackageA
use IO::File;
require My::Utils::Reader
PackageB
use IO::File;
use XML::Writer;
My::Utils::Reader
use My::Utils;
My::Utils
use Exporter;
in my perl program, i dynamically load PackageA and PackageB like this:
eval("require $package_name1");
eval("require $package_name2");
my question is why does PackageA have to "require My::Utils::Reader" instead
of "use My::Utils::Reader"? PackageB dynamically loads fine and it "uses"
other packages. in fact, every package i list here uses "use" instead of
require. why is there an exception for PackageA and "require
My::Utils::Reader"?
thanks for the help.
Post Follow-up to this message>>>>> "Christopher" == Christopher J Bottaro <cjbottaro@alumni.cs.utexas.edu > writes: Christopher> My::Utils Christopher> use Exporter; Do you have "@ISA = Exporter" too? Much easier to write this as use base 'Exporter'; This might be why it needs to be require'd instead of use'd. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training !
Post Follow-up to this messageheh, that was it, thanks a bunch. Randal L. Schwartz wrote: > > Christopher> My::Utils > Christopher> use Exporter; > > Do you have "@ISA = Exporter" too? Much easier to write this as > > use base 'Exporter'; > > This might be why it needs to be require'd instead of use'd. >
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.