http://www.perlmonks.org?node_id=800815


in reply to piping to lp is broken after perl upgrade

You should check if open was successful, and also if close was:

open my $output, '|-', $PRINT_CMD or die "Can't open pipe to $PRINT_CMD: $!"; print $output $prolog; ... close $output or warn "Error while closing pipe to $PRINT_CMD: $!";

Maybe that'll give you some clue about what's wrong.

Perl 6 - links to (nearly) everything that is Perl 6.

Replies are listed 'Best First'.
Re^2: piping to lp is broken after perl upgrade
by myuserid7 (Scribe) on Oct 12, 2009 at 23:26 UTC
    I got excited when I saw your close - I thought for sure the open handle was causing the grief.

    Added the error checking. Nothing.

    Something is foobar here and I am not sure it is perl. Even from the command line...

    cat foo.ps | /usr/bin/lp -o nobanner
    prints the postscript code while...
    /usr/bin/lp -o nobanner foo.ps
    Prints the postscript document. So I really can't expect my perl script to work as written.