File Coverage

blib/lib/SeeAlso/Format/redirect.pm
Criterion Covered Total %
statement 3 11 27.2
branch 0 2 0.0
condition n/a
subroutine 1 3 33.3
pod 0 2 0.0
total 4 18 22.2


line stmt bran cond sub pod time code
1             package SeeAlso::Format::redirect;
2             #ABSTRACT: HTTP redirect as response format
3             $SeeAlso::Format::redirect::VERSION = '0.14';
4 3     3   14 use base 'SeeAlso::Format';
  3         6  
  3         594  
5              
6 0     0 0   sub format { 'text/html' }
7              
8             sub psgi {
9 0     0 0   my ($self, $result) = @_;
10 0           my ($url) = grep { $_ } @{$result->[3]};
  0            
  0            
11              
12 0 0         if ($url) {
13 0           return [302, [
14             Location => $url, URI => "<$url>",
15             'Content-Type' => $self->format
16             ], [ "" ]
17             ]
18             } else {
19 0           return [404,['Content-Type' => $self->format],['not found']];
20             }
21             }
22              
23             1;
24              
25             __END__