Perl PP 正在 /script/ 内搜索输出脚本
我有一个非常奇怪的问题,但只有在运行 Ubuntu 时(在 CentOS 上一切正常)。 我用 Perl 编写了一个脚本,并使用了 Mail::IMAPClient 模块。
当我运行以下命令时:
pp -o myapp perlscript.pl
一切正常,但是当我尝试执行二进制脚本(myapp)时,它给出以下错误:
Cannot connect through IMAPClient: No such file or directory at script/perlscript.pl line 22.
但是当我运行 perlscript.pl 时一切正常...... ..
你知道为什么吗?
脚本:
#!/usr/bin/perl
use strict;
use Mail::IMAPClient;
use Data::Dumper;
use MIME::QuotedPrint ();
$|=1;
# Vars
my $odate = `date +'%d/%m/%Y'`; chomp($odate);
$odate = '15/01/2012';
my $timeout = 120;
# Connect to IMAP server
my $imap = Mail::IMAPClient->new(
Server => 'imap.gmail.com',
User => '[email protected]',
Password => 'my_password',
Port => 993,
Ssl => 1,
)
or die "Cannot connect through IMAPClient: $!";
I have a really strange problem but only when running Ubuntu ( on CentOS evertyhing is working ).
I've made a script in Perl and used the Mail::IMAPClient module.
When I run the following command:
pp -o myapp perlscript.pl
Everything is working, but when I'm trying to execute the binary script (myapp), it gives me the following error:
Cannot connect through IMAPClient: No such file or directory at script/perlscript.pl line 22.
But when I'm running the perlscript.pl everything is OK ......
Do you have any idea why?
script:
#!/usr/bin/perl
use strict;
use Mail::IMAPClient;
use Data::Dumper;
use MIME::QuotedPrint ();
$|=1;
# Vars
my $odate = `date +'%d/%m/%Y'`; chomp($odate);
$odate = '15/01/2012';
my $timeout = 120;
# Connect to IMAP server
my $imap = Mail::IMAPClient->new(
Server => 'imap.gmail.com',
User => '[email protected]',
Password => 'my_password',
Port => 993,
Ssl => 1,
)
or die "Cannot connect through IMAPClient: $!";
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您以错误的方式进行错误检查。 您必须检查
$@
,而不是$!
,对于构造函数。运行修改后的程序(尚未用 pp 编译)会给出有用的错误消息:似乎您忘记告诉编译器 添加隐藏依赖项其中它无法自行检测。
You are doing the error checking wrong way. You must inspect
$@
, not$!
, for the constructor. Running the modified program (not yet compiled with pp) gives the useful error message:It seems like you forgot to tell the compiler to add the hidden dependency which it could not detect on its own.