Hi,

I'm using source-highlight in a mod_perl application. This program takes
code in STDIN and prints the html-highlighted code to STDOUT.
My code works fine from the commandline and in
Apache/1.3.37 (Unix) mod_perl/1.30
(perl 5.8.8)

On another machine it also works from the commandline, but not in
Apache/2.2.3 (Debian) mod_perl/2.0.2 Perl/v5.8.8

There is no error, I just cannot get anything from the read handle, it
seems to be empty.
Also an "or die $!" after the open3 is not executed.

I searched for similar problems, I found a posting where they said it would
help to untie STDIN before the open3, but this didn't help.

I also don't get any lines back from the error handle.

Does anybody have an idea what it could be? Maybe I should update to a
more recent mod_perl?

The version of IPC::Open3 is 1.02

Thanks,
tina

Here's the code:
# --------------------------
use strict;
use warnings;
use IPC::Open3;
use Data::Dumper;
use POSIX;

my $content = <<'EOM';
if ($foo) {
    bar() # bar
}
EOM
my $highlighted = '';
my $success = 0;
my $pid;
eval {
    my($wtr, $rdr, $err);
    $pid = open3($wtr, $rdr, $err,
        '/usr/bin/source-highlight', '-s', 'perl', '-css', '--no-doc');
    print $wtr $content;
    close $wtr;
    warn __PACKAGE__.':'.__LINE__.": before read loop\n";
    while (<$rdr>) {
        # this is not executed
        warn __PACKAGE__.':'.__LINE__.": line $_\n";
        $highlighted .= $_;
    }
    # code after the loop is executed
};
if ($@) {
    warn __PACKAGE__.':'.__LINE__.": ERROR happened: $@ ($$)\n";
    $highlighted = "error";
    POSIX::_exit(1);
    die "oops ($$)";
}
else {
    my $exit = waitpid $pid, 0;
    $success = 1 if $exit;
}
# --------------------------


--
http://darkdance.net/
http://perlpunks.de/
http://www.trashcave.de/

Reply via email to