gpt4 book ai didi

Perl PP 正在/script/中搜索输出脚本

转载 作者:太空宇宙 更新时间:2023-11-03 16:55:51 27 4
gpt4 key购买 nike

我有一个非常奇怪的问题,但只有在运行 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 => 'my@email.com',
Password => 'my_password',
Port => 993,
Ssl => 1,
)
or die "Cannot connect through IMAPClient: $!";

最佳答案

您正在以错误的方式进行错误检查。 You must inspect $@ ,而不是 $!,用于构造函数。运行修改后的程序(尚未用 pp 编译)会给出有用的错误消息:

Cannot connect through IMAPClient: Unable to connect to imap.gmail.com: Unable to load 'IO::Socket::SSL': Can't locate IO/Socket/SSL.pm in @INC (@INC contains: …) at (eval 7) line 2.

你好像忘了告诉编译器 add the hidden dependency它无法自行检测到。

关于Perl PP 正在/script/中搜索输出脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8988139/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com