File Coverage

blib/lib/Getopt/Long/Modern.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 20 100.0


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