1AppConfig::Args(3)    User Contributed Perl Documentation   AppConfig::Args(3)
2
3
4

NAME

6       AppConfig::Args - Perl5 module for reading command line arguments.
7

SYNOPSIS

9           use AppConfig::Args;
10
11           my $state   = AppConfig::State->new(\%cfg);
12           my $cfgargs = AppConfig::Args->new($state);
13
14           $cfgargs->parse(\@args);            # read args
15

OVERVIEW

17       AppConfig::Args is a Perl5 module which reads command line arguments
18       and uses the options therein to update variable values in an AppCon‐
19       fig::State object.
20
21       AppConfig::File is distributed as part of the AppConfig bundle.
22

DESCRIPTION

24       USING THE AppConfig::Args MODULE
25
26       To import and use the AppConfig::Args module the following line should
27       appear in your Perl script:
28
29           use AppConfig::Args;
30
31       AppConfig::Args is used automatically if you use the AppConfig module
32       and create an AppConfig::Args object through the parse() method.
33
34       AppConfig::File is implemented using object-oriented methods.  A new
35       AppConfig::Args object is created and initialised using the new()
36       method.  This returns a reference to a new AppConfig::File object.  A
37       reference to an AppConfig::State object should be passed in as the
38       first parameter:
39
40           my $state   = AppConfig::State->new();
41           my $cfgargs = AppConfig::Args->new($state);
42
43       This will create and return a reference to a new AppConfig::Args
44       object.
45
46       PARSING COMMAND LINE ARGUMENTS
47
48       The "parse()" method is used to read a list of command line arguments
49       and update the STATE accordingly.  A reference to the list of arguments
50       should be passed in.
51
52           $cfgargs->parse(\@ARGV);
53
54       If the method is called without a reference to an argument list then it
55       will examine and manipulate @ARGV.
56
57       If the PEDANTIC option is turned off in the AppConfig::State object,
58       any parsing errors (invalid variables, unvalidated values, etc) will
59       generate warnings, but not cause the method to return.  Having pro‐
60       cessed all arguments, the method will return 1 if processed without
61       warning or 0 if one or more warnings were raised.  When the PEDANTIC
62       option is turned on, the method generates a warning and immediately
63       returns a value of 0 as soon as it encounters any parsing error.
64
65       The method continues parsing arguments until it detects the first one
66       that does not start with a leading dash, '-'.  Arguments that consti‐
67       tute values for other options are not examined in this way.
68

FUTURE DEVELOPMENT

70       This module was developed to provide backwards compatibility (to some
71       degree) with the preceeding App::Config module.  The argument parsing
72       it provides is basic but offers a quick and efficient solution for
73       those times when simple option handling is all that is required.
74
75       If you require more flexibility in parsing command line arguments, then
76       you should consider using the AppConfig::Getopt module.  This is loaded
77       and used automatically by calling the AppConfig getopt() method.
78
79       The AppConfig::Getopt module provides considerably extended functional‐
80       ity over the AppConfig::Args module by delegating out the task of argu‐
81       ment parsing to Johan Vromans' Getopt::Long module.  For advanced com‐
82       mand-line parsing, this module (either Getopt::Long by itself, or in
83       conjunction with AppConfig::Getopt) is highly recommended.
84

AUTHOR

86       Andy Wardley, <abw@wardley.org>
87

REVISION

89       $Revision: 1.60 $
90
92       Copyright (C) 1997-2003 Andy Wardley.  All Rights Reserved.
93
94       Copyright (C) 1997,1998 Canon Research Centre Europe Ltd.
95
96       This module is free software; you can redistribute it and/or modify it
97       under the same terms as Perl itself.
98

SEE ALSO

100       AppConfig, AppConfig::State, AppConfig::Getopt, Getopt::Long
101
102
103
104perl v5.8.8                       2007-01-02                AppConfig::Args(3)
Impressum