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   1440 use strict;
  4         4  
  4         101  
3 4     4   25 use v5.10;
  4         10  
  4         99  
4 4     4   12 use parent 'App::PAIA::Command';
  4         4  
  4         15  
5              
6             our $VERSION = '0.29';
7              
8 4     4   204 use App::PAIA::JSON;
  4         5  
  4         504  
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__