Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Solved: Can I trigger a hardcopy (printer print) from perl?

by Anonymous Monk
on Jan 09, 2012 at 15:00 UTC ( #947013=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Monks,

Question: Can I trigger a printout of a hardcopy, text or so, from perl, without the script-hosting system (in this case Linux) asking for a confirmation, a print-dialog or similar?

Answered it myself:
open(PRN, "|lp"); print PRN "hello";
(Note to myself: research first, ask later...). As I already wrote the post, left here in case anyone else comes up with this.

Replies are listed 'Best First'.
Re: Solved: Can I trigger a hardcopy (printer print) from perl?
by isync (Hermit) on Jan 09, 2012 at 15:05 UTC
    Related reading: Net::Printer, Net::LPR, Net::CUPS etc. on cpan.
    Or use from perl what the system exposes, for example system("lpr some.pdf").
Re: Solved: Can I trigger a hardcopy (printer print) from perl?
by mrdurtal (Scribe) on Jan 10, 2012 at 12:33 UTC
    Would there not be something like:
    open(PRN, "|lp") or &dienice("Can't print: $!\n"); print PRN "hello";

    :There is more than one way to @verb a cat:

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://947013]
Approved by ww
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2021-02-26 04:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?