You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdeedu/kstars/kstars/data/check_url.pl

38 lines
589 B

#!/usr/bin/perl -w
use strict;
use LWP::Simple;
if ( $#ARGV != 0 ) {
print "Usage: ./check_url.pl <filename>\n\n";
exit(1);
}
open( INF, $ARGV[0] );
while ( my $line = <INF> ) {
chomp($line);
my $i1 = index( $line, ":" );
my $i2 = index( $line, "http" );
if ( $i1 > -1 && $i2 > -1 ) {
my $name = substr( $line, 0, $i1 );
my $url = substr( $line, $i2 );
&img_check($name, $url);
}
}
close( INF );
exit;
sub img_check {
my $name = shift;
my $url = shift;
if (head($url)) {
} else {
print "$name: $url\n";
}
} # end sub url_check