From 3dd60490b2f12aeabc457292b87fe43772ce0304 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sat, 17 Oct 2009 07:45:59 +0200 Subject: [PATCH] fix header output triggered by say() in perl 5.10.1+ Since the latest Perl release, calling sendheaders() from within a say() would (correctly) retain a custom output seperator, resulting in http headers being sent incorrectly. Easily fixed by resetting normal printing behaviour. --- lib/PLP.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/PLP.pm b/lib/PLP.pm index 2e740cf..680dba8 100644 --- a/lib/PLP.pm +++ b/lib/PLP.pm @@ -94,6 +94,7 @@ sub handler { # Sends the headers waiting in %PLP::Script::header sub sendheaders () { + local $\; # reset print behaviour if triggered by say() $PLP::sentheaders ||= [ caller 1 ? (caller 1)[1, 2] : (caller)[1, 2] ]; print STDOUT "Content-Type: text/plain\n\n" if $PLP::DEBUG & 2; while (my ($header, $values) = each %PLP::Script::header) { -- 2.30.0