Hello world/Web server: Difference between revisions
Content added Content deleted
(→min: add) |
SqrtNegInf (talk | contribs) m (→{{header|Perl}}: future-proof for 5.36, \xd -> \x0d, \xa -> \x0a) |
||
Line 1,481: | Line 1,481: | ||
}</syntaxhighlight> |
}</syntaxhighlight> |
||
Using Perl's glue power, provide a |
Using Perl's glue power, provide a note |
||
with visitor counter via netcat: |
with visitor counter via netcat: |
||
<syntaxhighlight lang="perl">while (++(our $vn)) { |
<syntaxhighlight lang="perl">while (++(our $vn)) { |
||
open NC, "|-", qw(nc -l -p 8080 -q 1); |
open NC, "|-", qw(nc -l -p 8080 -q 1); |
||
print NC "HTTP/1.0 200 OK\xd\xa", |
print NC "HTTP/1.0 200 OK\xd\xa", |
||
"Content-type: text/plain; charset=utf-8\ |
"Content-type: text/plain; charset=utf-8\x0d\x0a\x0d\x0a", |
||
"Goodbye, World! (hello, visitor No. $vn!)\ |
"Goodbye, World! (hello, visitor No. $vn!)\x0d\x0a"; |
||
}</syntaxhighlight> |
}</syntaxhighlight> |
||