From: Jarkko Hietaniemi Date: Thu, 16 May 2002 12:52:47 +0000 (+0000) Subject: 1. Not hardcoding \x0A and \x0D seems to help EBCDIC, amazing. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5551e547915ad8250f311210b48a73776abd1650;p=p5sagit%2Fp5-mst-13.2.git 1. Not hardcoding \x0A and \x0D seems to help EBCDIC, amazing. 2. Doing a s///g instead of tr/// works better for CR-delimited files, like in DJGPP (since doesn't correctly pull in CR-delimited lines). p4raw-id: //depot/perl@16621 --- diff --git a/lib/Pod/Html.pm b/lib/Pod/Html.pm index 515ca4e..e8f9ff3 100644 --- a/lib/Pod/Html.pm +++ b/lib/Pod/Html.pm @@ -372,14 +372,14 @@ sub pod2html { # be eol agnostic for (@poddata) { - if (/\x0D/) { - if (/\x0D\x0A/) { - @poddata = map { s/\x0D\x0A/\n/g; + if (/\r/) { + if (/\r\n/) { + @poddata = map { s/\r\n/\n/g; /\n\n/ ? map { "$_\n\n" } split /\n\n/ : $_ } @poddata; } else { - @poddata = map { s/\x0D/\n/g; + @poddata = map { s/\r/\n/g; /\n\n/ ? map { "$_\n\n" } split /\n\n/ : $_ } @poddata; diff --git a/lib/Pod/t/eol.t b/lib/Pod/t/eol.t index 331d27f..b78ec63 100644 --- a/lib/Pod/t/eol.t +++ b/lib/Pod/t/eol.t @@ -1,12 +1,5 @@ #!./perl -w -BEGIN { - if (ord("A") == 193) { - print "1..0 \# Skip: EBCDIC\n"; - exit(0); - } -} - use Test::More tests => 3; open(POD, ">$$.pod") or die "$$.pod: $!"; @@ -44,8 +37,8 @@ use Pod::Html; open(POD, "<$$.pod") or die "$$.pod: $!"; open(IN, ">$$.in") or die "$$.in: $!"; while () { - tr/\x0D\x0A//d; - print IN $_, "\x0D"; + s/[\r\n]+/\r/gs; + print IN $_; } close(POD); close(IN); @@ -57,8 +50,8 @@ pod2html("--title=eol", "--infile=$$.in", "--outfile=$$.o1"); open(POD, "<$$.pod") or die "$$.pod: $!"; open(IN, ">$$.in") or die "$$.in: $!"; while () { - tr/\x0D\x0A//d; - print IN $_, "\x0A"; + s/[\r\n]+/\n/gs; + print IN $_; } close(POD); close(IN); @@ -70,8 +63,8 @@ pod2html("--title=eol", "--infile=$$.in", "--outfile=$$.o2"); open(POD, "<$$.pod") or die "$$.pod: $!"; open(IN, ">$$.in") or die "$$.in: $!"; while () { - tr/\x0D\x0A//d; - print IN $_, "\x0D\x0A"; + s/[\r\n]+/\r\n/gs; + print IN $_; } close(POD); close(IN);