CGI-Easy-SendFile
view release on metacpan or search on metacpan
t/send_file.t view on Meta::CPAN
plan tests=>50;
my $r = { ENV => {} };
my $h = CGI::Easy::Headers->new();
my ($data, $wait);
my %wait_h = (
'Status' => '200 OK',
'Date' => q{},
'Set-Cookie' => [],
'Accept-Ranges' => 'bytes',
'Content-Type' => 'application/x-download',
);
my $data_dynamic = 'Test file';
my $file_dynamic = \$data_dynamic;
my $data_real = do { seek DATA, 0, 0; join q{}, <DATA> };
my $file_real = $0;
# default
t/send_file.t view on Meta::CPAN
$h->{Expires} = 'Sat, 01 Jan 2000 00:00:00 GMT',
$data = send_file($r, $h, $file_real, {
type => 'image/png',
cache => 1,
inline => 1,
});
is ${$data}, q{}, 'image/cache/inline real (ifmod current)';
is_deeply $h, {
Status => '304 Not Modified',
'Content-Type' => 'text/html; charset=utf-8', # XXX?
'Set-Cookie' => [],
Date => q{},
};
$h = CGI::Easy::Headers->new();
$h->{Expires} = 'Sat, 01 Jan 2000 00:00:00 GMT',
$data = send_file($r, $h, $file_real, {
type => 'image/png',
inline => 1,
});
is ${$data}, $data_real, 'image/inline real (ifmod current)';
( run in 0.505 second using v1.01-cache-2.11-cpan-e9199f4ba4c )