Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Printer module from web interface

by ksublondie (Pilgrim)
on Mar 08, 2011 at 00:13 UTC ( #891932=note: print w/ replies, xml ) Need Help??


in reply to Re: Printer module from web interface
in thread Printer module from web interface

$pr_cmd is set in the Printer::Unix module:

my $pr_cmd = "| lpr -P $self->{'printer'}{$OSNAME}";
I've added:
$pr_cmd=~/^(.*)$/; $pr_cmd=$1;
and I've even tried hard-coding $pr_cmd="| lpr -P lp" but I'm still getting the same error. Interesting observation:
open PRINTER, $pr_cmd or warn "Can't open printer connection to lp: $!";
Doesn't show my warning text. Is that to be expected?


Comment on Re^2: Printer module from web interface
Select or Download Code
Re^3: Printer module from web interface
by GrandFather (Cardinal) on Mar 08, 2011 at 01:10 UTC

    Oh!. Maybe you need to untaint $ENV{PATH}. If it's used by open, which is likely, then you'd get that error and your script would die horribly before hitting the warning.

    True laziness is hard work
      (server died yesterday, so I'm back on this issue after wasting precious time...*sigh*)

      So, I've modified the beginning of the Printer::Unix file in the standard Printer module (which, BTW, I feel so inadequate to modify a CPAN module):

      use Env qw(PRINTER LPDEST NPRINTER NGPRINTER PATH); #added the two following lines $ENV{'PATH'}='/usr/local/sbin'; delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'}; ############################################################ sub list_printers { ...
      If I understand correctly, this should properly untaint $ENV{'PATH'}, right? I'm still getting the exact same error. Is there something I'm forgetting or missing or just plain ol' not understanding?

      I've verified the location permissions. Anything I set it to is non-world writable, but still tanks.

      I don't know if it's relevant, but I found this. It appears to be very similar to what I'm experiencing, however, with a different module. Of course the fix given in that post is specific to the MIME::Lite module...not helping here.

        So, I've modified the beginning of the Printer::Unix file in the standard Printer module (which, BTW, I feel so inadequate to modify a CPAN module):

        Well, you're supposed to modify your program ...... and error messages don't come without line numbers

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2014-11-29 05:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (203 votes), past polls