# appconfig-error.pl --config xyz 123 abc
\n\tARGV: --config xyz 123 abc
\n\targvCopy: --config xyz 123 abc
\n\tafter args() ARGV: --config xyz 123 abc # @ARGV is still complete
\n\tafter getopt() ARGV: 123 abc # @ARGV has bits missing <\/code><\/p>\n
\nThis is a problem because I need to call getopt() twice — once to get at the –config option, then I read the configuration file with the file() method, then I re-read the command line options so that they override the ones in the configuration file.<\/p>\n
Using args() is OK — @ARGV is preserved — but I need the extra feature of getopt().<\/p>\n
I've emailed the author, so I'll wait to see what his reply is.<\/p>\n","protected":false},"excerpt":{"rendered":"
I've been playing with the Perl AppConfig module (http:\/\/search.cpan.org\/~abw\/AppConfig-1.66\/lib\/AppConfig.pm) It seems that the getopt() method messes up the global @ARGV array even if I pass it a copy. For example: #!\/usr\/bin\/perl use strict; use warnings; use AppConfig; my $opts = AppConfig->new( { CASE => 0, } ); $opts->define('config=s', {DEFAULT => ''}); print "ARGV: @ARGVn"; […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7,46,29],"tags":[],"_links":{"self":[{"href":"https:\/\/wp.fbcs.co.uk\/wp-json\/wp\/v2\/posts\/408"}],"collection":[{"href":"https:\/\/wp.fbcs.co.uk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.fbcs.co.uk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.fbcs.co.uk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.fbcs.co.uk\/wp-json\/wp\/v2\/comments?post=408"}],"version-history":[{"count":0,"href":"https:\/\/wp.fbcs.co.uk\/wp-json\/wp\/v2\/posts\/408\/revisions"}],"wp:attachment":[{"href":"https:\/\/wp.fbcs.co.uk\/wp-json\/wp\/v2\/media?parent=408"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.fbcs.co.uk\/wp-json\/wp\/v2\/categories?post=408"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.fbcs.co.uk\/wp-json\/wp\/v2\/tags?post=408"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}