Bonjour,

Sur un ancien serveur Linux j'utilisais un script pour récuperer les infos d'Apache.
Or je suis passé sous Windows 2003 serveur et mon script ne fonctionne plus ... :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
C:\modules_perl>perl webstat.pl bytes
Global symbol "$res" requires explicit package name at webstat.pl line 19.
Global symbol "$res" requires explicit package name at webstat.pl line 20.
Voici le script :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!C:\Perl\bin\perl.exe
use strict; use warnings;
use LWP::Simple;
 
# depends on availability of status and extended status info from your
# Apache webserver -- your httpd.conf needs to include something like the
# following: (uncommented)
#<Location /server-status>
#    SetHandler server-status
#    Order allow,deny
#    Allow from localhost
#</Location>
#ExtendedStatus On
 
# can return hits or bytes (counters)
my $output = shift;
 
my @status = split/\n/, get('http://localhost:80/server-status');
 
 
my ($uptime, $server);
 
STATUSLOOP :
for my $line (@status) {
  if ($line =~ m/Server uptime: (.*)$/) { $uptime = $1; last STATUSLOOP }
  elsif ($line =~ m/Server at/) { $server = $line; last STATUSLOOP }
}
 
@status = split /\n/, get('http://localhost:80/server-status?auto');
 
my ($access_count, $bytes_sent);
 
for my $line (@status) {
  if ($line =~ m/Total Accesses: (\d+)/) { $access_count = $1 }
  elsif ($line =~ m/Total kBytes: (\d+)/) { $bytes_sent = $1 * 1024 }
}
 
 
if ($output eq "hits") {
  print "$access_count\n" for (1..2);
}
elsif ($output eq "bytes") {
  print "$bytes_sent\n" for (1..2);
}
else { 
print "$uptime\n";
print "$server";
} 
__END__
Je pense que c'est le 'get' qui pose un problème (?)
Quelqu'un pourrait il me dire si ce script pourrait s'adapter pour Windows ?
Sachant que c'est un langage que n'ai absolument jamais pratiqué ...

Merci d'avance