File indexing completed on 2024-04-28 03:42:51

0001 #!/usr/bin/perl -w
0002 use strict;
0003 use LWP::Simple;
0004 
0005 if ( $#ARGV != 0 ) {
0006     print "Usage: ./check_url.pl <filename>\n\n";
0007     exit(1);
0008 }
0009 
0010 open( INF, $ARGV[0] );
0011 
0012 while ( my $line = <INF> ) {
0013     chomp($line);
0014     my $i1 = index( $line, ":" );
0015     my $i2 = index( $line, "http" );
0016 
0017     if ( $i1 > -1 && $i2 > -1 ) {
0018     my $name = substr( $line, 0, $i1 );
0019     my $url = substr( $line, $i2 );
0020 
0021     &img_check($name, $url);
0022     }
0023 }
0024 
0025 close( INF );
0026 exit;
0027 
0028 
0029 sub img_check {
0030     my $name = shift;
0031     my $url = shift;
0032 
0033     if (head($url)) {
0034     } else {
0035     print "$name: $url\n";
0036     }
0037 } # end sub url_check