Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

eibwen's scratchpad

by eibwen (Friar)
on May 10, 2005 at 16:58 UTC ( [id://455663]=scratchpad: print w/replies, xml ) Need Help??

Re: Script to update your PPM Repositories -- Testing for a ping reply on the various protocols supported by Net::Ping proved fairly simple; however I opted for minimalist output in the interest of clean and concise code (hence why I didn't post this particular update to the thread proper).

Adding repository status messages (eg "$repository is alive" or "$repository is unresponsive to $_ ping") is fairly trivial; however determining when a repository is unresponsive to all ping attempts (eg "dead") appears to complicate the code more than the presumed benefit.

use strict; use warnings; use PPM::Repositories; use Net::Ping; foreach my $repository (split(/[\r\n]/, `ppm rep`)) { next unless $repository =~ s/^\[[\d\ ]+\]\ (.*)$/$1/; system("ppm rep delete $repository > NUL") unless $repository =~ / +activestate/i; } foreach my $repository (keys %Repositories) { my $domain = my $location = $Repositories{$repository}->{location} +; next unless $domain =~ s|^\s*http://([^/]+)/.*$|$1|; foreach (qw/tcp udp icmp stream syn external/) { next unless Net::Ping->new($_)->ping($domain); system("ppm repository add $repository $location > NUL"); last; } } print $/, `ppm rep`;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-03-29 15:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found