Getopt::Attribute - Attribute wrapper for Getopt::Long

      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: --noverbose --all --size=23 --more --more --more --quiet
               --library lib/stdlib --library lib/extlib
               --define os=linux --define vendor=redhat --man -- foo

    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;

    None known so far. If you find any bugs or oddities, please do inform
    the author.

    Marcel Grunauer, <[EMAIL PROTECTED]>

    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.

    perl(1), Getopt::Long(3pm), Attribute::Handlers(3pm).


We are Perl. Your table will be assimilated. Your waiter will adapt to
service us. Surrender your beer. Resistance is futile.
 -- strategy aka "embrace and extend" aka "mark and sweep"

Reply via email to