Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

getopt::usaginator(3pm) [debian man page]

Getopt::Usaginator(3pm) 				User Contributed Perl Documentation				   Getopt::Usaginator(3pm)

NAME
Getopt::Usaginator - Conjure up a usage function for your applications VERSION
version 0.0012 SYNOPSIS
use Getopt::Usaginator <<_END_; Usage: xyzzy <options> --derp Derp derp derp --durp Durp durp durp -h, --help This usage _END_ # The 'usage' subroutine is now installed ... $options = parse_options( @ARGV ); # Not supplied by Usaginator usage if $options{help}; # Print usage and exit with status 0 if ( ! $options{derp} ) { # Print warning and usage and exit with status -1 usage "You should really derp"; } if ( $options{durp} ) { # Print warning and usage and exit with status 2 usage 2 => "--durp is not ready yet"; } ... usage 3 # Print usage and exit with status 3 DESCRIPTION
Getopt::Usaginator is a tool for creating a handy usage subroutine for commandline applications It does not do any option parsing, but is best paired with Getopt::Long or any of the other myriad of option parsers USAGE
use Getopt::Usaginator <usage> Install a "usage" subroutine configured with the <usage> text $code = Getopt::Usaginator->usaginator( <usage> ) Return a subroutine configured with the <usage> text ... More advanced usage is possible, peek under the hood for more information perldoc -m Getopt::Usaginator An example: use Getopt::Usaginator # Called with the error error => sub { ... }, # Called when usage printing is needed usage => sub { ... }, ... ; An example with Getopt::Long parsing use Getopt::Usaginator ... sub run { my $self = shift; my @arguments = @_; usage 0 unless @arguments; my ( $help ); { local @ARGV = @arguments; GetOptions( 'help|h|?' => $help, ); } usage 0 if $help; ... } AUTHOR
Robert Krimen <robertkrimen@gmail.com> COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by Robert Krimen. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.10.1 2010-06-05 Getopt::Usaginator(3pm)

Check Out this Related Man Page

Getopt::Long::Descriptive::Usage(3)			User Contributed Perl Documentation		       Getopt::Long::Descriptive::Usage(3)

NAME
Getopt::Long::Descriptive::Usage - the usage description for GLD VERSION
version 0.096 SYNOPSIS
use Getopt::Long::Descriptive; my ($opt, $usage) = describe_options( ... ); $usage->text; # complete usage message $usage->die; # die with usage message DESCRIPTION
This document only describes the methods of the Usage object. For information on how to use Getopt::Long::Descriptive, consult its documentation. METHODS
new my $usage = Getopt::Long::Descriptive::Usage->new(\%arg); You really don't need to call this. GLD will do it for you. Valid arguments are: options - an arrayref of options leader_text - the text that leads the usage; this may go away! text This returns the full text of the usage message. leader_text This returns the text that comes at the beginning of the usage message. option_text This returns the text describing the available options. warn This warns with the usage message. die This throws the usage message as an exception. $usage_obj->die(\%arg); Some arguments can be provided pre_text - text to be prepended to the usage message post_text - text to be appended to the usage message The "pre_text" and "post_text" arguments are concatenated with the usage message with no line breaks, so supply this if you need them. AUTHORS
o Hans Dieter Pearcey <hdp@cpan.org> o Ricardo Signes <rjbs@cpan.org> COPYRIGHT AND LICENSE
This software is copyright (c) 2005 by Hans Dieter Pearcey. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.18.2 2013-10-04 Getopt::Long::Descriptive::Usage(3)
Man Page