Memoize |
BasicWerk
EC Support
Technique
Facebook
|
20140829194739_Perl_get_http_status_template |
Perl_get_http_status_template
#! /usr/bin/perl use warnings; use strict; use LWP; use HTTP::Status; my $ua = LWP::UserAgent->new(); sub get_http_status { my ($url, $ua) = @_; return unless $url or $ua; my $response = $ua->head($url); my $msg = status_message($response->code); return $msg; } while (my $url=<>) { chomp $url; my $http_status = get_http_status($url, $ua); print "$url,$http_status\n"; }
|
© Shin Nakamura/BasicWerk 2014 |