in reply to Re: Constants and Subclasses...
in thread Constants and Subclasses...

Does require call the import()? In any case, I was about to answer the Exporter, but I think to make that less sucky you'd want to use EXPORT_OK and/or EXPORT_TAGS instead. So the child class could use them explicitly if it wanted to. That's probably pretty obvious I guess.

But, I always use base qw(Exporter) to get the exporting to actually happen. I've never tried it with require. Does the require work? [update: thanks ferreira]

-Paul

Replies are listed 'Best First'.
Re^3: Constants and Subclasses...
by ferreira (Chaplain) on Dec 18, 2006 at 18:51 UTC

    No, require does not call import(). And you reminded me I wanted to include Exporter in the @ISA array so that the parent class inherited the import() method from Exporter (which is why this module came into the answer). This is almost equivalent to use base qw(Exporter) (but not identical). See the docs of base.

    Also, if the symbols were added to @EXPORT_OK, they should be explicitly mentioned as arguments of import. To keep the answer in line with the question, using @EXPORT is the easiest thing to do.