从 PERL 的 $sftp->get 或 do {...} 中获取错误文本

发布于 2024-12-15 20:21:22 字数 280 浏览 5 评论 0原文

我不是 perl 程序员,但需要调试错误。我正在使用 Net:SFTP:Foreign 包。

当我尝试获取文件时,以下调用失败:

$sftp->get(source,destination) or do { print "something goneError."}

此行返回“something goneError.”。我想要的是找出哪里出了问题!如何提取失败原因?

顺便说一句,这个脚本已经运行了几个月,没有出现任何错误。该脚本非常可靠,我只是不知道如何捕获失败的原因。

I'm not a perl programmer but need to debug an error. I'm using the Net:SFTP:Foreign package.

When I attempt to get files, the following call fails:

$sftp->get(source, destination) or do { print "something went wrong."}

This line returns "something went wrong." What I would like is to find out WHAT went wrong! How can I extract the reason for failure?

By the way, this script has been working for months without an error. The script is very reliable, I just don't know how to capture the reason for failure.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

殊姿 2024-12-22 20:21:22
$sftp->get(source, destination) or warn "get() failed with " . $sftp->error . "\n";
$sftp->get(source, destination) or warn "get() failed with " . $sftp->error . "\n";
毁我热情 2024-12-22 20:21:22
$sftp->get($source, $destination)
   or print "something went wrong: " . $sftp->error . "\n";
$sftp->get($source, $destination)
   or print "something went wrong: " . $sftp->error . "\n";
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文