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


in reply to Re: piping to lp is broken after perl upgrade
in thread piping to lp is broken after perl upgrade

Thanks for your reply.

I created a files called test.ps.

$ cat test.ps %!PS /Courier findfont 20 scalefont setfont 72 500 moveto (Hello world!) show showpage
If I send it to the printer, it works. I get a Hello World.

So here is a recreation of the script that is failing.

#!/opt/csw/bin/perl -w use strict; use warnings; my $prolog = <<ENDPROLOG; %!PS /Courier findfont 20 scalefont setfont 72 500 moveto (Hello world!) show showpage ENDPROLOG my $PRINT_CMD = '/usr/bin/lp -o nobanner'; 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: $!";