Getopt-Long-Subcommand

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

        the result hash (being built). So the arguments that the coderefs
        get is:

         ($callback, $value, $res)

FAQ
  How to avoid modifying @ARGV? How to process from another array, like Getopt::Long's GetOptionsFromArray?
    Instead of adding another function, you can use "local".

     {
         local @ARGV = ['--some', 'value'];
         GetOptions(...);
     }
     # the original @ARGV is restored

HOMEPAGE
    Please visit the project's homepage at
    <https://metacpan.org/release/Getopt-Long-Subcommand>.

SOURCE
    Source repository is at

lib/Getopt/Long/Subcommand.pm  view on Meta::CPAN


=back

=head1 FAQ

=head2 How to avoid modifying @ARGV? How to process from another array, like Getopt::Long's GetOptionsFromArray?

Instead of adding another function, you can use C<local>.

 {
     local @ARGV = ['--some', 'value'];
     GetOptions(...);
 }
 # the original @ARGV is restored

=head1 HOMEPAGE

Please visit the project's homepage at L<https://metacpan.org/release/Getopt-Long-Subcommand>.

=head1 SOURCE

t/01-basic.t  view on Meta::CPAN

#!perl

use 5.010001;
use strict;
use warnings;
use Test::More 0.98;

use Getopt::Long::Subcommand;

subtest "basics" => sub {
    local @ARGV;
    my @output;

    my @spec = (
        summary => 'Program summary',
        options => {
            'help|h|?' => {
                summary => 'Display help',
                handler => sub { push @output, 'General help message' },
            },
            'version|v' => {

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.921 second using v1.00-cache-2.02-grep-82fe00e-cpan-c9a218a2bbc )