Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: CUPS Printing - Using a Variable as a Filename (updated)

by haukex (Archbishop)
on Aug 20, 2019 at 15:44 UTC ( [id://11104745]=note: print w/replies, xml ) Need Help??


in reply to CUPS Printing - Using a Variable as a Filename

$printer->printFile($fh, 'jobx')

The documentation says that printFile wants a filename, not a handle. An in-memory file like this one does not have a filename. You probably want to use File::Temp instead (more examples):

use File::Temp qw/tempfile/; my ($tfh,$tfn) = tempfile(UNLINK=>1); print $tfh "Some Data...\n"; close $tfh; $printer->printFile($tfn, 'jobx')

Update: And as I mentioned here, you can use the DIR parameter, and as others have mentioned, you can point that at a RAM disk or similar file system.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11104745]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2024-04-18 01:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found