blib/lib/Getopt/Long/Modern.pm

filter: Statementstmt 100% 20 / 20 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 100% 25 / 25 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
↑ Summary
1 package Getopt::Long::Modern;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Getopt::Long 'GetOptions';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Exporter ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 our $VERSION = '0.004';
9  
10 1 our @ISA = 'Exporter';
11 1 our @EXPORT = 'GetOptions';
12  
13 1 my @config = qw(default gnu_getopt no_auto_abbrev no_ignore_case);
14  
15 sub import {
16 2 ▶ my $class = shift;
Subroutine import: called CC=1 SCAR=0.0
17 2 $class->export_to_level(1, $class, 'GetOptions');
18 2 Getopt::Long::Configure(@config, @_);
19 }
20  
21 1 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<Getopt::Long::Modern> is a simple wrapper of L<Getopt::Long> to reduce the
39 amount of typing needed to get modern defaults, and to avoid having to remember
40 the correct incantations. See L<Getopt::Long/"Summary of Option Specifications">
41 for details on specifying options using L<Getopt::Long>.
42  
43 Only the C<GetOptions> function from L<Getopt::Long> is exported. Additional
44 L<Getopt::Long> 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<Getopt::Long> directly.
49  
50 =head1 DEFAULTS
51  
52 L<Getopt::Long::Modern> currently sets the following configuration options by
53 default. See L<Getopt::Long/"Configuring Getopt::Long"> for more details on
54 available configuration.
55  
56 =head2 gnu_getopt
57  
58 This sets C<gnu_compat> to allow C<--opt=> for setting an empty string option,
59 C<bundling> to allow short options to be bundled together, C<permute> to allow
60 specifying options before or after other arguments, and C<no_getopt_compat> 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 <dbook@cpan.org>
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<Getopt::Long::Descriptive>, L<Getopt::Again>, L<Opt::Imistic>
↑ Summary