summaryrefslogtreecommitdiffstats
path: root/kstars/kstars/data/check_url.pl
blob: a95429768d0dcd7856b3cf39120b55439b5f589f (plain)
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
#!/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