[英]PAR::Packer and HTTPS in LWP::UserAgent
I have a simple Perl which uses LWP::UserAgent to connect to HTTPS and decode JSON result: 我有一个简单的Perl,它使用LWP :: UserAgent连接到HTTPS并解码JSON结果:
my $self = shift;
my $text = shift;
my $ua = new LWP::UserAgent;
my $response = $ua -> get ($self -> getReqLink($text));
$response = parse_json($response -> decoded_content);
return decode('utf-8', $response -> {text} -> [0]);
It works fine if I run Perl script. 如果我运行Perl脚本,它工作正常。 I packed it with pp:
我用pp包装它:
pp -c -o maker.exe maker.pl
And I get and error if I run maker.exe: 如果我运行maker.exe,我得到并出错:
JSON error at line 1, byte 1/170: Unexpected character 'S' parsing initial state: expecting whitespace: '\n', '\r', '\t', ' ' or start of an array or object: '{', '[' at Translation/YandexTranslator.pm line 30.
What's wrong? 怎么了?
-x
when you run PP. -x
。 It will add run-time dependencies and generate a more reliable executable for you. use warnings
and use strict
at the top of your code.See if there is any potential problem. use warnings
并在代码顶部use strict
。查看是否存在任何潜在问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.