当我运行下面的脚本的时候,报错“Protocol scheme 'http' is not supported,_rc==>501”.
经过测试发现原来缺少安装Net::HTTP module.因为LWP::UserAgent 需要Net::HTTP.
##!/bin/sh
# Source needed files
. /home/citminst/sqllib/db2profile
exec /opt/freeware/bin/perl5.8.8 -x $0 $@
#!perl
#line 9
use strict;
use LWP;
use URI::Escape;
my $uid='test@cn.ibm.com';
my $browser = LWP::UserAgent->new;
my $response = $browser->get("http://bluepages.ibm.com/BpHttpApisv3/wsapi?byInternetAddr=" . uri_escape($uid));
while ( my ($key,$value) = each %$response ) {
print "$key => $value\n";
}
if ( $response->is_success ) {
print "--------success\n";
}else {
print"-------failed\n";
}
经过测试发现原来缺少安装Net::HTTP module.因为LWP::UserAgent 需要Net::HTTP.