Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Now more efficient and no longer redundant.

Additionally, it should be noted that Net::Ping::new() defaults to TCP, therefore any "dead" repository merely failed to reply to a TCP ping. Some "dead" domains will reply to alternative protocol pings (eg SourceForge does not reply to TCP, but does reply to ICMP).

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|; if (Net::Ping->new()->ping($domain)) { print "$repository is alive.\n"; system("ppm repository add $repository $location > NUL"); } else { print "$repository is dead.\n"; } } print $/, `ppm rep`;


dada is dead. smueller is alive. crazy58 is alive. crazy is alive. datetime is alive. soulcage58 is alive. bribes is alive. gtk is dead. rto is alive. spurkis is dead. theoryS is dead. jenda is dead. theory58S is dead. log4perl is dead. theory58 is dead. soulcage is alive. savage is dead. devhelp is alive. theory is dead. openi is dead. roth is alive. Repositories: [ 1] ActiveState Package Repository [ 2] ActiveState PPM2 Repository [ 3] smueller [ 4] crazy58 [ 5] crazy [ 6] datetime [ 7] soulcage58 [ 8] bribes [ 9] rto [10] soulcage [11] devhelp [12] roth

In reply to Re: Script to update your PPM Repositories by eibwen
in thread Script to update your PPM Repositories by tphyahoo

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    [vrk]: Hope he gets better soon.
    [Discipulus]: hdb sorry i profit; is known that a prime number is never a figurate one nor the sumattion of two adjacent figurates of the same order? like 3th triangular+3th tetrahedric
    [Discipulus]: if known where i can read about the matter?
    [choroba]: he's not really sick, we just got nobody to look after him today
    [Discipulus]: create an account for him; we are funny baby sitters ;=) come here child, want to listen the typeglob tale?
    [vrk]: choroba Oh, that's good.
    [vrk]: Discipulus I don't know much about prime numbers, but wouldn't that kind of an answer be in a graduate-level number theory book?
    [Discipulus]: my 8 yo daughter has two weeks of sleep disturbs.. we are gonna be crazy..

    How do I use this? | Other CB clients
    Other Users?
    Others scrutinizing the Monastery: (9)
    As of 2017-04-27 07:57 GMT
    Find Nodes?
      Voting Booth?
      I'm a fool:

      Results (501 votes). Check out past polls.