简体   繁体   English

Perl LWP不起作用

[英]Perl LWP does not work

I'm using Padre as my IDE with Strawberry Perl on Windows 7 Pro. 我在Windows 7 Pro上将Padre用作草莓Perl的IDE。

I'm trying to create a perl script that goes to a text file on a website, and then reads/copies the text file. 我正在尝试创建一个Perl脚本,该脚本将转到网站上的文本文件,然后读取/复制该文本文件。

But I can't get LWP to work even for the simplest LWP command ever. 但是即使有史以来最简单的LWP命令,我也无法使LWP工作。

#!/usr/bin/perl
   use strict;
   use warnings;
   use LWP::Simple;

   getprint('http://www.perlmeme.org') or die 'Unable to get page';

   exit 0;

I keep getting this error message: 500 can't connect to proxy.sn.no:8001 (Bad hostname) eg 500 can't connect to (Bad hostname) http://www.perlmeme.org 我不断收到此错误消息:500无法连接到proxy.sn.no:8001(错误的主机名),例如500无法连接至(错误的主机名) http://www.perlmeme.org

I've been googling around, used Microsoft Fixit to reset ports, etc but I still can't make it work. 我一直在搜索,使用Microsoft Fixit重置端口,等等,但是我仍然无法使其正常工作。 http//www.justskins.com/forums/lwp-connect-failing-bad-119421.html http // www.justskins.com / forums / lwp-connect-failing-bad-119421.html

Can anyone help me out here? 有人可以帮我从这里出去吗? Been stuck for many hours :( 被困了很多小时:(

Edit: 编辑:

--1 foreach my $key (keys %ENV) { print "$key: $ENV{$key}\\n" if $key =~ m/proxy/i; -1 foreach我的$ key(键%ENV){如果$ key =〜m / proxy / i,则打印“ $ key:$ ENV {$ key} \\ n”; } }

Yes it prints out FTP_PROXY and HTTP_PROXY both followed by this: http://proxy.sn.no:8001/ 是的,它同时打印出FTP_PROXY和HTTP_PROXY,并都显示以下内容: http ://proxy.sn.no:8001/

That's the proxy that I got from this helpthread How do I install a module? 那就是我从此帮助线程获得的代理。 如何安装模块? Strawberry Perl issues 草莓Perl问题

I had the proxy problem, then I tried the config from that thread, then the proxy problem was still there. 我遇到了代理问题,然后尝试从该线程进行配置,然后代理问题仍然存在。

--2 I'm not expecting any proxy to be used on my end or anything. --2我不希望在我端使用任何代理或任何东西。 Just wanna connect the perl script to the website to retrieve a text document. 只需将perl脚本连接到网站即可检索文本文档。

--3 ping had 0% loss. --3 ping的损失为0%。 (I can only post two hyperlinks in this post) (我只能在此帖子中发布两个超链接)

--4 I'm using Windows. --4我正在使用Windows。

LWP will honor the http_proxy environment variable and try to use it as an HTTP proxy. LWP将遵守http_proxy环境变量,并尝试将其用作HTTP代理。 Check with env | grep http_proxy 与环境核对env | grep http_proxy env | grep http_proxy on Unix. Unix上的env | grep http_proxy

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM