File Coverage

blib/lib/Getopt/Long/Modern.pm
Criterion Covered Total %
statement 16 16 100.0
branch 1 2 50.0
condition 2 3 66.6
subroutine 5 5 100.0
pod n/a
total 24 26 92.3


line stmt bran cond sub pod time code
1             package Getopt::Long::Modern;
2              
3 1     1   13362 use strict;
  1         3  
  1         24  
4 1     1   4 use warnings;
  1         2  
  1         28  
5 1     1   555 use Getopt::Long 'GetOptions';
  1         9313  
  1         6  
6 1     1   224 use Exporter ();
  1         2  
  1         108  
7              
8             our $VERSION = '1.000';
9              
10             our @ISA = 'Exporter';
11             our @EXPORT = 'GetOptions';
12              
13             my @config = qw(default gnu_getopt no_ignore_case);
14              
15             sub import {
16 2     2   7542 my $class = shift;
17 2         132 $class->export_to_level(1);
18 2 50 66     17 shift if @_ and $_[0] eq ':config';
19 2         9 Getopt::Long::Configure(@config, @_);
20             }
21              
22             1;
23              
24             =head1 NAME
25              
26             Getopt::Long::Modern - Use Getopt::Long with modern defaults
27              
28             =head1 SYNOPSIS
29              
30             use Getopt::Long::Modern;
31             GetOptions(
32             "f|foo=i" => \my $foo,
33             "b|bar" => \my $bar,
34             "Z|baz=s" => \my @baz,
35             );
36              
37             =head1 DESCRIPTION
38              
39             L is a simple wrapper of L to reduce the
40             amount of typing needed to get modern defaults, and to avoid having to remember
41             the correct incantations. See L
42             for details on specifying options using L.
43              
44             Only the C function from L is exported. Additional
45             L configuration may be passed as import parameters.
46              
47             use Getopt::Long::Modern qw(auto_help auto_version pass_through);
48              
49             For any more advanced usage, you should probably use L directly.
50             The equivalent L configuration to using this module is:
51              
52             use Getopt::Long qw(:config gnu_getopt no_ignore_case);
53              
54             =head1 DEFAULTS
55              
56             L currently sets the following configuration options by
57             default. See L for more details on
58             available configuration.
59              
60             =head2 gnu_getopt
61              
62             This sets C to allow C<--opt=> for setting an empty string option,
63             C to allow short options to be bundled together, C to allow
64             specifying options before or after other arguments, and C to
65             disallow C<+> for specifying options.
66              
67             =head2 no_ignore_case
68              
69             This makes all options case-sensitive, which is expected and required when
70             explicitly specifying short options of the same character but different case.
71              
72             =head1 BUGS
73              
74             Report any issues on the public bugtracker.
75              
76             =head1 AUTHOR
77              
78             Dan Book
79              
80             =head1 COPYRIGHT AND LICENSE
81              
82             This software is Copyright (c) 2015 by Dan Book.
83              
84             This is free software, licensed under:
85              
86             The Artistic License 2.0 (GPL Compatible)
87              
88             =head1 SEE ALSO
89              
90             L, L, L