http://qs321.pair.com?node_id=1082204

frozenwithjoy has asked for the wisdom of the Perl Monks concerning the following question:

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!