in reply to Module Inheritance

You may need to demonstrate more code as that should work fine e.g
shell> cat Hoos.pm package Hoos; our @EXPORT = 'testsub'; use Exporter; our @ISA = 'Exporter'; sub testsub { print "exported testsub() ok\n" } 1; shell> perl -e 'use Hoos; testsub()' exported testsub() ok
So there we've set up Exporter to export testsub whenever Hoos is used. Also, you should require Exporter as useing it calls its own import method.
HTH

_________
broquaint

Replies are listed 'Best First'.
Re: Module Inheritance
by Abigail-II (Bishop) on Apr 29, 2004 at 13:00 UTC
    So there we've set up Exporter to export testsub whenever Hoos is used. Also, you should require Exporter as useing it calls its own import method.
    A populair belief, but not true. Sure, using 'require' prevents the import() method to be called, but that's not the only way.
    use Exporter (); # Don't call import!
    Less characters to type, and it gets dealt with at compile time. Why bother with require?

    Abigail

      A populair belief, but not true.
      Well, it is true. You know that. It doesn't magically not call import.
      Less characters to type, and it gets dealt with at compile time. Why bother with require?
      It's one less character to type and in modules the likes of require Exporter are being implicitly being handled at compile-time anyhow (assuming they've been useed). As for the 'Why', force of habit I guess. I generally do use Module () if I don't want import to be invoked but make an exception for require Exporter. C'est la vie.
      HTH

      _________
      broquaint

        Well, it is true.
        It's not. It's not true that you should use require to prevent import to be called. It's just one way of doing so.

        As for the 'Why', force of habit I guess.
        To me it smells like cargo-cult.

        Abigail