perl lwp 超时问题
lwp 超时问题: jrhmpt01:/root/async# cat a1.pl
use LWP::UserAgent;
use utf8;
use DBI;
use POSIX;
use Data::Dumper;
use HTML::TreeBuilder;
use HTML::TreeBuilder::XPath;
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
$ua->agent("Mozilla/8.0");
#my $response = $ua->get('http://data.10jqka.com.cn/financial/yjyg/date/2016-03-31/board/ALL/field/enddate/order/desc/page/1/ajax/1/');
#my $response = $ua->get('http://data.10jqka.com.cn/financial/yjyg/'); my $response = $ua->get('http://120.55.11x.6:3000/api/env?ip=192.168.32.101');
if ($response->is_success) {
print $response->decoded_content; # or whatever
}
else
{print $response->decoded_content; }; 设置超时时间为 $ua->timeout(10); 结果如下:
jrhmpt01:/root/async# time perl a1.pl
500 read timeout real 0m10.192s
user 0m0.169s
sys 0m0.016s 服务端在10秒内没返回,就超时
perl lwp 超时问题的更多相关文章
- perl lwp 默认的请求头
</pre><pre name="code" class="html">[root@dr-mysql01 ~]# cat getx.pl ...
- perl lwp 获取请求头
<pre name="code" class="html">[root@dr-mysql01 ~]# cat getx.pl use LWP::Us ...
- perl LWP::UserAgent获取源码与响应
#!/usr/bin/perl -w use strict; use LWP::UserAgent; my $useragent = new LWP::UserAgent; my $url = 'ht ...
- perl lwp get uft-8和gbk
gbk编码: jrhmpt01:/root/lwp# cat x2.pl use LWP::UserAgent; use DBI; $user="root"; $passwd='R ...
- perl lwp关闭ssl校验
use LWP::UserAgent; use HTTP::Cookies; use HTTP::Headers; use HTTP::Response; use Encode; use File:: ...
- perl 异步超时 打印错误
#!/usr/bin/perl use AnyEvent; use AnyEvent::HTTP; my $cv = AnyEvent->condvar; sub doit{ my $url = ...
- perl lwp编码
$var= $response->content; $var= $response->decoded_content;
- Perl系列文章
0.Perl书籍推荐 Perl书籍下载 密码:kkqx 下面是一些我学习Perl过程中读过完整的或部分章节的觉得好的书. 入门级别1:<Perl语言入门>即小骆驼 入门级别2:<In ...
- (转) [it-ebooks]电子书列表
[it-ebooks]电子书列表 [2014]: Learning Objective-C by Developing iPhone Games || Leverage Xcode and Obj ...
随机推荐
- .aspx.cs传值与取值
1:.aspx中post传值 $.post("ABP_ExchangeRatelz.aspx", { option: "isdelete", Ori_Curre ...
- 成功的背后!(给所有IT人)----转载:来自CSDN第一名博主
转载:来自CSDN第一名博主:http://blog.csdn.net/phphot/article/details/2187505 放在这里激励你我! 正文: 成功的背后,有着许多不为人知的故事,而 ...
- FORM表单不刷新提交POST数据
很多时候表单太多项,JQ懒的去处理了 使用这个提交吧.和她讨论出去旅游,去哪里好呢,此时还和以前一样吗? function testaction(){ var f = $("#publish ...
- poj 3228 Gold Transportation 二分+网络流
题目链接 给出n个城市, 每个城市有一个仓库, 仓库有容量限制, 同时每个城市也有一些货物, 货物必须放到仓库中. 城市之间有路相连, 每条路有长度. 因为有些城市的货物量大于仓库的容量, 所以要运到 ...
- 在实体对象中访问导航属性里的属性值出现异常“There is already an open DataReader associated with this Command which must be closed first”
在实体对象中访问导航属性里的属性值出现异常“There is already an open DataReader associated with this Command which must be ...
- 谷歌日志库GLog 使用说明
1 引用头文件 加载库 #include <glog/include/logging.h> #pragma comment(lib,"libglog.lib") 2 初 ...
- nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException
You should autowire interface AbstractManager instead of class MailManager. If you have different im ...
- Primefaces 中e.offset(...)问题的处理
问题 在使用Primefaces构建的页面中,原来好好的页面莫名奇异的出现下拉框不能显示数据且点击没有反应的情况.后来通过firefox发现其JS抛出了一个e.offset(...)错误 解决方法 经 ...
- Android 中万能的 BaseAdapter(Spinner,ListView,GridView) 的使用!
大家好!今天给大家讲解一下BaseAdapter(基础适配器)的用法,适配器的作用主要是用来给诸如(Spinner,ListView,GridView)来填充数据的.而(Spinner,ListVie ...
- IOS开发之----协议与委托(Protocol and Delegate) 实例解析
1 协议: 协议,类似于Java或C#语言中的接口,它限制了实现类必须拥有哪些方法. 它是对对象行为的定义,也是对功能的规范. 在写示例之前我给大家说下@required和@optional这两个关键 ...