#!/usr/bin/perl -w use strict; use Win32::Printer::Enum; use Win32::Printer::Enum qw( Jobs ); my $server = 'sfile'; my @printer = Printers([$server]); my $count_printer = @printer; for(my $i=0; $i < $count_printer; $i++) { my $count_job = $printer[$i]{Jobs}; my $p = $i+1; print "$p. printer: " . $printer[$i]{PrinterName} . "\n jobs: $count_job \n"; my @jobs = Jobs($printer[$i]{PrinterName}, 0, $count_job); for(my $y=0; $y<$count_job; $y++) { my $p = $y+1; print " $p. job: " . $jobs[$y]{Document} . "\n"; print " StatusNr: " . $jobs[$y]{StatusNr} . "\n\n"; } }

returns nothing.

I'm trying to get print job status from a network printer. As described on cpan : Printers($server); $server name of the server on which the printer drivers should be enumerated. without submitting parameters to Printers(); it works just finding local printers.

i've also tried submitting the server like Printers('server_name'); and Printers('server_ip'); . I'm new to perl, maybe there is a syntax error ?


In reply to Win32::Printer::Enum - can't find network printer by simonask

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.