Hey,
oder so aehnlich, oder?
dein Unix ist ja grauenhaft.
#!perl
use strict;
use diagnostics;
use IO::Handle qw();
use IPC::Open2 qw(open2);
my @highlighter = ('/usr/bin/highlight', '-Sphp', '-i -'); # STDIN
my $php_raw = '<?php echo("Hallo Welt!")?>';
my $php_highlighted;
{
my ($r, $w) = (IO::Handle->new, IO::Handle->new);
my $pid = open2($r, $w, @highlighter);
print $w $php_raw;
close $w;
{
local $/ = undef; # slurp!
$php_highlighted = <$r>;
};
close $r;
waitpid $pid, 0;
};
--
水-金-地-火-木-土-天-海-冥
水-金-地-火-木-土-天-海-冥