I'm working on a project that needs to access @ARGV before anything else does. I figured I'd add a subroutine that checks for potential conflicts and issues a warning if any of the more popular modules that access/modify @ARGV are loaded at the time my module is imported.

I know that it isn't feasible to list/check all potentially conflicting modules (see @conflicts below). Nevertheless, I'd like to come up with a decent list of popular/commonly used modules that touch @ARGV. What are your favorites?

This code identifies modules loaded both directly and indirectly (i.e., as dependencies). It works fine and I'm not asking for help with it (but I certainly won't turn away any comments/suggestions):

use Module::Loaded; sub _check_for_conflicts { my @conflicts = qw(AppConfig Getopt::Args Getopt::Long Getopt::Simple Getopt +::Std); my @loaded; for (@conflicts) { push @loaded, $_ if defined is_loaded($_); } if ( scalar @loaded > 0 ) { print STDERR <<EOF; WARNING: A module that accesses '\@ARGV' has been loaded before Log::Reproducib +le. To avoid potential conflicts, we recommended changing your script such that Log::Reproducible is imported before the following module(s): EOF print STDERR " $_\n" for sort @loaded; print STDERR "\n"; } }

Thanks all!


In reply to What are (popular) modules that access/modify @ARGV? by frozenwithjoy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.