开发者

How to send the files in a directory to the printer in Perl?

开发者 https://www.devze.com 2023-02-01 17:37 出处:网络
Okay, here\'s what I\'m trying to do: I have an email with a series of MIME attachments. I have sample code that will get me as far as creating a directory with the decoded attachments in it; what I

Okay, here's what I'm trying to do:

I have an email with a series of MIME attachments. I have sample code that will get me as far as creating a directory with the decoded attachments in it; what I need开发者_JS百科 to do now is send the contents of that directory to lpr. (I'm not screening out bad file formats; I'm leaving it up to the spooler daemon to deal with.)


What about using glob:

my @files = glob($decode_directory/*);
system "lpr", @files;

You can make the glob argument more selective. The system function written thus avoids launching a shell and runs the lpr command directly.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号