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   1464 use strict;
  4         5  
  4         92  
3 4     4   26 use v5.10;
  4         8  
  4         103  
4 4     4   11 use parent 'App::PAIA::Command';
  4         6  
  4         14  
5              
6             our $VERSION = '0.30';
7              
8 4     4   207 use App::PAIA::JSON;
  4         5  
  4         627  
9              
10             sub _execute {
11 0     0     my ($self, $opt, $args) = @_;
12              
13 0 0         if ($self->expired) {
14 0           $self->logger("session expired, skip logout"); # TODO: force on request
15             } else {
16 0   0       my $auth = $self->auth // $self->usage_error("missing PAIA auth URL");
17 0           my $response = $self->request(
18             "POST", "$auth/logout", { patron => $self->patron }
19             );
20 0           print encode_json($response);
21             }
22              
23 0 0         $self->session->purge && $self->logger->("deleted session file");
24              
25 0           return;
26             }
27              
28             1;
29             __END__