| 1 | 1 | ▶ | use 5.008; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | package Data::Conveyor::Service::Interface::Shell; | ||||||||||||||||||||||||||||
| 6 | 1 | ▶ | BEGIN { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | $Data::Conveyor::Service::Interface::Shell::VERSION = '1.103130'; | |||||||||||||||||||||||||||
| 8 | } | ||||||||||||||||||||||||||||
| 9 | # ABSTRACT: Stage-based conveyor-belt-like ticket handling system | ||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Data::Conveyor::Service::Methods; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use Data::Dumper; # for the debug command | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use Data::Miscellany 'is_defined'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use Error ':try'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use Error::Hierarchy; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use Getopt::Long; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use Pod::Text; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use IO::Pager; # not used really, just determines a pager at BEGIN time | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use once; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | # It's ok to inherit from Data::Conveyor::Service::Interface as well; new() | ||||||||||||||||||||||||||||
| 21 | # will be found in Term::Shell::Enhanced first. | ||||||||||||||||||||||||||||
| 22 | 1 | ▶ | use parent qw( | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | Term::Shell::Enhanced | ||||||||||||||||||||||||||||
| 24 | Data::Conveyor::Service::Interface | ||||||||||||||||||||||||||||
| 25 | 1 | ); | |||||||||||||||||||||||||||
| 26 | 1 | __PACKAGE__->mk_hash_accessors(qw(sth))->mk_integer_accessors(qw(num)) | |||||||||||||||||||||||||||
| 27 | ->mk_scalar_accessors( | ||||||||||||||||||||||||||||
| 28 | qw( | ||||||||||||||||||||||||||||
| 29 | base hostname limit log name prompt_spec ticket_no pager | ||||||||||||||||||||||||||||
| 30 | ) | ||||||||||||||||||||||||||||
| 31 | ); | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | # These aren't the constructor()'s DEFAULTS()! Because new() comes from | ||||||||||||||||||||||||||||
| 34 | # Term::Shell, not Class::Scaffold::Base, we don't have the convenience of | ||||||||||||||||||||||||||||
| 35 | # the the mk_constructor()-generated constructor. Therefore, | ||||||||||||||||||||||||||||
| 36 | # Term::Shell::Enhanced defines its own mechanism. | ||||||||||||||||||||||||||||
| 37 | 0 | ▶ | sub DEFAULTS { | ||||||||||||||||||||||||||
|
Subroutine
DEFAULTS: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 38 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 39 | ( name => 'dcsh', | ||||||||||||||||||||||||||||
| 40 | longname => 'Data-Conveyor Shell', | ||||||||||||||||||||||||||||
| 41 | ticket_no => '', | ||||||||||||||||||||||||||||
| 42 | limit => 10, | ||||||||||||||||||||||||||||
| 43 | prompt_spec => ': \n_(\d)_[\t]:\#; ', | ||||||||||||||||||||||||||||
| 44 | pager => $ENV{PAGER}, # as set by IO::Pager | ||||||||||||||||||||||||||||
| 45 | 0 | ); | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 0 | ▶ | sub PROMPT_VARS { | ||||||||||||||||||||||||||
|
Subroutine
PROMPT_VARS: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 49 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 50 | 0 | ▶ | ( t => $self->ticket_no || '', | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 51 | d => $self->svc->storage->dbname || 'n/a', | ||||||||||||||||||||||||||||
| 52 | ); | ||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 0 | ▶ | sub init { | ||||||||||||||||||||||||||
|
Subroutine
init: not called CC=2 SCAR=17.0
Pod
documented
| |||||||||||||||||||||||||||||
| 56 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 57 | 0 | $self->delegate->test_mode(1); # force log to STDOUT | |||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | # can't do $self->SUPER::init(@_), because that would find only | ||||||||||||||||||||||||||||
| 60 | # Term::Shell::Enhanced::init(), but not the | ||||||||||||||||||||||||||||
| 61 | # Data::Conveyor::Service::Interface::init(). | ||||||||||||||||||||||||||||
| 62 | 0 | $self->Term::Shell::Enhanced::init(@_); | |||||||||||||||||||||||||||
| 63 | 0 | $self->Data::Conveyor::Service::Interface::init(@_); | |||||||||||||||||||||||||||
| 64 | 0 | my %args = @{ $self->{API}{args} }; | |||||||||||||||||||||||||||
| 65 | 0 | ▶ | $self->base($args{base}) unless defined $self->base; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | # generate methods for handling generic service commands | ||||||||||||||||||||||||||||
| 68 | 0 | ▶ | ONCE { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=8 SCAR=41.3
| |||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | # Generate handlers for all methods listed in the Service Methods | ||||||||||||||||||||||||||||
| 71 | # object. They are being generated into this package. If you need | ||||||||||||||||||||||||||||
| 72 | # custom implementations for some handlers, override them in the | ||||||||||||||||||||||||||||
| 73 | # appropriate subclass. | ||||||||||||||||||||||||||||
| 74 | 0 | for my $command ($self->svc->get_method_names) { | |||||||||||||||||||||||||||
| 75 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | # separate lexical vars ($meth1, $meth2, $meth3) for closures | ||||||||||||||||||||||||||||
| 78 | # smry_* method | ||||||||||||||||||||||||||||
| 79 | 0 | my $meth1 = sprintf "smry_%s" => $command; | |||||||||||||||||||||||||||
| 80 | 0 | ▶ | unless (defined *{$meth1}{CODE}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 81 | 0 | ▶ | $::PTAGS && $::PTAGS->add_tag($meth1, __FILE__, __LINE__ + 1); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 82 | 0 | ▶ | *$meth1 = sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 83 | 0 | ▶ | local $DB::sub = local *__ANON__ = | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined &DB::DB and not $Devel::DProf::VERSION
MC/DC0%0/2
defined &DB::DB and not $Devel::DProf::VERSION
defined &DB::DB
not $Devel::DProf::VERSION
Truth table0%0/3
A and not(B)
A= defined &DB::DBB= not $Devel::DProf::VERSION
| |||||||||||||||||||||||||||||
| 84 | "Data::Conveyor::Service::Interface::Shell::${meth1}" | ||||||||||||||||||||||||||||
| 85 | if defined &DB::DB && !$Devel::DProf::VERSION; | ||||||||||||||||||||||||||||
| 86 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 87 | 0 | $self->summary_for_service_method($command); | |||||||||||||||||||||||||||
| 88 | 0 | }; | |||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | # help_* method | ||||||||||||||||||||||||||||
| 92 | 0 | my $meth2 = sprintf "help_%s" => $command; | |||||||||||||||||||||||||||
| 93 | 0 | ▶ | unless (defined *{$meth2}{CODE}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 94 | 0 | ▶ | $::PTAGS && $::PTAGS->add_tag($meth2, __FILE__, __LINE__ + 1); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 95 | 0 | ▶ | *$meth2 = sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 96 | 0 | ▶ | local $DB::sub = local *__ANON__ = | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined &DB::DB and not $Devel::DProf::VERSION
MC/DC0%0/2
defined &DB::DB and not $Devel::DProf::VERSION
defined &DB::DB
not $Devel::DProf::VERSION
Truth table0%0/3
A and not(B)
A= defined &DB::DBB= not $Devel::DProf::VERSION
| |||||||||||||||||||||||||||||
| 97 | "Data::Conveyor::Service::Interface::Shell::${meth2}" | ||||||||||||||||||||||||||||
| 98 | if defined &DB::DB && !$Devel::DProf::VERSION; | ||||||||||||||||||||||||||||
| 99 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 100 | 0 | $self->get_help_for_service_method($command); | |||||||||||||||||||||||||||
| 101 | 0 | }; | |||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | # run_* method | ||||||||||||||||||||||||||||
| 105 | 0 | my $meth3 = sprintf "run_%s" => $command; | |||||||||||||||||||||||||||
| 106 | 0 | ▶ | unless (defined *{$meth3}{CODE}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 107 | 0 | ▶ | $::PTAGS && $::PTAGS->add_tag($meth3, __FILE__, __LINE__ + 1); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 108 | 0 | ▶ | *$meth3 = sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 109 | 0 | ▶ | local $DB::sub = local *__ANON__ = | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined &DB::DB and not $Devel::DProf::VERSION
MC/DC0%0/2
defined &DB::DB and not $Devel::DProf::VERSION
defined &DB::DB
not $Devel::DProf::VERSION
Truth table0%0/3
A and not(B)
A= defined &DB::DBB= not $Devel::DProf::VERSION
| |||||||||||||||||||||||||||||
| 110 | "Data::Conveyor::Service::Interface::Shell::${meth3}" | ||||||||||||||||||||||||||||
| 111 | if defined &DB::DB && !$Devel::DProf::VERSION; | ||||||||||||||||||||||||||||
| 112 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 113 | 0 | $self->execute_service_method($command, @_); | |||||||||||||||||||||||||||
| 114 | 0 | }; | |||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||
| 116 | 0 | $self->{handlers}{$command} = { | |||||||||||||||||||||||||||
| 117 | smry => $meth1, | ||||||||||||||||||||||||||||
| 118 | help => $meth2, | ||||||||||||||||||||||||||||
| 119 | run => $meth3, | ||||||||||||||||||||||||||||
| 120 | }; | ||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||
| 122 | 0 | }; | |||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | # override run() to disconnect from all storages so that changes are visible | ||||||||||||||||||||||||||||
| 126 | # immediately, not just when the shell exits. | ||||||||||||||||||||||||||||
| 127 | 0 | ▶ | sub run { | ||||||||||||||||||||||||||
|
Subroutine
run: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 128 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 129 | 0 | $self->SUPER::run(@_); | |||||||||||||||||||||||||||
| 130 | 0 | $self->delegate->disconnect; | |||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | # ======================================================================== | ||||||||||||||||||||||||||||
| 134 | # utility methods | ||||||||||||||||||||||||||||
| 135 | # ======================================================================== | ||||||||||||||||||||||||||||
| 136 | 0 | ▶ | sub check_ticket_no { | ||||||||||||||||||||||||||
|
Subroutine
check_ticket_no: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 137 | 0 | my ($self, $ticket_no) = @_; | |||||||||||||||||||||||||||
| 138 | 0 | require Data::Conveyor::Value::Ticket::Number; | |||||||||||||||||||||||||||
| 139 | 0 | ▶ | return 1 if Data::Conveyor::Value::Ticket::Number->check($ticket_no); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 140 | 0 | printf "[%s] doesn't look like a valid ticket number.\n", $ticket_no; | |||||||||||||||||||||||||||
| 141 | 0 | return 0; | |||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | 0 | ▶ | sub check_limit { | ||||||||||||||||||||||||||
|
Subroutine
check_limit: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 145 | 0 | my ($self, $limit) = @_; | |||||||||||||||||||||||||||
| 146 | 0 | ▶ | if ($limit =~ /^\d+$/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 147 | 0 | return 1; | |||||||||||||||||||||||||||
| 148 | } else { | ||||||||||||||||||||||||||||
| 149 | 0 | printf "[%s] doesn't look like a valid limit (should be a digit).\n", | |||||||||||||||||||||||||||
| 150 | $limit; | ||||||||||||||||||||||||||||
| 151 | 0 | return 0; | |||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | # ======================================================================== | ||||||||||||||||||||||||||||
| 156 | # service method helpers | ||||||||||||||||||||||||||||
| 157 | # ======================================================================== | ||||||||||||||||||||||||||||
| 158 | 0 | ▶ | sub getopt_spec_for_method { | ||||||||||||||||||||||||||
|
Subroutine
getopt_spec_for_method: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 159 | 0 | my ($self, $method) = @_; | |||||||||||||||||||||||||||
| 160 | 0 | my @getopt; | |||||||||||||||||||||||||||
| 161 | 0 | for my $param ($self->svc->get_params_for_method($method)) { | |||||||||||||||||||||||||||
| 162 | 0 | my $getopt = $param->{name}; | |||||||||||||||||||||||||||
| 163 | 0 | ▶ | if ($param->{short}) { $getopt .= '|' . $param->{short} } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 164 | 0 | ▶ | if ($param->{type} eq $self->delegate->SIP_STRING) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 165 | 0 | $getopt .= '=s'; | |||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||
| 167 | 0 | push @getopt => $getopt; | |||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||
| 169 | 0 | ▶ | wantarray ? @getopt : \@getopt; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | 0 | ▶ | sub get_param_help_for_method { | ||||||||||||||||||||||||||
|
Subroutine
get_param_help_for_method: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||
| 173 | 0 | my ($self, $method) = @_; | |||||||||||||||||||||||||||
| 174 | 0 | my $help = ''; | |||||||||||||||||||||||||||
| 175 | 0 | for my $param ($self->svc->get_params_for_method($method)) { | |||||||||||||||||||||||||||
| 176 | 0 | my $item = '--' . $param->{name}; | |||||||||||||||||||||||||||
| 177 | 0 | ▶ | if ($param->{short}) { $item .= ', -' . $param->{short} } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 178 | 0 | my %map = ( | |||||||||||||||||||||||||||
| 179 | $self->delegate->SIP_STRING => 'String', | ||||||||||||||||||||||||||||
| 180 | $self->delegate->SIP_BOOLEAN => 'Boolean', | ||||||||||||||||||||||||||||
| 181 | $self->delegate->SIP_MANDATORY => 'Mandatory', | ||||||||||||||||||||||||||||
| 182 | $self->delegate->SIP_OPTIONAL => 'Optional', | ||||||||||||||||||||||||||||
| 183 | ); | ||||||||||||||||||||||||||||
| 184 | my $description = '[' | ||||||||||||||||||||||||||||
| 185 | . $map{ $param->{type} } . '] [' | ||||||||||||||||||||||||||||
| 186 | 0 | . $map{ $param->{necessity} } . '] '; | |||||||||||||||||||||||||||
| 187 | $description .= "[Default: $param->{default}] " | ||||||||||||||||||||||||||||
| 188 | 0 | ▶ | if defined $param->{default}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 189 | 0 | $description .= $param->{description}; | |||||||||||||||||||||||||||
| 190 | 0 | ▶ | if ( $param->{name} eq 'ticket' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$param->{"name"} eq "ticket" and $param->{"necessity"} eq $self->delegate->SIP_MANDATORY
MC/DC0%0/2
$param->{"name"} eq "ticket" and $param->{"necessity"} eq $self->delegate->SIP_MANDATORY
$param->{"name"} eq "ticket"
$param->{"necessity"} eq $self->delegate->SIP_MANDATORY
Truth table0%0/3
A and B
A= $param->{"name"} eq "ticket"B= $param->{"necessity"} eq $self->delegate->SIP_MANDATORY
| |||||||||||||||||||||||||||||
| 191 | && $param->{necessity} eq $self->delegate->SIP_MANDATORY) { | ||||||||||||||||||||||||||||
| 192 | 0 | my $ticket_no = $self->ticket_no; | |||||||||||||||||||||||||||
| 193 | 0 | ▶ | $ticket_no = 'none' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
&is_defined($ticket_no) and length $ticket_no
MC/DC0%0/2
&is_defined($ticket_no) and length $ticket_no
&is_defined($ticket_no)
length $ticket_no
Truth table0%0/3
A and B
A= &is_defined($ticket_no)B= length $ticket_no
| |||||||||||||||||||||||||||||
| 194 | unless is_defined($ticket_no) && length $ticket_no; | ||||||||||||||||||||||||||||
| 195 | 0 | $description .= sprintf | |||||||||||||||||||||||||||
| 196 | ' Unless given, the current ticket number (%s) will be used.', | ||||||||||||||||||||||||||||
| 197 | $ticket_no; | ||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||
| 199 | 0 | ▶ | if ($param->{name} eq 'limit') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 200 | 0 | ▶ | $description .= sprintf | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 201 | ' Unless given, the current limit (%s) will be used.', | ||||||||||||||||||||||||||||
| 202 | (is_defined($self->limit) ? $self->limit : 'none'); | ||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||
| 204 | 0 | $help .= "=item $item\n\n$description\n\n"; | |||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||
| 206 | 0 | return "\n\n=over 4\n\n$help\n\n=back\n\n"; | |||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | 0 | ▶ | sub get_example_help_for_method { | ||||||||||||||||||||||||||
|
Subroutine
get_example_help_for_method: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||
| 210 | 0 | my ($self, $method) = @_; | |||||||||||||||||||||||||||
| 211 | 0 | my $example_pod = ''; | |||||||||||||||||||||||||||
| 212 | 0 | my $example_count = 0; | |||||||||||||||||||||||||||
| 213 | 0 | for my $example ($self->svc->get_examples_for_method($method)) { | |||||||||||||||||||||||||||
| 214 | 0 | $example_count++; | |||||||||||||||||||||||||||
| 215 | 0 | $example_pod .= "=item $method"; | |||||||||||||||||||||||||||
| 216 | 0 | ▶ | while (my ($name, $value) = each %$example) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 217 | 0 | $example_pod .= " --$name"; | |||||||||||||||||||||||||||
| 218 | 0 | ▶ | $example_pod .= " $value" if defined $value; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||
| 220 | 0 | $example_pod .= "\n\n"; | |||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||
| 222 | 0 | ▶ | if (length $example_pod) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 223 | 0 | $example_pod = "=over 4\n\n$example_pod\n\n=back\n\n"; | |||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||
| 225 | 0 | ▶ | if ($example_count == 1) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 226 | 0 | $example_pod = "Example:\n\n$example_pod"; | |||||||||||||||||||||||||||
| 227 | } elsif ($example_count > 1) { | ||||||||||||||||||||||||||||
| 228 | 0 | $example_pod = "Examples:\n\n$example_pod"; | |||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||
| 230 | 0 | $example_pod; | |||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | 0 | ▶ | sub pod_to_text { | ||||||||||||||||||||||||||
|
Subroutine
pod_to_text: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 234 | 0 | my ($self, $pod) = @_; | |||||||||||||||||||||||||||
| 235 | 0 | ▶ | open my $pod_fh, '<', \$pod | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 236 | or die "can't open filehandle to scalar \$pod"; | ||||||||||||||||||||||||||||
| 237 | 0 | my $text = ''; | |||||||||||||||||||||||||||
| 238 | 0 | ▶ | open my $text_fh, '>', \$text | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 239 | or die "can't open filehandle to scalar \$text"; | ||||||||||||||||||||||||||||
| 240 | 0 | my $parser = Pod::Text->new; | |||||||||||||||||||||||||||
| 241 | 0 | $parser->parse_from_filehandle($pod_fh, $text_fh); | |||||||||||||||||||||||||||
| 242 | 0 | ▶ | close $pod_fh or die "can't close filehandle to scalar \$pod"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 243 | 0 | ▶ | close $text_fh or die "can't close filehandle to scalar \$text"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 244 | 0 | $text; | |||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | 0 | ▶ | sub summary_for_service_method { | ||||||||||||||||||||||||||
|
Subroutine
summary_for_service_method: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 248 | 0 | my ($self, $method) = @_; | |||||||||||||||||||||||||||
| 249 | 0 | $self->svc->get_summary_for_method($method); | |||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | # don't call this just "help_for_service_method", or Term::Shell's | ||||||||||||||||||||||||||||
| 253 | # find_handler() will find it and assume that there's a command | ||||||||||||||||||||||||||||
| 254 | # "for_service_method". | ||||||||||||||||||||||||||||
| 255 | 0 | ▶ | sub get_help_for_service_method { | ||||||||||||||||||||||||||
|
Subroutine
get_help_for_service_method: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 256 | 0 | my ($self, $method) = @_; | |||||||||||||||||||||||||||
| 257 | 0 | my $description = $self->svc->get_description_for_method($method); | |||||||||||||||||||||||||||
| 258 | 0 | my $param_help = $self->get_param_help_for_method($method); | |||||||||||||||||||||||||||
| 259 | 0 | my $example_pod = $self->get_example_help_for_method($method); | |||||||||||||||||||||||||||
| 260 | 0 | my $pod = <<EOPOD; | |||||||||||||||||||||||||||
| 261 | =pod | ||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||
| 263 | $method | ||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||
| 265 | $description | ||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | $param_help | ||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||
| 269 | $example_pod | ||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | =cut | ||||||||||||||||||||||||||||
| 272 | EOPOD | ||||||||||||||||||||||||||||
| 273 | 0 | $self->pod_to_text($pod); | |||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | # Don't call this run_service_method, or Term::Shell will think it's a | ||||||||||||||||||||||||||||
| 277 | # command. | ||||||||||||||||||||||||||||
| 278 | 0 | ▶ | sub execute_service_method { | ||||||||||||||||||||||||||
|
Subroutine
execute_service_method: not called CC=14 SCAR=53.5
Pod
documented
| |||||||||||||||||||||||||||||
| 279 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 280 | 0 | my $method = shift; | |||||||||||||||||||||||||||
| 281 | 0 | local @ARGV = @_; | |||||||||||||||||||||||||||
| 282 | 0 | my %opt; | |||||||||||||||||||||||||||
| 283 | 0 | ▶ | GetOptions(\%opt, $self->getopt_spec_for_method($method)) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 284 | or return $self->run_help($method); | ||||||||||||||||||||||||||||
| 285 | 0 | ▶ | if (@ARGV) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 286 | 0 | print "extraneous arguments [@ARGV]\n\n"; | |||||||||||||||||||||||||||
| 287 | 0 | return $self->run_help($method); | |||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||
| 289 | 0 | my $params = $self->svc->get_params_for_method($method); | |||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | # if there's a mandatory 'ticket' param, it defaults to the current ticket | ||||||||||||||||||||||||||||
| 292 | # number | ||||||||||||||||||||||||||||
| 293 | 0 | ▶ | if (( grep { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
grep {$_->{"name"} eq "ticket" and $_->{"necessity"} eq $self->delegate->SIP_MANDATORY;} @$params and not defined $opt{"ticket"}
MC/DC0%0/2
grep {$_->{"name"} eq "ticket" and $_->{"necessity"} eq $self->delegate->SIP_MANDATORY;} @$params and not defined $opt{"ticket"}
grep {$_->{"name"} eq "ticket" and $_->{"necessity"} eq $self->delegate->SIP_MANDATORY;} @$params
not defined $opt{"ticket"}
Truth table0%0/3
A and not(B)
A= grep {$_->{"name"} eq "ticket" and $_->{"necessity"} eq $self->delegate->SIP_MANDATORY;} @$paramsB= not defined $opt{"ticket"}
| |||||||||||||||||||||||||||||
| 294 | $_->{name} eq 'ticket' | ||||||||||||||||||||||||||||
| 295 | 0 | ▶ | && $_->{necessity} eq $self->delegate->SIP_MANDATORY | ||||||||||||||||||||||||||
|
Condition0%0/3
$_->{'name'} eq 'ticket' && $_->{'necessity'} eq $self->delegate->SIP_MANDATORY
MC/DC0%0/2
$_->{'name'} eq 'ticket' && $_->{'necessity'} eq $self->delegate->SIP_MANDATORY
$_->{'name'} eq 'ticket'
$_->{'necessity'} eq $self->delegate->SIP_MANDATORY
Truth table0%0/3
A && B
A= $_->{'name'} eq 'ticket'B= $_->{'necessity'} eq $self->delegate->SIP_MANDATORY
| |||||||||||||||||||||||||||||
| 296 | } @$params | ||||||||||||||||||||||||||||
| 297 | ) | ||||||||||||||||||||||||||||
| 298 | && !(defined $opt{ticket}) | ||||||||||||||||||||||||||||
| 299 | ) { | ||||||||||||||||||||||||||||
| 300 | 0 | my $ticket_no = $self->ticket_no; | |||||||||||||||||||||||||||
| 301 | 0 | ▶ | unless ($ticket_no) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 302 | 0 | ||||||||||||||||||||||||||||
| 303 | "--ticket not given and there is no current ticket number.\n\n"; | ||||||||||||||||||||||||||||
| 304 | 0 | return $self->run_help($method); | |||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||
| 306 | 0 | $opt{ticket} = $ticket_no; | |||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||
| 309 | # if there's a 'limit' param, it defaults to the current limit | ||||||||||||||||||||||||||||
| 310 | 0 | ▶ | if ((grep { $_->{name} eq 'limit' } @$params) && !(defined $opt{limit})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
grep {$_->{"name"} eq "limit";} @$params and not defined $opt{"limit"}
MC/DC0%0/2
grep {$_->{"name"} eq "limit";} @$params and not defined $opt{"limit"}
grep {$_->{"name"} eq "limit";} @$params
not defined $opt{"limit"}
Truth table0%0/3
A and not(B)
A= grep {$_->{"name"} eq "limit";} @$paramsB= not defined $opt{"limit"}
| |||||||||||||||||||||||||||||
| 311 | 0 | $opt{limit} = $self->limit; | |||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||
| 314 | # check other mandatory parameters | ||||||||||||||||||||||||||||
| 315 | 0 | my @params = $self->svc->get_params_for_method($method); | |||||||||||||||||||||||||||
| 316 | 0 | for my $param (@params) { | |||||||||||||||||||||||||||
| 317 | 0 | ▶ | next if defined $opt{ $param->{name} }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||
| 319 | # If the method only has one parameter and there is something left in | ||||||||||||||||||||||||||||
| 320 | # @ARGV (unparsed by GetOptions), assume it's that parameter's value. | ||||||||||||||||||||||||||||
| 321 | # | ||||||||||||||||||||||||||||
| 322 | # This way, you can say "somecmd somevalue" instead of "somecmd -d | ||||||||||||||||||||||||||||
| 323 | # somevalue" if "-d" is the only arguments. It's just a little bit | ||||||||||||||||||||||||||||
| 324 | # more convenient and intuitive. | ||||||||||||||||||||||||||||
| 325 | 0 | ▶ | if ((@params == 1) && (@ARGV >= 1)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@params == 1 and @ARGV >= 1
MC/DC0%0/2
@params == 1 and @ARGV >= 1
@params == 1
@ARGV >= 1
Truth table0%0/3
A and B
A= @params == 1B= @ARGV >= 1
| |||||||||||||||||||||||||||||
| 326 | 0 | $opt{ $param->{name} } = shift @ARGV; | |||||||||||||||||||||||||||
| 327 | 0 | next; | |||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||
| 329 | 0 | ▶ | next unless $param->{necessity} eq $self->delegate->SIP_MANDATORY; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 330 | 0 | print "missing mandatory parameter [$param->{name}]\n\n"; | |||||||||||||||||||||||||||
| 331 | 0 | return $self->run_help($method); | |||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||
| 333 | 0 | $self->svc->apply_param_aliases_and_defaults($method, \%opt); | |||||||||||||||||||||||||||
| 334 | 0 | ▶ | try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 335 | 0 | $self->print_result($self->svc->run_method($method, %opt)); | |||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||
| 337 | 0 | ▶ | catch Data::Conveyor::Exception::ServiceMethodHelp with { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 338 | 0 | print $_[0]->custom_message . "\n\n"; | |||||||||||||||||||||||||||
| 339 | 0 | $self->run_help($method); | |||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||
| 341 | 0 | ▶ | catch Error with { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 342 | 0 | print "$_[0]\n"; | |||||||||||||||||||||||||||
| 343 | 0 | }; | |||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||
| 346 | # print a service result object | ||||||||||||||||||||||||||||
| 347 | 0 | ▶ | sub print_result { | ||||||||||||||||||||||||||
|
Subroutine
print_result: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 348 | 0 | my ($self, $result) = @_; | |||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||
| 350 | # just stringify, but make sure there is a newline at the end | ||||||||||||||||||||||||||||
| 351 | 0 | chomp($result); | |||||||||||||||||||||||||||
| 352 | 0 | $result .= "\n"; | |||||||||||||||||||||||||||
| 353 | 0 | ▶ | if ($self->pager) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 354 | 0 | my $pager = $self->pager; | |||||||||||||||||||||||||||
| 355 | ## no critic (ProhibitTwoArgOpen) | ||||||||||||||||||||||||||||
| 356 | 0 | ▶ | open my $fh, "| $pager" or die "can't pipe to $pager: $!\n"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 357 | 0 | print $fh $result; | |||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||
| 359 | # close() doesn't work because of broken pipe... | ||||||||||||||||||||||||||||
| 360 | } else { | ||||||||||||||||||||||||||||
| 361 | 0 | print $result; | |||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||
| 365 | # ======================================================================== | ||||||||||||||||||||||||||||
| 366 | # pager | ||||||||||||||||||||||||||||
| 367 | # ======================================================================== | ||||||||||||||||||||||||||||
| 368 | 0 | ▶ | sub smry_pager { 'get or set the current pager' } | ||||||||||||||||||||||||||
|
Subroutine
smry_pager: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 369 | 0 | ▶ | sub help_pager { | ||||||||||||||||||||||||||
|
Subroutine
help_pager: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 370 | 0 | <<'END' } | |||||||||||||||||||||||||||
| 371 | pager [<pager>] | ||||||||||||||||||||||||||||
| 372 | Get or set the current pager. If the value is "off", no pager will be used. | ||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||
| 374 | END | ||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||
| 376 | 0 | ▶ | sub run_pager { | ||||||||||||||||||||||||||
|
Subroutine
run_pager: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 377 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 378 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 379 | 0 | my $pager = shift; | |||||||||||||||||||||||||||
| 380 | 0 | ▶ | $pager = '' if lc($pager) eq 'off'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 381 | 0 | $self->pager($pager); | |||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||
| 383 | 0 | printf "Current pager is [%s]\n", $self->pager; | |||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||
| 386 | # ======================================================================== | ||||||||||||||||||||||||||||
| 387 | # ticket | ||||||||||||||||||||||||||||
| 388 | # ======================================================================== | ||||||||||||||||||||||||||||
| 389 | 0 | ▶ | sub smry_ticket { 'get or set the current ticket number' } | ||||||||||||||||||||||||||
|
Subroutine
smry_ticket: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 390 | 0 | ▶ | sub help_ticket { | ||||||||||||||||||||||||||
|
Subroutine
help_ticket: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 391 | 0 | <<'END' } | |||||||||||||||||||||||||||
| 392 | ticket [<ticket_no>] | ||||||||||||||||||||||||||||
| 393 | Get or set the current ticket number. | ||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||
| 395 | END | ||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||
| 397 | 0 | ▶ | sub run_ticket { | ||||||||||||||||||||||||||
|
Subroutine
run_ticket: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 398 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 399 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 400 | 0 | my $ticket_no = shift; | |||||||||||||||||||||||||||
| 401 | 0 | ▶ | $self->check_ticket_no($ticket_no) and $self->ticket_no($ticket_no); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||
| 403 | 0 | printf "Current ticket no is [%s]\n", $self->ticket_no; | |||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||
| 406 | # ======================================================================== | ||||||||||||||||||||||||||||
| 407 | # limit | ||||||||||||||||||||||||||||
| 408 | # ======================================================================== | ||||||||||||||||||||||||||||
| 409 | 0 | ▶ | sub smry_limit { | ||||||||||||||||||||||||||
|
Subroutine
smry_limit: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 410 | 0 | 'get or set the current limit (max. rows returned by a command)'; | |||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||
| 412 | 0 | ▶ | sub help_limit { | ||||||||||||||||||||||||||
|
Subroutine
help_limit: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 413 | 0 | <<'END' } | |||||||||||||||||||||||||||
| 414 | limit [<limit>] | ||||||||||||||||||||||||||||
| 415 | Get or set the current limit (max. rows returned by a command). | ||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||
| 417 | END | ||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||
| 419 | 0 | ▶ | sub run_limit { | ||||||||||||||||||||||||||
|
Subroutine
run_limit: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 420 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 421 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 422 | 0 | my $limit = shift; | |||||||||||||||||||||||||||
| 423 | 0 | ▶ | $self->check_limit($limit) and $self->limit($limit); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||
| 425 | 0 | printf "Current limit is [%s]\n", $self->limit; | |||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||
| 428 | # ======================================================================== | ||||||||||||||||||||||||||||
| 429 | # debug | ||||||||||||||||||||||||||||
| 430 | # ======================================================================== | ||||||||||||||||||||||||||||
| 431 | 0 | ▶ | sub smry_debug { 'print debugging information' } | ||||||||||||||||||||||||||
|
Subroutine
smry_debug: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 432 | 0 | ▶ | sub help_debug { | ||||||||||||||||||||||||||
|
Subroutine
help_debug: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 433 | 0 | <<'END' } | |||||||||||||||||||||||||||
| 434 | debug | ||||||||||||||||||||||||||||
| 435 | Prints the current state of some internal variables for debugging | ||||||||||||||||||||||||||||
| 436 | purposes. | ||||||||||||||||||||||||||||
| 437 | END | ||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||
| 439 | # subclasses can extend this | ||||||||||||||||||||||||||||
| 440 | 0 | ▶ | sub debug_lines { | ||||||||||||||||||||||||||
|
Subroutine
debug_lines: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 441 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 442 | 0 | my @debug = ( | |||||||||||||||||||||||||||
| 443 | "CF_CONF: $ENV{CF_CONF}", | ||||||||||||||||||||||||||||
| 444 | sprintf("environment: %s", $self->delegate->configurator->environment), | ||||||||||||||||||||||||||||
| 445 | scalar(Data::Dumper->Dump([ scalar($self->delegate->OR) ], [qw/OR/])), | ||||||||||||||||||||||||||||
| 446 | ); | ||||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||
| 449 | 0 | ▶ | sub run_debug { | ||||||||||||||||||||||||||
|
Subroutine
run_debug: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 450 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 451 | 0 | ▶ | try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 452 | 0 | $self->print_result($_) for $self->debug_lines; | |||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||
| 454 | 0 | ▶ | catch Error with { print "$_[0]\n" }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||
| 456 | 1 | 1; | |||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||
| 459 | __END__ | ||||||||||||||||||||||||||||