Perl:curl:(1)协议’http不支持或禁用libcurl

我试图让这个脚本在调试器中运行。

我有Aptana Epic ActivePerl 5.12.4在Windows 7×64上工作。脚本开始正常,但我收到一个错误

curl -sS http://intranet.mycompany.org/directory/directory.xml

上面的命令工作正常…但如果我启动调试器,我得到这个错误

curl: (1) Protocol 'http not supported or disabled in libcurl

脚本的第一部分如下:

#!/usr/bin/perl
use strict;

use XML::Parser;
use Data::Dumper;

my $url = 'http://intranet.atlanticgeneral.org/directory/directory.xml';
my $output = 'C:\global.gabook';

my $file = "curl -sS '$url' |";
my $parser = new XML::Parser(Style => 'Tree');
my $tree = $parser->parsefile($file)->[1];

解决方法

Windows不喜欢命令中的单引号。尝试在命令中使用双引号,使用qq {}转义。只需更改一行:
my $file = qq{curl -sS "$url" |};

相关文章

1. 如何去重 #!/usr/bin/perl use strict; my %hash; while(...
最近写了一个perl脚本,实现的功能是将表格中其中两列的数据...
表的数据字典格式如下:如果手动写MySQL建表语句,确认麻烦,...
巡检类工作经常会出具日报,最近在原有日报的基础上又新增了...
在实际生产环境中,常常需要从后台日志中截取报文,报文的形...
最近写的一个perl程序,通过关键词匹配统计其出现的频率,让...