in reply to Re^4: Can I retry "use" when module load fails?
in thread Can I retry "use" when module load fail ?

Actually, you DO need to call the "import" method, in order to inject the "exported" methods and variables into your (main) namespace.

Exporter documentation explains this :

The Exporter module implements an import method which allows a module to export functions and variables to its users' namespaces.

             "I'm fairly sure if they took porn off the Internet, there'd only be one website left, and it'd be called 'Bring Back the Porn!'"
        -- Dr. Cox, Scrubs

  • Comment on Re^5: Can I retry "use" when module load fails?

Replies are listed 'Best First'.
Re^6: Can I retry "use" when module load fails?
by exilepanda (Friar) on Apr 15, 2013 at 06:57 UTC
    So you mean even I don't have sub import in my module, but I still have to call ->import() for once after my require statement, so that Exporter can export?
      Yes. When you use Exporter in a module, it inherits a standard ->import() sub from Exporter, so your module does then have an import method even though you didn't define it yourself.

      All Exporter really does is make symbols available to be imported. Nothing actually happens until the useing module calls import to specify which of the available symbols it wants to import. (e.g., use POSIX 'ceil'; to import only the ceil symbol from POSIX.)

        Big Thanks!! Didn't realize there can be an inherit tricks inside, I got it now! =)