NAME
Getopt::Attribute - Attribute wrapper for Getopt::Long
SYNOPSIS
use Getopt::Attribute;
my $verbose : Getopt(verbose!);
my $all : Getopt(all);
my $size : Getopt(size=s);
my $more : Getopt(more+);
my @library : Getopt(library=s);
my %defines : Getopt(define=s);
sub quiet : Getopt(quiet) { our $quiet_msg = 'seen quiet' }
usage() if my $man : Getopt(man);
...
# Meanwhile, on some command line:
mypgm.pl --noverbose --all --size=23 --more --more --more --quiet
--library lib/stdlib --library lib/extlib
--define os=linux --define vendor=redhat --man -- foo
DESCRIPTION
This module provides an attribute wrapper around `Getopt::Long'. Instead
of declaring the options in a hash with references to the variables and
subroutines affected by the options, you can use the `Getopt' attribute
on the variables and subroutines directly.
As you can see from the Synopsis, the attribute takes an argument of the
same format as you would give as the hash key for `Getopt::Long'. See
the `Getopt::Long' manpage for details.
Note that since attributes are processed during CHECK, but assignments
on newly declared variables are processed during run-time, you can't set
defaults on those variables beforehand, like this:
my $verbose : Getopt(verbose!) = 1; # DOES NOT WORK
Instead, you have to establish defaults afterwards, like so:
my $verbose : Getopt(verbose!);
$verbose ||= 1;
BUGS
None known so far. If you find any bugs or oddities, please do inform
the author.
AUTHOR
Marcel Grunauer, <[EMAIL PROTECTED]>
COPYRIGHT
Copyright 2001 Marcel Grunauer. All rights reserved.
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
SEE ALSO
perl(1), Getopt::Long(3pm), Attribute::Handlers(3pm).
Marcel
--
We are Perl. Your table will be assimilated. Your waiter will adapt to
service us. Surrender your beer. Resistance is futile.
-- London.pm strategy aka "embrace and extend" aka "mark and sweep"