From 046406ab6b13659f4be843d3d2d5639efaf425fe Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Tue, 12 Nov 2002 12:05:40 +0000 Subject: printer related modules cleaning : - create the printer/ hierarchy - split services related stuff into services.pm & printer::services, - move things that've nothing to do with printers into common.pm (alternatives, permissions, ...) - move eveything related to cups, gimp-print, detection, {star,open}office to the corresponding splited printer:: module - big consolidation of printer::office (it was obvious there were tons of duplication between staroffice and openoffice managment) - move other stuff into printer::main, printer::common, status : print.pm has been heavily splited (now one can begin to understand the little bits). printerdrake still needs to be splited/cleaned and eventually removed since printer/printerdrake modules separation is not understandable by other people till, in printer::gimp, $lprcommand is neither declared nor setted nowhere. idem in mdk9.0 ... --- perl-install/printer/cups.pm | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 perl-install/printer/cups.pm (limited to 'perl-install/printer/cups.pm') diff --git a/perl-install/printer/cups.pm b/perl-install/printer/cups.pm new file mode 100644 index 000000000..1de54edf2 --- /dev/null +++ b/perl-install/printer/cups.pm @@ -0,0 +1,30 @@ +package printer::cups; + +use strict; +use printer::data; + +sub get_remote_queues { + my ($printer) = $_[0]; + # The following code reads in a list of all remote printers which the + # local CUPS daemon knows due to broadcasting of remote servers or + # "BrowsePoll" entries in the local /etc/cups/cupsd.conf + local *F; + open F, ($::testing ? $::prefix : "chroot $::prefix/ ") . + "lpstat -v |" or return (); + my @printerlist; + my $line; + while ($line = ) { + if ($line =~ m/^\s*device\s+for\s+([^:\s]+):\s*(\S+)\s*$/) { + my $queuename = $1; + if (($2 =~ m!^ipp://([^/:]+)[:/]!) && + (!$printer->{configured}{$queuename})) { + my $server = $1; + push (@printerlist, "$queuename|$server"); + } + } + } + close F; + return @printerlist; +} + +1; -- cgit v1.2.1