use vs. require in modules

From: Christopher J. Bottaro (cjbottaro_at_alumni.cs.utexas.edu)
Date: 08/04/04


To: beginners@perl.org
Date: Wed, 04 Aug 2004 12:02:52 -0500

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.