[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] setting Dev:Printer



I'm picking up MacPerl for the first time for a rush job. I've had a look
through the mailing list digests where I noticed you could directly send
PostScript to "the printer". Anyway I've taken this from sendps in the
5.10b2 app distribution. I tried adding the NBP tuple to a PRINTER
environment variable but that didn't work. At least I'm assuming
Dev:Printer uses GUSI to directly access a networked (PostScript) entity.
How do I specify the printer?

This code dies at the open but it also seems to leave the system prone to
crashing. My memory of Perl is rusty, but I also wonder whether there's a
way of reporting the current printer's name - would have given me a clue if
I could have done that. Do the Dev (pseudo?) devices even represent
attachment points to objects with names?

cheers,
Danny Thomas  <D.Thomas@cmcb.uq.edu.au>

CONFIG: 7200, 7.5.3r2, OT 1.1, RD1.6.2A, MP 5.10b2r2_appl


#!perl -w

$| = 1;

$ENV{"Printer"} = "Ritchie C (IIf):LaserWriter\@VTHRC";

open(PRINTER, "+>Dev:Printer") || die "couldn't open connection to laserwriter";

select((select(PRINTER), $|=1, $/="\012")[0]);

#while (<>) {
        print PRINTER "showpage";
#}

shutdown(PRINTER,1);

# I won't need this, but I'll be happy to get this far...
while (<PRINTER>) {
        s/\012/\015/g;
        print;
}