blib/lib/Getopt/Alt/Command.pm

filter: Statementstmt 83.3% 20 / 24 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 80.0% 4 / 5 Podpod n/a totaltotal 55.8% 24 / 43 CC 5 SCAR 28.4
CC
5
Cov
59%
__ANON__
30.0
BEGIN
1.0
BEGIN
1.0
CRAP 17.1
« blib/lib/Getopt/Alt/Option.pm ↑ Summary blib/lib/Getopt/Alt.pm »
1 package Getopt::Alt::Command;
2  
3 # Created on: 2010-03-25 18:04:47
4 # Create by: Ivan Wills
5 # $Id$
6 # $Revision$, $HeadURL$, $Date$
7 # $Revision$, $Source$, $Date$
8  
9 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use version;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use English qw/ -no_match_vars /;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 our $VERSION = version->new('0.3.5');
15  
16 1 has cmd => (
17 is => 'ro',
18 isa => 'Str',
19 required => 1,
20 );
21 1 has module => (
22 is => 'ro',
23 isa => 'Str',
24 );
25 1 has method => (
26 is => 'ro',
27 isa => 'Str',
28 default => 'run',
29 );
30 1 has run => (
31 is => 'ro',
32 isa => 'CodeRef',
33 );
34 1 has options => (
35 is => 'rw',
36 isa => 'ArrayRef[Getopt::Alt::Option]',
37 );
38  
39 around BUILDARGS => sub {
40 0 ▶ my ($orig, $class, @params) = @_;
Subroutine __ANON__: not called CC=5 SCAR=34.0
41 my %param =
42 0 ▶ @params == 1 && ref $params[0] eq 'HASH' ? %{ $params[0] }
Branch: 2 branches
BranchTrueFalseTotal
@params == 1 && ref $params[0] eq 'HASH' ? : 0 0 0
@params == 1 && ref $params[0] ne 'HASH' ? : 0 0 0
Condition0%0/6
@params == 1 and ref $params[0] eq "HASH"
!ll&&!rl&&r
000
@params == 1 and ref $params[0] ne "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
@params == 1 and ref $params[0] eq "HASH"
@params == 1 ref $params[0] eq "HASH"
MC/DC0%0/2
@params == 1 and ref $params[0] ne "HASH"
@params == 1 ref $params[0] ne "HASH"
Truth table0%0/3
A and B
A= @params == 1B= ref $params[0] eq "HASH"
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= @params == 1B= ref $params[0] ne "HASH"
ABresult
0X0
100
111
43 : @params == 1 && ref $params[0] ne 'HASH' ? ( cmd => $params[0] )
44 : @params;
45  
46 0 return $class->$orig(%param);
47 1 };
48  
49 1 1;
50  
51 __END__
52  
53 =head1 NAME
54  
55 Getopt::Alt::Command - Base for sub commands
56  
57 =head1 VERSION
58  
59 This documentation refers to Getopt::Alt::Command version 0.3.5.
60  
61  
62 =head1 SYNOPSIS
63  
64 use Getopt::Alt::Command;
65  
66 # Brief but working code example(s) here showing the most common usage(s)
67 # This section will be as far as many users bother reading, so make it as
68 # educational and exemplary as possible.
69  
70  
71 =head1 DESCRIPTION
72  
73 =head1 SUBROUTINES/METHODS
74  
75  
76 =head1 DIAGNOSTICS
77  
78 =head1 CONFIGURATION AND ENVIRONMENT
79  
80  
81 =head1 DEPENDENCIES
82  
83 =head1 INCOMPATIBILITIES
84  
85 =head1 BUGS AND LIMITATIONS
86  
87 There are no known bugs in this module.
88  
89 Please report problems to Ivan Wills (ivan.wills@gmail.com).
90  
91 Patches are welcome.
92  
93 =head1 AUTHOR
94  
95 Ivan Wills - (ivan.wills@gmail.com)
96  
97 =head1 LICENSE AND COPYRIGHT
98  
99 Copyright (c) 2010 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW Australia 2077).
100 All rights reserved.
101  
102 This module is free software; you can redistribute it and/or modify it under
103 the same terms as Perl itself. See L<perlartistic>. This program is
104 distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
105 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
106 PARTICULAR PURPOSE.
107  
108 =cut
« blib/lib/Getopt/Alt/Option.pm ↑ Summary blib/lib/Getopt/Alt.pm »