| 1 | package Getopt::Kingpin::Flag; | ||||||||||||||
| 2 | 28 | ▶ | use 5.008001; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 3 | 28 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | 28 | ▶ | use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | 28 | ▶ | use Getopt::Kingpin::Base -base; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 6 | |||||||||||||||
| 7 | 28 | our $VERSION = "0.09"; | |||||||||||||
| 8 | |||||||||||||||
| 9 | 28 | has _placeholder => undef; | |||||||||||||
| 10 | 28 | has _hidden => 0; | |||||||||||||
| 11 | |||||||||||||||
| 12 | sub placeholder { | ||||||||||||||
| 13 | 5 | ▶ | my $self = shift; | ||||||||||||
|
Subroutine
placeholder: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||
| 14 | 5 | my $placeholder = shift; | |||||||||||||
| 15 | |||||||||||||||
| 16 | 5 | $self->_placeholder($placeholder); | |||||||||||||
| 17 | |||||||||||||||
| 18 | 5 | return $self; | |||||||||||||
| 19 | } | ||||||||||||||
| 20 | |||||||||||||||
| 21 | sub hidden { | ||||||||||||||
| 22 | 1 | ▶ | my $self = shift; | ||||||||||||
|
Subroutine
hidden: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||
| 23 | |||||||||||||||
| 24 | 1 | $self->_hidden(1); | |||||||||||||
| 25 | |||||||||||||||
| 26 | 1 | return $self; | |||||||||||||
| 27 | } | ||||||||||||||
| 28 | |||||||||||||||
| 29 | sub help_str { | ||||||||||||||
| 30 | 244 | ▶ | my $self = shift; | ||||||||||||
|
Subroutine
help_str: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||
| 31 | |||||||||||||||
| 32 | 244 | my $ret = ["", "", ""]; | |||||||||||||
| 33 | |||||||||||||||
| 34 | 244 | ▶ | if (defined $self->short_name) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 35 | 30 | $ret->[0] = sprintf "-%s", $self->short_name; | |||||||||||||
| 36 | } | ||||||||||||||
| 37 | |||||||||||||||
| 38 | 244 | ▶ | if ($self->type eq "Bool") { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 39 | 182 | $ret->[1] = sprintf "--%s", $self->name; | |||||||||||||
| 40 | } else { | ||||||||||||||
| 41 | 62 | ▶ | if (defined $self->_placeholder) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 42 | 10 | $ret->[1] = sprintf '--%s=%s', $self->name, $self->_placeholder; | |||||||||||||
| 43 | } elsif (defined $self->_default) { | ||||||||||||||
| 44 | 8 | $ret->[1] = sprintf '--%s="%s"', $self->name, $self->_default; | |||||||||||||
| 45 | } else { | ||||||||||||||
| 46 | 44 | $ret->[1] = sprintf "--%s=%s", $self->name, uc $self->name; | |||||||||||||
| 47 | } | ||||||||||||||
| 48 | } | ||||||||||||||
| 49 | |||||||||||||||
| 50 | 244 | ▶ | $ret->[2] = defined $self->description ? $self->description : ""; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 51 | |||||||||||||||
| 52 | 244 | return $ret; | |||||||||||||
| 53 | } | ||||||||||||||
| 54 | |||||||||||||||
| 55 | 28 | 1; | |||||||||||||
| 56 | __END__ | ||||||||||||||