package My::OOModule::Derived;
use base qw(Exporter My::OOModule::Base);
However, wouldn't the call to
My::OOModule::Derived->import eventually find
its way up to Exporter via
My::OOModule::Base? Sure it would. So you can
leave that out:
package My::OOModule::Derived;
use base qw(My::OOModule::Base);
Only the base classes at the top of the tree need specify
Exporter and only when they derive from no other
classes.
use URI::URL;
my $u = url("http://www.gilligan.crew.hut/maps/island.pdf");
Because this imported routine isn't a class method,
you don't use the arrow method call to invoke it.
Also, the routine is unlike anything else in the module: no initial
class parameter is passed. Even though normal subroutines and method
calls are both defined as subroutines in the package, the caller and
the author must agree as to which is which.
The url convenience routine was nice, initially.
However, it also clashed with the same-name routine in
CGI.pm, leading to interesting errors (especially
in a mod_perl setting). (The modern interface in
the URI module doesn't export
such a constructor.) Prior to that, in order to prevent a crash, you
had to remember to bring it in as: