| 1 | package Plack::ResponseHelper::Attachment; | ||||||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||
| 5 | 1 | ▶ | use Plack::Response; | ||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||
| 8 | 1 | ▶ | sub helper { | ||||||||||||||||||||||
|
Subroutine
helper: called CC=3 SCAR=11.3
Pod
undocumented
| |||||||||||||||||||||||||
| 9 | 1 | my $init = shift; | |||||||||||||||||||||||
| 10 | 1 | ▶ | my $content_type = $init && $init->{content_type} || 'application/octet-stream'; | ||||||||||||||||||||||
|
Condition40%2/5
$init && $init->{'content_type'} || 'application/octet-stream'
$init and $init->{"content_type"}
MC/DC0%0/2
$init && $init->{'content_type'} || 'application/octet-stream'
$init
$init->{"content_type"}
Truth table33%1/3
A and B
A= $initB= $init->{"content_type"}
| |||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||
| 12 | 1 | ▶ | return sub { | ||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||
| 13 | 1 | my $r = shift; | |||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||
| 15 | 1 | my $response = Plack::Response->new(200); | |||||||||||||||||||||||
| 16 | 1 | $response->headers( | |||||||||||||||||||||||
| 17 | [ | ||||||||||||||||||||||||
| 18 | 'Content-Type' => $content_type, | ||||||||||||||||||||||||
| 19 | 'Content-Disposition' => qq[attachment; filename="$r->{filename}"], | ||||||||||||||||||||||||
| 20 | ], | ||||||||||||||||||||||||
| 21 | ); | ||||||||||||||||||||||||
| 22 | 1 | $response->body($r->{data}); | |||||||||||||||||||||||
| 23 | 1 | return $response; | |||||||||||||||||||||||
| 24 | 1 | }; | |||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||
| 27 | 1 | 1; | |||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||
| 29 | __END__ | ||||||||||||||||||||||||