NAME

P4::Getopt - Get P4 command line options

SYNOPSIS

use P4::Getopt;

my $opt = new P4::Getopt;
$opt->parameter (qw( -u username ));

@ARGV = $opt->parameter (@ARGV);
...
=head1 DESCRIPTION

The P4::Getopt package provides standardized handling of global options for the front of P4 commands.

$opt = P4::Getopt->new ( opts )

Create a new Getopt.

$self->get_parameter ( )

Returns a list of parameters that when passed through $self->parameter() should result in the same state. Often this is used to form command lines for wrappers that want to call p4 underneath themselves.

$self->parameter ( \@params )

Parses any recognized parameters in the referenced array, removing the standard parameters and returning a array with all unparsed parameters.

The below list shows the parameters that are supported, and the functions that are called:

-c <client>      client
-d <pwd>	     pwd
-H <host>        host
-p <port>        port
-P <password>    password
-s               script (set true)
-u <user>        user
-C <charset>     charset
-n               noop (set true)    CVS compatible option

-x <file>        Read given file and parse args automatically

ACCESSORS

There is a accessor for each parameter listed above. In addition:

$self->fileline()

The filename and line number last parsed.

$self->parseCmd(<cmd>, <opts>)

Return a array with one element for each option. The element is either 'switch', the name of the switch the option is specifying, or the name of the parameter.

$self->hashCmd(<cmd>, <opts>)

Return a hash with one key for each option. The value of the key is 1 if a no-argument option was set, else it is an array with each value the option was set to.

$self->setClientOpt(<P4::Client>)

Set the client, port, and password based on the options.

$self->stripOneArg(-<arg>, <opts>...)

Return the option list, with the specified matching argument removed.

DISTRIBUTION

The latest version is available from CPAN and from http://www.veripool.com/.

Copyright 2002-2004 by Wilson Snyder. This package is free software; you can redistribute it and/or modify it under the terms of either the GNU Lesser General Public License or the Perl Artistic License.

AUTHORS

Wilson Snyder <wsnyder@wsnyder.org>

SEE ALSO

P4::C4