Annotation of loncom/debugging_tools/get_version.pl, revision 1.2

1.1       albertel    1: open(HOST,"<$ARGV[0]");
                      2: my $i++;
                      3: my %vers;
                      4: my %done;
                      5: while(my $line=<HOST>) {
                      6:     if ($line=~/^\#/) { next; }
                      7:     my $host=(split(':',$line))[3];
                      8:     chomp($host);
                      9:     if (!$host || exists($done{$host})) { next; }
                     10:     $done{$host}=1;
                     11:     print($host." -> ");
1.2     ! albertel   12:     my $ver=`curl --max-time 15 --connect-timeout 5 -s http://$host/adm/login | grep -- -200 | tr ">" "\n" | tail -1 `;
1.1       albertel   13:     $ver=~s/&nbsp;//g;
                     14:     $ver=~s/ //g;
                     15:     if ($ver eq "") { print("\n"); }
                     16:     print($ver);
                     17:     $ver=~s/\s//g;
                     18:     push(@{$vers{$ver}},$host);
                     19: #    if ($i++==14) { last; }
                     20: }
                     21: 
                     22: foreach my $key (sort(keys(%vers))) {
                     23:     print($key." -> \n");
                     24:     print("     ".join("\n     ",@{$vers{$key}})."\n");
                     25: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>