IO 错误:寻找本地标头:使用 Archive::Zip、PERL 从远程服务器读取时
想要从远程 zip 文件中的 .csv 文件读取内容,而无需下载和下载将 zip 文件解压到本地计算机。
我需要这个,因为文件 zip 文件太大,需要时就下载它 需要更长的时间。
我正在 perl 中尝试这个。
我的代码是: 我的 $ftp = Net::FTP::AutoReconnect->new("ftp.somename.com"); $ftp->login("用户","密码"); $ftp->cwd("路径");
my $fh = Net::FTP::RetrHandle->new($ftp,"filename.zip");
my $zip = Archive::Zip->new($fh);
my @member_names = $zip->memberNames();
my $member1 = $zip->memberNamed("Basic/BoardDescriptions.csv");
my $string = $member1->contents();
print Dumper $string;
我在调用内容方法时遇到 io::seeking to local header 错误, 直到那个声明我猜代码工作正常。
预先感谢任何尝试过的人。 谢谢。
Want to read the contents from a .csv file which is in a remote zip file without downloading & extracting the zip file to local machine.
I need this because the file zip file size is too large and downloading it whenever needed
takes longer time.
I am trying this in perl.
My code is :
my $ftp = Net::FTP::AutoReconnect->new("ftp.somename.com");
$ftp->login("user","password");
$ftp->cwd("path");
my $fh = Net::FTP::RetrHandle->new($ftp,"filename.zip");
my $zip = Archive::Zip->new($fh);
my @member_names = $zip->memberNames();
my $member1 = $zip->memberNamed("Basic/BoardDescriptions.csv");
my $string = $member1->contents();
print Dumper $string;
I get io::seeking to local header error while calling contents method,
till that statement i guess the code is working fine.
Thanks in advance to any one who gives a try to it.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的猜测是这不是 Archive::ZIP 的错..
你能打印@member_names吗?
虽然 Net: :FTP::RetrHandle 确实承诺了这一点:
尝试对另一台服务器上的另一个文件执行相同的操作。
My guess is that this is not Archive::ZIP 's fault ..
can you print @member_names ?
It's not obvious how your'e suppose to extract an individual file, although Net::FTP::RetrHandle does promise it:
Try doing the same with another file from another server..