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

I am trying to get the status of my network printer. I am now using the code given below:

use Net::Printer; my $errstr="test"; $lineprinter = new Net::Printer( filename => "E:/S +nailmail/testprint.txt", printer => "\\ht +tp://192.168.25.205:631\unknown", server => "192. +168.25.205", port => 631, lineconvert => "YES" ); $result = $lineprinter->printfile("E:/Snailmail/testpr +int.txt"); $errstr = $lineprinter->printerror(); @result = $lineprinter->queuestatus(); print $errstr; print @result;

But i cant connect to the printer..... Please help me.

Replies are listed 'Best First'.
Re: getting printer status from windows
by cdarke (Prior) on May 17, 2010 at 11:11 UTC
    I know nothing about Net::Printer but one line looks suspicious:
    printer => "\\http://192.168.25.205:631\unknown",
    If you want a \ inside " then you need to escape it, use \\ for each.
Re: getting printer status from windows
by Anonymous Monk on May 17, 2010 at 10:26 UTC
    But i cant connect to the printer.....

    Why can't you connect (what is the error message)?

      No error message... The code is running without error but nothing returns, and the code is not exiting.