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 Exporter.pm and Exporter::Heavy.pm. 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 Exporter.pm and Exporter::Heavy.pm into a local library allowed me do "perl -I<locallib> <script/module>" ie use this modified exporter.
C:\Exporter>perl -I. test_03.pl
Subroutine jkl redefined at test_03.pl 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 ?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.