Leser: 24
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
sub getDruckerPorts {
my $host=$_[0];
my ($ret,@data)=doCmd("prnport","-s $host -l");
my %port;
my $name;
for my $line (@data) {
$name=$1 if $line =~ /^Anschlussname (.*)/;
if ($line =~/^Hostadresse (.*)/) {
$port{$name}=$1;
print $port{$name}=$1; #Test:Liefert als Ergebnis bei XP oder
Vista jeweils die 3 Druckerports --> Ergebnis korrekt!
}
}
print %port; #Test: Liefert bei XP 3 Druckerports, bei VISTA jedoch nur einen
--> Ergebnis falsch!
return %port;
for my $n (keys %port) {
print "$n -> $port{$n}\n";
}
}