Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

POC/RFC: Changes to Exporter;

by clueless newbie (Chaplain)
on Dec 28, 2010 at 21:03 UTC ( #879511=perlquestion: print w/replies, xml ) Need Help??
clueless newbie has asked for the wisdom of the Perl Monks concerning the following question:

Our shop has a lot of legacy code that uses Exporter and relies more on @EXPORT than @EXPORT_OK. So a program that uses a few inhouse modules may well have had a noiseless name space collision ie (more than one module exports the same name). Since I was a nice boy, Santa brought me something to play with - Exporter. Tinkering resulted in a modified and In Exporter::Heavy the modified sub heavy_export preserves $callpkg, $pkg and $sym in the hash ref $Exporter::Exported. In Exporter a new INIT block checks the symbols in each in-house script/module to see if they were "exported" more than once before terminating. Putting and into a local library allowed me do "perl -I<locallib> <script/module>" ie use this modified exporter.
C:\Exporter>perl -I. Subroutine jkl redefined at line 16. Begin Exporter::CHECK main::abc local <*> One::abc main::def One::def <*> Two::def main::ghi Two::ghi <*> Three::ghi main::jkl Three::jkl <*> local End Exporter::CHECK Exports list has been generated. Exporter will now terminate.
which claims that "main" defined a sub "abc" which was replaced by the "abc" exported by "One". The "def" exported by "One" was replaced by the "def" exported by "Two", etc. (Far more things are exported but we're only interested in the potential collisions.) Would these changes be considered useful enhancements or ?

Replies are listed 'Best First'.
Re: POC/RFC: Changes to Exporter;
by JavaFan (Canon) on Dec 28, 2010 at 21:14 UTC
    Warnings already tells me if I'm importing the same subroutine more than once (and if I were to import explicitly (which I can do regardless whether the exporting module uses @EXPORT or @EXPORT_OK) a visual inspection tells me as well), so I would not consider this a useful enhancement.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://879511]
Approved by BrowserUk
Front-paged by BrowserUk
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2018-06-21 20:03 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (119 votes). Check out past polls.