in reply to Trying to Print a File
Is this "so simple" in other cross-platform interpreted languages? It's a challenge because every platform handles printing in a remarkably different manner.
Sometimes it is simple in Perl, like on Unix:
#Send raw data to printer on Parallel Port 0: open PRINTER, '>>', '/dev/lp0'; print PRINTER $data; close PRINTER; #Send data to lpd for printing open PRINTER, "|lpr -P $printer"; print PRINTER $data; close PRINTER;
It's more difficult on Win32 and some other systems, because there are not convenient device files and scriptable print programs to work with. This isn't a shortcoming of Perl, it's a shortcoming of an OS that requires a plethora of system-library hooks just to print.
<<UPDATE:
Corion points out that Win32 systems can use the 'LPTn:' "special files", which work much like /dev/lpN files in *NIX. And, it appears that W2K finally has a scriptable print-spool command as well.
So, I stand corrected: Perl can easily print on many an OS with ease, so the main question shows more a lack of understanding of the underlying OS than an issue with Perl.
UPDATE ;
As an aside, you're fortunate I'm in a good mood today, otherwise I doubt you'd get an answer -- your comment is inflamatory, and you've asked for replies to your e-mail address. The former is just rude when you're asking for help, and the latter is both rude and unadvisable unless you want your Hotmail account filled with more Spam than usual. It's not like Google and other search engines don't index the Monestary, you know...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Trying to Print a File
by Corion (Patriarch) on Nov 05, 2004 at 20:02 UTC |