blib/lib/Clustericious/Client.pm

filter: Statementstmt 67.5% 279 / 413 Branchbran 44.3% 79 / 178 Conditioncond 37.6% 41 / 109 MC/DCmcdc 7.9% 5 / 63 Subroutinesub 72.4% 50 / 69 Podpod 100% 14 / 14 totaltotal 55.3% 468 / 846 CC 135 SCAR 52.7
CC
135
Cov
57%
_doit
543.4
has_error
32.1
__ANON__
20.0
CRAP 194.0
« blib/lib/Clustericious/Command/status.pm ↑ Summary blib/lib/Clustericious/Command/start.pm »
1 package Clustericious::Client;
2  
3 40 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 40 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 40 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 40 ▶use Mojo::Base qw/-base/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 40 ▶use Mojo::UserAgent;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 40 ▶use Mojo::ByteStream qw/b/;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 40 ▶use Mojo::Parameters;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 40 ▶use Clustericious;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 40 ▶use Clustericious::Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 40 ▶use Clustericious::Client::Object;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 40 ▶use Clustericious::Client::Meta;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 40 ▶use Clustericious::Client::Meta::Route;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 40 ▶use MojoX::Log::Log4perl;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 40 ▶use Log::Log4perl qw/:easy/;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 40 ▶use File::Temp;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 40 ▶use JSON::MaybeXS qw( encode_json decode_json );
Subroutine BEGIN: called CC=1 SCAR=0.0
19 40 ▶use Carp qw( carp );
Subroutine BEGIN: called CC=1 SCAR=0.0
20 40 ▶use Mojo::Util qw( monkey_patch );
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 # ABSTRACT: Construct command line and perl clients for RESTful services.
23 40 our $VERSION = '1.29'; # VERSION
24  
25  
26 40 has server_url => '';
27 40 has [qw(tx res userinfo ua )];
28 40 has _remote => ''; # Access via remote()
29 0 ▶has _cache => sub { + {} }; # cache of credentials
Subroutine __ANON__: not called CC=1 SCAR=1.2
30  
31 sub client
32 0 ▶{
Subroutine client: not called CC=1 SCAR=6.9
Pod documented
33 0 carp "Clustericious::Client->client is deprecated (use ua instead)";
34 0 shift->ua(@_);
35 }
36  
37 sub import
38 26 ▶{
Subroutine import: called CC=2 SCAR=6.9
39 26 my($class) = @_;
40 26 my $caller = caller;
41  
42 26 monkey_patch $caller, route => \&route;
43 26 monkey_patch $caller, route_meta => \&route_meta;
44 26 monkey_patch $caller, route_args => \&route_args;
45 1 ▶ monkey_patch $caller, route_doc => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine route_doc: called CC=1 SCAR=0.0
46 1 Clustericious::Client::Meta->add_route( $caller, @_ );
47 26 };
48 26 monkey_patch $caller, object => \&object;
49 26 ▶ monkey_patch $caller, import => sub {};
Subroutine __ANON__: called CC=1 SCAR=0.0
50  
51 26 do {
52 40 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
53 26 ▶ push @{"${caller}::ISA"}, $class unless $caller->isa($class);
Branch: 1 branch
BranchTrueFalseTotal
unless $caller->isa($class) 26 0 26
54 };
55 }
56  
57  
58 sub _mojo_user_agent_factory
59 36 ▶{
Subroutine _mojo_user_agent_factory: called CC=3 SCAR=11.0
60 36 my($class, $new) = @_;
61 36 ▶ state $factory = sub { Mojo::UserAgent->new };
Subroutine __ANON__: called CC=1 SCAR=0.0
62 36 ▶ $factory = $new if $new;
Branch: 1 branch
BranchTrueFalseTotal
if $new 20 16 36
63 36 ▶ defined wantarray ? $factory->() : ();
Branch: 1 branch
BranchTrueFalseTotal
defined wantarray ? : 16 20 36
64 }
65  
66 sub new
67 16 ▶{
Subroutine new: called CC=9 SCAR=27.6
Pod documented
68 16 my($class, %args) = @_;
69  
70 16 my $config = delete $args{config};
71
72 16 my $self = $class->SUPER::new(%args);
73  
74 16 ▶ $self->{_base_config} = $config if $config;
Branch: 1 branch
BranchTrueFalseTotal
if $config 13 3 16
75  
76 16 ▶ if($self->{app})
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'app'}) { } 0 16 16
77 {
78 0 my $app = $self->{app};
79 0 ▶ $app = $app->new() unless ref($app);
Branch: 1 branch
BranchTrueFalseTotal
unless ref $app 0 0 0
80 0 my $ua = $self->_mojo_user_agent_factory();
81 0 ▶ return undef unless $ua;
Branch: 1 branch
BranchTrueFalseTotal
unless $ua 0 0 0
82 0 ▶ eval { $ua->server->app($app) } // $ua->app($app);
Condition0%0/3
eval { do { $ua->server->app($app) } } // $ua->app($app)
l!l&&r!l&&!r
000
MC/DC0%0/2
eval { do { $ua->server->app($app) } } // $ua->app($app)
eval { do { $ua->server->app($app) } } $ua->app($app)
Truth table0%0/3
A // B
A= eval { do { $ua->server->app($app) } }B= $ua->app($app)
ABresult
1X1
011
000
83 0 $self->ua($ua);
84 }
85 else
86 {
87 16 $self->ua($self->_mojo_user_agent_factory());
88 16 ▶ unless(length $self->server_url)
Branch: 1 branch
BranchTrueFalseTotal
unless (length $self->server_url) 15 1 16
89 {
90 15 my $url = $self->config->url;
91 15 $url =~ s{/$}{};
92 15 $self->server_url($url);
93 }
94 }
95  
96 16 my $ua = $self->ua;
97 16 $ua->transactor->name($self->user_agent_string);
98 16 ▶ $ua->inactivity_timeout($ENV{CLUSTERICIOUS_KEEP_ALIVE_TIMEOUT} || 300);
Condition50%1/2
$ENV{'CLUSTERICIOUS_KEEP_ALIVE_TIMEOUT'} || 300
l!l
016
MC/DC0%0/1
$ENV{'CLUSTERICIOUS_KEEP_ALIVE_TIMEOUT'} || 300
$ENV{'CLUSTERICIOUS_KEEP_ALIVE_TIMEOUT'}
Truth table50%1/2
A
A= $ENV{'CLUSTERICIOUS_KEEP_ALIVE_TIMEOUT'}
Aresult
11
00
99  
100 16 ▶ if(eval { require Clustericious::Client::Local; })
Branch: 1 branch
BranchTrueFalseTotal
if (eval { do { require Clustericious::Client::Local } }) 0 16 16
101 {
102 0 Clustericious::Client::Local->local($self);
103 }
104  
105 16 $self;
106 }
107  
108  
109  
110 0 ▶sub remote {
Subroutine remote: not called CC=3 SCAR=24.8
Pod documented
111 0 my $self = shift;
112 0 ▶ return $self->_remote unless @_ > 0;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ > 0 0 0 0
113 0 my $remote = shift;
114 0 ▶ unless ($remote) { # reset to default
Branch: 1 branch
BranchTrueFalseTotal
unless ($remote) 0 0 0
115 0 $self->{_remote} = '';
116 0 $self->server_url($self->config->url);
117 0 return;
118 }
119 0 my $info = $self->_base_config->remotes->$remote;
120 0 TRACE "Using remote url : ".$info->{url};
121 0 $self->server_url($info->{url});
122 0 $self->userinfo('');
123 0 $self->_remote($remote);
124 }
125  
126  
127 0 ▶sub remotes {
Subroutine remotes: not called CC=1 SCAR=6.9
Pod documented
128 0 my $self = shift;
129 0 my %found = $self->_base_config->remotes(default => {});
130 0 return keys %found;
131 }
132  
133  
134 0 ▶sub login {
Subroutine login: not called CC=3 SCAR=24.8
Pod documented
135 0 my $self = shift;
136 0 my %args = @_;
137 my ($user,$pw) =
138 @_==2 ? @_
139 0 ▶ : @_ ? @args{qw/username password/}
Branch: 2 branches
BranchTrueFalseTotal
@_ == 2 ? : 0 0 0
@_ ? : 0 0 0
140 : map $self->config->$_, qw/username password/;
141 0 $self->userinfo(join ':', $user,$pw);
142 }
143  
144  
145 2 ▶sub errorstring {
Subroutine errorstring: called CC=8 SCAR=23.4
Pod documented
146 2 my $self = shift;
147 2 ▶ WARN "Missing response in ua object" unless $self->res;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->res 1 1 2
148 2 ▶ return unless $self->res;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->res 1 1 2
149 1 ▶ return if $self->res->code && $self->res->is_success;
Branch: 1 branch
BranchTrueFalseTotal
if $self->res->code and $self->res->is_success 0 1 1
Condition33%1/3
$self->res->code and $self->res->is_success
!ll&&!rl&&r
100
MC/DC0%0/2
$self->res->code and $self->res->is_success
$self->res->code $self->res->is_success
Truth table33%1/3
A and B
A= $self->res->codeB= $self->res->is_success
ABresult
0X0
100
111
150 1 my $error = $self->res->error;
151 1 ▶ if(defined $error->{advice})
Branch: 2 branches
BranchTrueFalseTotal
if (defined $error->{'advice'}) { } 0 1 1
elsif (defined $error->{'code'}) { } 0 1 1
152 {
153 0 return sprintf("[%d] %s", $error->{advice}, $error->{message});
154 }
155 elsif(defined $error->{code})
156 {
157 0 return sprintf( "(%d) %s", $error->{code}, $error->{message});
158 }
159 else
160 {
161 1 ▶ return $error->{message} // '';
Condition50%1/2
$error->{"message"} // ""
l!l
10
MC/DC0%0/1
$error->{"message"} // ""
$error->{"message"}
Truth table50%1/2
A
A= $error->{"message"}
Aresult
11
00
162 }
163 }
164  
165  
166 3 ▶sub has_error {
Subroutine has_error: called CC=7 SCAR=34.7
Pod documented
167 3 my $c = shift;
168 3 ▶ return unless $c->tx || $c->res;
Branch: 1 branch
BranchTrueFalseTotal
unless $c->tx or $c->res 3 0 3
Condition33%1/3
$c->tx or $c->res
l!l&&r!l&&!r
003
MC/DC0%0/2
$c->tx or $c->res
$c->tx $c->res
Truth table33%1/3
A or B
A= $c->txB= $c->res
ABresult
1X1
011
000
169 0 ▶ return 1 if $c->tx && $c->tx->error;
Branch: 1 branch
BranchTrueFalseTotal
if $c->tx and $c->tx->error 0 0 0
Condition0%0/3
$c->tx and $c->tx->error
!ll&&!rl&&r
000
MC/DC0%0/2
$c->tx and $c->tx->error
$c->tx $c->tx->error
Truth table0%0/3
A and B
A= $c->txB= $c->tx->error
ABresult
0X0
100
111
170 0 ▶ return 1 if $c->res && !$c->res->is_success;
Branch: 1 branch
BranchTrueFalseTotal
if $c->res and not $c->res->is_success 0 0 0
Condition0%0/3
$c->res and not $c->res->is_success
!ll&&!rl&&r
000
MC/DC0%0/2
$c->res and not $c->res->is_success
$c->res not $c->res->is_success
Truth table0%0/3
A and not(B)
A= $c->resB= not $c->res->is_success
ABresult
0X0
100
111
171 0 return 0;
172 }
173  
174  
175 16 ▶sub user_agent_string {
Subroutine user_agent_string: called CC=3 SCAR=11.0
Pod documented
176 16 my($self) = @_;
177 16 my $class = ref($self);
178 16 ▶ my $version1 = $Clustericious::Client::VERSION // 'dev';
Condition50%1/2
$Clustericious::Client::VERSION // "dev"
l!l
160
MC/DC0%0/1
$Clustericious::Client::VERSION // "dev"
$Clustericious::Client::VERSION
Truth table50%1/2
A
A= $Clustericious::Client::VERSION
Aresult
11
00
179 16 ▶ my $version2 = do {
Condition100%2/2
do { no strict 'refs'; ${"${class}::VERSION";} } // "dev"
l!l
88
MC/DC100%1/1
do { no strict 'refs'; ${"${class}::VERSION";} } // "dev"
do { no strict 'refs'; ${"${class}::VERSION";} }
Truth table100%2/2
A
A= do { no strict 'refs'; ${"${class}::VERSION";} }
Aresult
11
00
180 40 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
181 16 ${"${class}::VERSION"};
182 } // 'dev';
183 16 "Clustericious::Client/$version1 $class/$version2";
184 }
185  
186  
187 30 ▶sub route {
Subroutine route: called CC=8 SCAR=22.9
188 30 my $subname = shift;
189 30 ▶ my $objclass = ref $_[0] eq 'ARRAY' ? shift->[0] : undef;
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] eq 'ARRAY' ? : 0 30 30
190 0 ▶ my $doc = ref $_[-1] eq 'SCALAR' ? ${ pop() } : "";
Branch: 1 branch
BranchTrueFalseTotal
ref $_[-1] eq 'SCALAR' ? : 0 30 30
191 30 ▶ my $url = pop || "/$subname";
Condition50%1/2
pop() || "/$subname"
l!l
300
MC/DC0%0/1
pop() || "/$subname"
pop()
Truth table50%1/2
A
A= pop()
Aresult
11
00
192 30 ▶ my $method = shift || 'GET';
Condition100%2/2
shift() || 'GET'
l!l
264
MC/DC100%1/1
shift() || 'GET'
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
193  
194 30 my $client_class = scalar caller();
195 30 my $meta = Clustericious::Client::Meta::Route->new(
196 client_class => scalar caller(),
197 route_name => $subname
198 );
199  
200 30 $meta->set(method => $method);
201 30 $meta->set(url => $url);
202 30 $meta->set_doc($doc);
203  
204 30 ▶ if ($objclass) {
Branch: 1 branch
BranchTrueFalseTotal
if ($objclass) 0 30 30
205 0 eval "require $objclass";
206 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
207 0 ▶ LOGDIE "Error loading $objclass : $@" unless $@ =~ /Can't locate/i;
Branch: 1 branch
BranchTrueFalseTotal
unless $@ =~ /Can't locate/iu 0 0 0
208 }
209 }
210  
211 {
212 40 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
213 30 ▶ *{caller() . "::$subname"} = sub {
Subroutine __ANON__: called CC=2 SCAR=7.0
214 7 my $self = shift;
215 7 my @args = $self->meta_for($subname)->process_args(@_);
216 7 my $got = $self->_doit($meta,$method,$url,@args);
217 7 ▶ return $objclass->new($got, $self) if $objclass;
Branch: 1 branch
BranchTrueFalseTotal
if $objclass 0 7 7
218 7 return $got;
219 30 };
220 }
221  
222 }
223  
224  
225 2 ▶sub route_meta {
Subroutine route_meta: called CC=2 SCAR=6.9
226 2 my $name = shift;
227 2 my $attrs = shift;
228 2 my $meta = Clustericious::Client::Meta::Route->new(
229 client_class => scalar caller(),
230 route_name => $name
231 );
232  
233 2 $meta->set($_ => $attrs->{$_}) for keys %$attrs;
234 }
235  
236  
237 9 ▶sub route_args {
Subroutine route_args: called CC=2 SCAR=7.0
238 9 my $name = shift;
239 9 my $args = shift;
240 9 ▶ die "args must be an array ref" unless ref $args eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $args eq "ARRAY" 0 9 9
241 9 my $meta = Clustericious::Client::Meta::Route->new(
242 client_class => scalar caller(),
243 route_name => $name
244 );
245  
246 9 $meta->set(args => $args);
247 }
248  
249  
250 1 ▶sub object {
Subroutine object: called CC=6 SCAR=19.2
251 1 my $objname = shift;
252 1 ▶ my $url = shift || "/$objname";
Condition50%1/2
shift() || "/$objname"
l!l
01
MC/DC0%0/1
shift() || "/$objname"
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
253 0 ▶ my $doc = ref $_[-1] eq 'SCALAR' ? ${ pop() } : '';
Branch: 1 branch
BranchTrueFalseTotal
ref $_[-1] eq 'SCALAR' ? : 0 1 1
254 1 my $caller = caller;
255  
256 my $objclass = "${caller}::" .
257 1 join('', map { ucfirst } split('_', $objname)); # foo_bar => FooBar
258  
259 1 eval "require $objclass";
260 1 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 1 0 1
261 1 ▶ LOGDIE "Error loading $objclass : $@" unless $@ =~ /Can't locate/i;
Branch: 1 branch
BranchTrueFalseTotal
unless $@ =~ /Can't locate/iu 0 1 1
262 }
263  
264 1 ▶ $objclass = 'Clustericious::Client::Object' unless $objclass->can('new');
Branch: 1 branch
BranchTrueFalseTotal
unless $objclass->can("new") 1 0 1
265  
266 1 Clustericious::Client::Meta->add_object(scalar caller(),$objname,$doc);
267  
268 40 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
269 1 ▶ *{"${caller}::$objname"} = sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
270 2 my $self = shift;
271 2 my $meta = Clustericious::Client::Meta::Route->new(
272 client_class => $caller,
273 route_name => $objname
274 );
275 2 $meta->set( quiet_post => 1 );
276 2 my $data = $self->_doit( $meta, GET => $url, @_ );
277 2 $objclass->new( $data, $self );
278 1 };
279 1 ▶ *{"${caller}::${objname}_delete"} = sub {
Subroutine __ANON__: not called CC=1 SCAR=3.5
280 0 my $meta = Clustericious::Client::Meta::Route->new(
281 client_class => $caller,
282 route_name => $objname.'_delete',
283 );
284 0 $meta->set(dont_read_files => 1);
285 0 shift->_doit( $meta, DELETE => $url, @_ );
286 1 };
287 1 ▶ *{"${caller}::${objname}_search"} = sub {
Subroutine __ANON__: not called CC=1 SCAR=3.5
288 0 my $meta = Clustericious::Client::Meta::Route->new(
289 client_class => $caller,
290 route_name => $objname.'_search'
291 );
292 0 $meta->set(dont_read_files => 1);
293 0 shift->_doit( $meta, POST => "$url/search", @_ );
294 1 };
295 }
296  
297 11 ▶sub _doit {
Subroutine _doit: called CC=71 SCAR=63.0
298 11 my $self = shift;
299 11 my $meta;
300 11 ▶ $meta = shift if ref $_[0] eq 'Clustericious::Client::Meta::Route';
Branch: 1 branch
BranchTrueFalseTotal
if ref $_[0] eq "Clustericious::Client::Meta::Route" 11 0 11
301 11 my ($method, $url, @args) = @_;
302  
303 11 my $auto_failover;
304 11 ▶ $auto_failover = 1 if $meta && $meta->get('auto_failover');
Branch: 1 branch
BranchTrueFalseTotal
if $meta and $meta->get("auto_failover") 0 11 11
Condition33%1/3
$meta and $meta->get("auto_failover")
!ll&&!rl&&r
0110
MC/DC0%0/2
$meta and $meta->get("auto_failover")
$meta $meta->get("auto_failover")
Truth table33%1/3
A and B
A= $metaB= $meta->get("auto_failover")
ABresult
0X0
100
111
305  
306 11 ▶ $url = $self->server_url . $url if $self->server_url && $url !~ /^http/;
Branch: 1 branch
BranchTrueFalseTotal
if $self->server_url and not $url =~ /^http/u 11 0 11
Condition33%1/3
$self->server_url and not $url =~ /^http/u
!ll&&!rl&&r
0011
MC/DC0%0/2
$self->server_url and not $url =~ /^http/u
$self->server_url not $url =~ /^http/u
Truth table33%1/3
A and not(B)
A= $self->server_urlB= not $url =~ /^http/u
ABresult
0X0
100
111
307 11 ▶ return undef if $self->server_url eq 'http://0.0.0.0';
Branch: 1 branch
BranchTrueFalseTotal
if $self->server_url eq "http://0.0.0.0" 0 11 11
308  
309 11 my $cb;
310 11 my $body = '';
311 11 my $headers = {};
312  
313 11 ▶ if ($method eq 'POST' && grep /^--/, @args) {
Branch: 1 branch
BranchTrueFalseTotal
if ($method eq "POST" and grep /^--/u, @args) 0 11 11
Condition66%2/3
$method eq "POST" and grep /^--/u, @args
!ll&&!rl&&r
740
MC/DC0%0/2
$method eq "POST" and grep /^--/u, @args
$method eq "POST" grep /^--/u, @args
Truth table66%2/3
A and B
A= $method eq "POST"B= grep /^--/u, @args
ABresult
0X0
100
111
314 0 s/^--// for @args;
315 0 @args = ( { @args } );
316 }
317  
318 11 ▶ $url = Mojo::URL->new($url) unless ref $url;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $url 11 0 11
319 11 my $parameters = $url->query;
320  
321 # Set up mappings from parameter names to modifier callbacks.
322 11 my %url_modifier;
323 my %payload_modifer;
324 my %gen_url_modifier = (
325 0 ▶ query => sub { my $name = shift;
Subroutine __ANON__: not called CC=1 SCAR=6.9
326 0 ▶ sub { my ($u,$v) = @_; $u->query({$name => $v}) } },
Subroutine __ANON__: not called CC=1 SCAR=6.9
327 13 ▶ append => sub { my $name = shift;
Subroutine __ANON__: called CC=1 SCAR=0.0
328 13 ▶ sub { my ($u,$v) = @_; push @{ $u->path->parts } , $v; $u; } },
Subroutine __ANON__: called CC=1 SCAR=0.0
329 11 );
330 my %gen_payload_modifier = (
331 1 ▶ array => sub {
Subroutine __ANON__: called CC=2 SCAR=7.0
332 1 my ( $name, $key ) = @_;
333 1 ▶ LOGDIE "missing key for array payload modifier" unless $key;
Branch: 1 branch
BranchTrueFalseTotal
unless $key 0 1 1
334 1 ▶ sub { my $body = shift; $body ||= {}; push @{ $body->{$key} }, ( $name => shift ); $body; }
Subroutine __ANON__: called CC=2 SCAR=7.0
Condition50%1/2
$body ||= {}
l!l
10
MC/DC0%0/1
$body ||= {}
$body
Truth table50%1/2
A
A= $body
Aresult
11
00
335 1 },
336 1 ▶ hash => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
337 1 my $name = shift;
338 1 ▶ sub { my $body = shift; $body ||= {}; $body->{$name} = shift; $body; }
Subroutine __ANON__: called CC=2 SCAR=7.0
Condition50%1/2
$body ||= {}
l!l
01
MC/DC0%0/1
$body ||= {}
$body
Truth table50%1/2
A
A= $body
Aresult
11
00
339 1 },
340 11 );
341 11 ▶ if ($meta && (my $arg_spec = $meta->get('args'))) {
Branch: 1 branch
BranchTrueFalseTotal
if ($meta and my $arg_spec = $meta->get("args")) 4 7 11
Condition66%2/3
$meta and my $arg_spec = $meta->get("args")
!ll&&!rl&&r
074
MC/DC50%1/2
$meta and my $arg_spec = $meta->get("args")
$meta my $arg_spec = $meta->get("args")
Truth table66%2/3
A and B
A= $metaB= my $arg_spec = $meta->get("args")
ABresult
0X0
100
111
342 4 for (@$arg_spec) {
343 15 my $name = $_->{name};
344 15 ▶ if (my $modifies_url = $_->{modifies_url}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $modifies_url = $_->{"modifies_url"}) 13 2 15
345 $url_modifier{$name} =
346 ref($modifies_url) eq 'CODE' ? $modifies_url
347 13 ▶ : ($a = $gen_url_modifier{$modifies_url}) ? $a->($name)
Branch: 2 branches
BranchTrueFalseTotal
ref $modifies_url eq 'CODE' ? : 0 13 13
($a = $gen_url_modifier{$modifies_url}) ? : 13 0 13
348 : die "don't understand how to interpret modifies_url=$modifies_url";
349 }
350 15 ▶ if (my $modifies_payload = $_->{modifies_payload}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $modifies_payload = $_->{"modifies_payload"}) 2 13 15
351 $payload_modifer{$name} =
352 ref($modifies_payload) eq 'CODE' ? $modifies_payload
353 : ($a = $gen_payload_modifier{$modifies_payload}) ? $a->($name,$_->{key})
354 2 ▶ : LOGDIE "don't understand how to interpret modifies_payload=$modifies_payload";
Branch: 2 branches
BranchTrueFalseTotal
ref $modifies_payload eq 'CODE' ? : 0 2 2
($a = $gen_payload_modifier{$modifies_payload}) ? : 2 0 2
355 }
356 }
357 }
358  
359 11 ▶ while (defined(my $arg = shift @args)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $arg = shift @args)) 17 11 28
360 17 ▶ if (ref $arg eq 'HASH') {
Branch: 7 branches
BranchTrueFalseTotal
if (ref $arg eq 'HASH') { } 1 16 17
elsif (ref $arg eq 'CODE') { } 0 16 16
elsif (my $code = $url_modifier{$arg}) { } 13 3 16
elsif (my $code2 = $payload_modifer{$arg}) { } 2 1 3
elsif ($method eq 'GET' and $arg =~ s/^--//u) { } 0 1 1
elsif ($method eq 'GET' and $arg =~ s/^-//u) { } 0 1 1
elsif ($method eq 'POST' and not ref $arg) { } 0 1 1
361 1 $method = 'POST';
362 1 ▶ $parameters->append(skip_existing => 1) if $meta && $meta->get("skip_existing");
Branch: 1 branch
BranchTrueFalseTotal
if $meta and $meta->get("skip_existing") 0 1 1
Condition33%1/3
$meta and $meta->get("skip_existing")
!ll&&!rl&&r
010
MC/DC0%0/2
$meta and $meta->get("skip_existing")
$meta $meta->get("skip_existing")
Truth table33%1/3
A and B
A= $metaB= $meta->get("skip_existing")
ABresult
0X0
100
111
363 1 $body = encode_json $arg;
364 1 $headers = { 'Content-Type' => 'application/json' };
365 } elsif (ref $arg eq 'CODE') {
366 0 $cb = $self->_mycallback($arg);
367 } elsif (my $code = $url_modifier{$arg}) {
368 13 $url = $code->($url, shift @args);
369 } elsif (my $code2 = $payload_modifer{$arg}) {
370 2 $body = $code2->($body, shift @args);
371 ▶ } elsif ($method eq "GET" && $arg =~ s/^--//) {
Condition33%1/3
$method eq "GET" and $arg =~ s/^--//u
!ll&&!rl&&r
010
MC/DC0%0/2
$method eq "GET" and $arg =~ s/^--//u
$method eq "GET" $arg =~ s/^--//u
Truth table33%1/3
A and B
A= $method eq "GET"B= $arg =~ s/^--//u
ABresult
0X0
100
111
372 0 my $value = shift @args;
373 0 $parameters->append($arg => $value);
374 ▶ } elsif ($method eq "GET" && $arg =~ s/^-//) {
Condition33%1/3
$method eq "GET" and $arg =~ s/^-//u
!ll&&!rl&&r
010
MC/DC0%0/2
$method eq "GET" and $arg =~ s/^-//u
$method eq "GET" $arg =~ s/^-//u
Truth table33%1/3
A and B
A= $method eq "GET"B= $arg =~ s/^-//u
ABresult
0X0
100
111
375 # example: $client->esdt(-range => [1 => 100]);
376 0 my $value = shift @args;
377 0 ▶ if (ref $value eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $value eq "ARRAY") 0 0 0
378 0 $value = "items=$value->[0]-$value->[1]";
379 }
380 0 $headers->{$arg} = $value;
381 ▶ } elsif ($method eq "POST" && !ref $arg) {
Condition33%1/3
$method eq "POST" and not ref $arg
!ll&&!rl&&r
100
MC/DC0%0/2
$method eq "POST" and not ref $arg
$method eq "POST" not ref $arg
Truth table33%1/3
A and not(B)
A= $method eq "POST"B= not ref $arg
ABresult
0X0
100
111
382 0 $body = $arg;
383 0 ▶ $headers = shift @args if $args[0] && ref $args[0] eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
if $args[0] and ref $args[0] eq "HASH" 0 0 0
Condition0%0/3
$args[0] and ref $args[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$args[0] and ref $args[0] eq "HASH"
$args[0] ref $args[0] eq "HASH"
Truth table0%0/3
A and B
A= $args[0]B= ref $args[0] eq "HASH"
ABresult
0X0
100
111
384 } else {
385 1 push @{ $url->path->parts }, $arg;
386 }
387 }
388 11 ▶ $url = $url->to_abs unless $url->is_abs || $self->{app};
Branch: 1 branch
BranchTrueFalseTotal
unless $url->is_abs or $self->{"app"} 0 11 11
Condition33%1/3
$url->is_abs or $self->{"app"}
l!l&&r!l&&!r
1100
MC/DC0%0/2
$url->is_abs or $self->{"app"}
$url->is_abs $self->{"app"}
Truth table33%1/3
A or B
A= $url->is_absB= $self->{"app"}
ABresult
1X1
011
000
389 11 ▶ WARN "url $url is not absolute" unless $url =~ /^http/i;
Branch: 1 branch
BranchTrueFalseTotal
unless $url =~ /^http/iu 0 11 11
390  
391 11 ▶ $url->userinfo($self->userinfo) if $self->userinfo;
Branch: 1 branch
BranchTrueFalseTotal
if $self->userinfo 0 11 11
392  
393 11 DEBUG ( (ref $self)." : $method " ._sanitize_url($url));
394 11 ▶ $headers->{Connection} ||= 'Close';
Condition50%1/2
$headers->{"Connection"} ||= "Close"
l!l
011
MC/DC0%0/1
$headers->{"Connection"} ||= "Close"
$headers->{"Connection"}
Truth table50%1/2
A
A= $headers->{"Connection"}
Aresult
11
00
395 11 ▶ $headers->{Accept} ||= 'application/json';
Condition50%1/2
$headers->{"Accept"} ||= "application/json"
l!l
011
MC/DC0%0/1
$headers->{"Accept"} ||= "application/json"
$headers->{"Accept"}
Truth table50%1/2
A
A= $headers->{"Accept"}
Aresult
11
00
396  
397 11 ▶ if($body && ref $body eq 'HASH' || ref $body eq 'ARRAY')
Branch: 1 branch
BranchTrueFalseTotal
if ($body and ref $body eq "HASH" or ref $body eq "ARRAY") 1 10 11
Condition83%5/6
$body and ref $body eq "HASH" or ref $body eq "ARRAY"
l!l&&r!l&&!r
1010
$body and ref $body eq "HASH"
!ll&&!rl&&r
911
MC/DC66%2/3
$body and ref $body eq "HASH" or ref $body eq "ARRAY"
$body ref $body eq "HASH" ref $body eq "ARRAY"
Truth table60%3/5
A and B or C
A= $bodyB= ref $body eq "HASH"C= ref $body eq "ARRAY"
ABCresult
11X1
0X11
1011
0X00
1000
398 {
399 1 $headers->{'Content-Type'} = 'application/json';
400 1 $body = encode_json $body;
401 }
402  
403 11 ▶ return $self->ua->build_tx($method, $url, $headers, $body, $cb) if $cb;
Branch: 1 branch
BranchTrueFalseTotal
if $cb 0 11 11
404  
405 11 my $tx = $self->ua->build_tx($method, $url, $headers, $body);
406  
407 11 $tx = $self->ua->start($tx);
408 11 my $res = $tx->res;
409 11 $self->res($res);
410 11 $self->tx($tx);
411  
412 11 my $auth_header;
413 11 ▶ if (($tx->res->code||0) == 401 && ($auth_header = $tx->res->headers->www_authenticate)
Branch: 1 branch
BranchTrueFalseTotal
if (($tx->res->code || 0) == 401 and $auth_header = $tx->res->headers->www_authenticate and not $url->userinfo and $self->_has_auth || $self->_can_auth) 0 11 11
Condition35%5/14
($tx->res->code || 0) == 401 and $auth_header = $tx->res->headers->www_authenticate and not $url->userinfo and $self->_has_auth || $self->_can_auth
!ll&&!rl&&r
1100
($tx->res->code || 0) == 401 and $auth_header = $tx->res->headers->www_authenticate and not $url->userinfo
!ll&&!rl&&r
1100
($tx->res->code || 0) == 401 and $auth_header = $tx->res->headers->www_authenticate
!ll&&!rl&&r
1100
$tx->res->code || 0
l!l
29
$self->_has_auth or $self->_can_auth
l!l&&r!l&&!r
000
MC/DC0%0/5
($tx->res->code || 0) == 401 and $auth_header = $tx->res->headers->www_authenticate and not $url->userinfo and $self->_has_auth || $self->_can_auth
$tx->res->code $auth_header = $tx->res->headers->www_authenticate not $url->userinfo $self->_has_auth $self->_can_auth
Truth table16%1/6
A and B and not(C) and D or E
A= $tx->res->codeB= $auth_header = $tx->res->headers->www_authenticateC= not $url->userinfoD= $self->_has_authE= $self->_can_auth
ABCDEresult
0XXXX0
10XXX0
110XX0
111000
1111X1
111011
414 && !$url->userinfo && ($self->_has_auth || $self->_can_auth)) {
415 0 DEBUG "received code 401, trying again with credentials";
416 0 my ($realm) = $auth_header =~ /realm=(.*)$/i;
417 0 my $host = $url->host;
418 0 ▶ $self->login( $self->_has_auth ? () : $self->_get_user_pw($host,$realm) );
Branch: 1 branch
BranchTrueFalseTotal
$self->_has_auth ? : 0 0 0
419 0 ▶ return $self->_doit($meta ? $meta : (), @_);
Branch: 1 branch
BranchTrueFalseTotal
$meta ? : 0 0 0
420 }
421  
422 11 ▶ if ($res->is_success) {
Branch: 1 branch
BranchTrueFalseTotal
if ($res->is_success) 2 9 11
423 2 TRACE "Got response : ".$res->to_string;
424 2 ▶ my $content_type = $res->headers->content_type || do {
Condition33%1/3
$res->headers->content_type || do { WARN('No content-type from ' . _sanitize_url($url)); 'text/plain' }
l!l&&r!l&&!r
200
MC/DC0%0/2
$res->headers->content_type || do { WARN('No content-type from ' . _sanitize_url($url)); 'text/plain' }
$res->headers->content_type do { WARN('No content-type from ' . _sanitize_url($url)); 'text/plain' }
Truth table33%1/3
A || B
A= $res->headers->content_typeB= do { WARN('No content-type from ' . _sanitize_url($url)); 'text/plain' }
ABresult
1X1
011
000
425 0 WARN "No content-type from "._sanitize_url($url);
426 0 "text/plain";
427 };
428 2 ▶ return $method =~ /HEAD|DELETE/ ? 1
Branch: 2 branches
BranchTrueFalseTotal
$method =~ /HEAD|DELETE/u ? : 0 2 2
$content_type =~ qr"application/json"u ? : 2 0 2
429 : $content_type =~ qr[application/json] ? decode_json($res->body)
430 : $res->body;
431 }
432  
433 # Failed.
434 9 my $err = $tx->error;
435 9 my ($msg, $code) = ($err->{message}, $err->{code});
436 9 ▶ $msg ||= 'unknown error';
Condition50%1/2
$msg ||= "unknown error"
l!l
90
MC/DC0%0/1
$msg ||= "unknown error"
$msg
Truth table50%1/2
A
A= $msg
Aresult
11
00
437 9 my $s_url = _sanitize_url($url);
438  
439 9 ▶ if ($code) {
Branch: 1 branch
BranchTrueFalseTotal
if ($code) 0 9 9
440 0 ▶ if ($code == 404) {
Branch: 1 branch
BranchTrueFalseTotal
if ($code == 404) { } 0 0 0
441 TRACE "$method $url : $code $msg"
442 unless $ENV{ACPS_SUPPRESS_404}
443 0 ▶ && $url =~ /$ENV{ACPS_SUPPRESS_404}/;
Branch: 1 branch
BranchTrueFalseTotal
unless $ENV{"ACPS_SUPPRESS_404"} and $url =~ /$ENV{"ACPS_SUPPRESS_404"}/u 0 0 0
Condition0%0/3
$ENV{"ACPS_SUPPRESS_404"} and $url =~ /$ENV{"ACPS_SUPPRESS_404"}/u
!ll&&!rl&&r
000
MC/DC0%0/2
$ENV{"ACPS_SUPPRESS_404"} and $url =~ /$ENV{"ACPS_SUPPRESS_404"}/u
$ENV{"ACPS_SUPPRESS_404"} $url =~ /$ENV{"ACPS_SUPPRESS_404"}/u
Truth table0%0/3
A and B
A= $ENV{"ACPS_SUPPRESS_404"}B= $url =~ /$ENV{"ACPS_SUPPRESS_404"}/u
ABresult
0X0
100
111
444 } else {
445 0 ERROR "Error trying to $method $s_url : $code $msg";
446 0 ▶ TRACE "Full error body : ".$res->body if $res->body;
Branch: 1 branch
BranchTrueFalseTotal
if $res->body 0 0 0
447 0 ▶ my $brief = $res->body || '';
Condition0%0/2
$res->body || ''
l!l
00
MC/DC0%0/1
$res->body || ''
$res->body
Truth table0%0/2
A
A= $res->body
Aresult
11
00
448 0 $brief =~ s/\n/ /g;
449 0 ▶ ERROR substr($brief,0,200) if $brief;
Branch: 1 branch
BranchTrueFalseTotal
if $brief 0 0 0
450 }
451 # No failover for legitimate status codes.
452 0 return undef;
453 }
454  
455 9 ▶ unless ($auto_failover) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($auto_failover) 9 0 9
456 9 ERROR "Error trying to $method $s_url : $msg";
457 9 ▶ ERROR $res->body if $res->body;
Branch: 1 branch
BranchTrueFalseTotal
if $res->body 0 9 9
458 9 return undef;
459 }
460 0 my $failover_urls = $self->config->failover_urls(default => []);
461 0 ▶ unless (@$failover_urls) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@$failover_urls) 0 0 0
462 0 ERROR $msg;
463 0 return undef;
464 }
465 0 INFO "$msg but will try up to ".@$failover_urls." failover urls";
466 0 TRACE "Failover urls : @$failover_urls";
467 0 for my $url (@$failover_urls) {
468 0 DEBUG "Trying $url";
469 0 $self->server_url($url);
470 0 my $got = $self->_doit(@_);
471 0 ▶ return $got if $got;
Branch: 1 branch
BranchTrueFalseTotal
if $got 0 0 0
472 }
473  
474 0 return undef;
475 }
476  
477 sub _mycallback
478 0 ▶{
Subroutine _mycallback: not called CC=1 SCAR=6.9
479 0 my $self = shift;
480 0 my $cb = shift;
481 sub
482 0 ▶ {
Subroutine __ANON__: not called CC=4 SCAR=30.0
483 0 my ($ua, $tx) = @_;
484  
485 0 $self->res($tx->res);
486 0 $self->tx($tx);
487  
488 0 ▶ if ($tx->res->is_success)
Branch: 1 branch
BranchTrueFalseTotal
if ($tx->res->is_success) { } 0 0 0
489 {
490 0 ▶ my $body = $tx->res->headers->content_type =~ qr[application/json]
Branch: 1 branch
BranchTrueFalseTotal
$tx->res->headers->content_type =~ qr"application/json"u ? : 0 0 0
491 ? decode_json($tx->res->body) : $tx->res->body;
492  
493 0 ▶ $cb->($body ? $body : 1);
Branch: 1 branch
BranchTrueFalseTotal
$body ? : 0 0 0
494 }
495 else
496 {
497 0 $cb->();
498 }
499 }
500 0 }
501  
502 20 ▶sub _sanitize_url {
Subroutine _sanitize_url: called CC=3 SCAR=14.2
503 # Remove passwords from urls for displaying
504 20 my $url = shift;
505 20 ▶ $url = Mojo::URL->new($url) unless ref $url eq "Mojo::URL";
Branch: 1 branch
BranchTrueFalseTotal
unless ref $url eq "Mojo::URL" 0 20 20
506 20 ▶ return $url unless $url->userinfo;
Branch: 1 branch
BranchTrueFalseTotal
unless $url->userinfo 20 0 20
507 0 my $c = $url->clone;
508 0 $c->userinfo("user:*****");
509 0 $c;
510 }
511  
512 sub _appname
513 0 ▶{
Subroutine _appname: not called CC=1 SCAR=6.9
514 0 my($self) = @_;
515 0 (my $appname = ref $self) =~ s/:.*$//;
516 0 $appname;
517 }
518  
519  
520 sub config
521 22 ▶{
Subroutine config: called CC=2 SCAR=7.4
Pod documented
522 22 my($self) = @_;
523 22 my $conf = $self->_base_config;
524 22 ▶ if (my $remote = $self->_remote)
Branch: 1 branch
BranchTrueFalseTotal
if (my $remote = $self->_remote) 0 22 22
525 {
526 0 return $conf->remotes->$remote;
527 }
528 22 $conf;
529 }
530  
531 sub _config
532 0 ▶{
Subroutine _config: not called CC=1 SCAR=6.9
533 0 carp "Clustericious::Client->_config has been deprecated use config instead";
534 0 shift->config(@_);
535 }
536  
537 sub _base_config
538 22 ▶{
Subroutine _base_config: called CC=3 SCAR=11.1
539 # Independent of remotes
540 22 my($self) = @_;
541 22 ▶ unless(defined $self->{_base_config})
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_base_config"}) 2 20 22
542 {
543 2 my $config_name = ref $self;
544 2 $config_name =~ s/::Client$//;
545 2 $config_name =~ s/::/-/;
546 2 $self->{_base_config} = Clustericious::Config->new($config_name);
547 2 ▶ $self->{_base_config}->{url} //= Clustericious->_default_url($config_name);
Condition33%1/3
$self->{"_base_config"}{"url"} //= "Clustericious"->_default_url($config_name)
l!l&&r!l&&!r
200
MC/DC0%0/2
$self->{"_base_config"}{"url"} //= "Clustericious"->_default_url($config_name)
$self->{"_base_config"}{"url"} "Clustericious"->_default_url($config_name)
Truth table33%1/3
A //= B
A= $self->{"_base_config"}{"url"}B= "Clustericious"->_default_url($config_name)
ABresult
1X1
011
000
548 }
549
550 22 $self->{_base_config};
551 }
552  
553 sub _has_auth
554 0 ▶{
Subroutine _has_auth: not called CC=3 SCAR=24.8
555 0 my($self) = @_;
556 0 my $config = $self->config;
557 0 ▶ $config->username(default => '') && password(default => '') ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$config->username('default', '') && password('default', '') ? : 0 0 0
Condition0%0/3
$config->username("default", "") and password("default", "")
!ll&&!rl&&r
000
MC/DC0%0/2
$config->username("default", "") and password("default", "")
$config->username("default", "") password("default", "")
Truth table0%0/3
A and B
A= $config->username("default", "")B= password("default", "")
ABresult
0X0
100
111
558 }
559  
560 sub _can_auth
561 0 ▶{
Subroutine _can_auth: not called CC=2 SCAR=17.9
562 0 my $self = shift;
563 0 ▶ -t STDIN ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
-t STDIN ? : 0 0 0
564 }
565  
566 0 ▶sub _get_user_pw {
Subroutine _get_user_pw: not called CC=4 SCAR=30.0
567 0 my $self = shift;
568 0 my $host = shift;
569 0 my $realm = shift;
570 0 ▶ $realm = '' unless defined $realm;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $realm 0 0 0
571 0 ▶ return @{ $self->_cache->{$host}{$realm} } if exists($self->_cache->{$host}{$realm});
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->_cache->{$host}{$realm} 0 0 0
572 # "use"ing causes too many warnings; load on demand.
573 0 require Term::Prompt;
574 0 ▶ my $user = Term::Prompt::prompt('x', "Username for $realm at $host : ", '', $ENV{USER} // $ENV{USERNAME});
Condition0%0/3
$ENV{"USER"} // $ENV{"USERNAME"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$ENV{"USER"} // $ENV{"USERNAME"}
$ENV{"USER"} $ENV{"USERNAME"}
Truth table0%0/3
A // B
A= $ENV{"USER"}B= $ENV{"USERNAME"}
ABresult
1X1
011
000
575 0 my $pw = Term::Prompt::prompt('p', 'Password:', '', '');
576 0 $self->_cache->{$host}{$realm} = [ $user, $pw ];
577 0 return ($user,$pw);
578 }
579  
580  
581 23 ▶sub meta_for {
Subroutine meta_for: called CC=3 SCAR=11.0
Pod documented
582 23 my $self = shift;
583 23 ▶ my $route_name = shift || [ caller 1 ]->[3];
Condition66%2/3
shift() || [caller 1]->[3]
l!l&&r!l&&!r
13100
MC/DC0%0/2
shift() || [caller 1]->[3]
shift() [caller 1]->[3]
Truth table66%2/3
A || B
A= shift()B= [caller 1]->[3]
ABresult
1X1
011
000
584 23 ▶ if ( $route_name =~ /::([^:]+)$/ ){
Branch: 1 branch
BranchTrueFalseTotal
if ($route_name =~ /::([^:]+)$/u) 10 13 23
585 10 $route_name = $1;
586 }
587 23 my $meta = Clustericious::Client::Meta::Route->new(
588 route_name => $route_name,
589 client_class => ref $self
590 );
591 }
592  
593  
594 0 ▶sub version {
Subroutine version: not called CC=1 SCAR=6.9
Pod documented
595 0 my $self = shift;
596 0 my $meta = $self->meta_for("version");
597 0 $meta->set(auto_failover => 1);
598 0 $self->_doit($meta, GET => '/version');
599 }
600  
601  
602 2 ▶sub status {
Subroutine status: called CC=1 SCAR=0.0
Pod documented
603 2 my $self = shift;
604 2 my $meta = $self->meta_for("status");
605 2 $meta->set(auto_failover => 0);
606 2 $self->_doit($meta, GET => '/status');
607 }
608  
609  
610 0 ▶sub api {
Subroutine api: not called CC=1 SCAR=6.9
Pod documented
611 0 my $self = shift;
612 0 my $meta = $self->meta_for("api");
613 0 $meta->set( auto_failover => 1 );
614 0 $self->_doit( $meta, GET => '/api' );
615 }
616  
617  
618 0 ▶sub logtail {
Subroutine logtail: not called CC=1 SCAR=6.9
Pod documented
619 0 my $self = shift;
620 0 my $got = $self->_doit(GET => '/log', @_);
621 0 return { text => $got };
622 }
623  
624  
625 40 1;
626  
627 __END__
« blib/lib/Clustericious/Command/status.pm ↑ Summary blib/lib/Clustericious/Command/start.pm »