File Coverage

blib/lib/App/PAIA/Command/logout.pm
Criterion Covered Total %
statement 12 20 60.0
branch 0 4 0.0
condition 0 3 0.0
subroutine 4 5 80.0
pod n/a
total 16 32 50.0


line stmt bran cond sub pod time code
1             package App::PAIA::Command::logout;
2 4     4   1428 use strict;
  4         5  
  4         87  
3 4     4   23 use v5.10;
  4         8  
  4         104  
4 4     4   12 use parent 'App::PAIA::Command';
  4         5  
  4         12  
5              
6 4     4   162 use App::PAIA::JSON;
  4         4  
  4         459  
7              
8             sub _execute {
9 0     0     my ($self, $opt, $args) = @_;
10              
11 0 0         if ($self->expired) {
12 0           $self->logger("session expired, skip logout"); # TODO: force on request
13             } else {
14 0   0       my $auth = $self->auth // $self->usage_error("missing PAIA auth URL");
15 0           my $response = $self->request(
16             "POST", "$auth/logout", { patron => $self->patron }
17             );
18 0           print encode_json($response);
19             }
20              
21 0 0         $self->session->purge && $self->logger->("deleted session file");
22              
23 0           return;
24             }
25              
26             1;
27             __END__