When fixing Bug 23589 Theodoros Theodoropoulos noticed that we are sending
headers and html after pdf output to browser.
Using exit inside eval block doesn't stop plack from generating
headers and html page after exit since CGI::Compile will catch
exit but doesn't stop emiting output. Example is:
eval {
warn "in eval";
exit;
};
warn "after eval";
Under CGI, this would print just "in eval", but under plack we get both lines
and thus generate additional header and html after we already sent pdf data.
Signed-off-by: Theodoros Theodoropoulos <theod@lib.auth.gr>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
my @lines = <$fh>;
close $fh;
print @lines;
- exit;
};
if ( $@ ) {
carp $@;
$template->param( messages => [ {type => 'error', code => 'unable_to_generate_pdf'} ] );
+ } else {
+ # no error, pdf is sent, so stop sending data to browser
+ exit;
}
}
my @lines = <$fh>;
close $fh;
print @lines;
- exit;
};
if ( $@ ) {
carp $@;
$template->param( messages => [ {type => 'error', code => 'unable_to_generate_pdf'} ] );
+ } else {
+ # no error, pdf is sent, so stop sending data to browser
+ exit;
}
}
else {