source: ocsinventory-agent/trunk/fuentes/lib/Ocsinventory/Agent/Backend/OS/MacOS/Printers.pm @ 468

Last change on this file since 468 was 468, checked in by mabarracus, 4 years ago

Copyt trusty code

File size: 724 bytes
Line 
1package Ocsinventory::Agent::Backend::OS::MacOS::Printers;
2use strict;
3
4sub check {
5    return(undef) unless -r '/usr/sbin/system_profiler';
6    return(undef) unless can_load("Mac::SysProfile");
7    return 1;
8}
9
10sub run {
11    my $params = shift;
12    my $common = $params->{common};
13
14    my $profile = Mac::SysProfile->new();
15    my $data = $profile->gettype('SPPrintersDataType');
16    return(undef) unless(ref($data) eq 'ARRAY');
17
18    foreach my $printer (@$data){
19        next if($printer->{'_name'} =~ /^The\sprinters\slist\sis\sempty\.(.*)$/);
20        $common->addPrinter({
21                NAME    => $printer->{'_name'},
22                DRIVER  => $printer->{'ppd'},
23                PORT    => $printer->{'uri'},
24        });
25    }
26
27}
281;
Note: See TracBrowser for help on using the repository browser.