【问题标题】:unzip the file in perl在perl中解压文件
【发布时间】:2014-04-20 03:13:34
【问题描述】:

我的脚本:
#!/usr/local/bin/perl

use POSIX qw(strftime);
use strict;
use warnings;
use Getopt::Long;

my ($artifact, $package_id) = @ARGV;
print $artifact;
print $package_id;


if($artifact =~ /\.zip$/i)
    {
    chdir("/apps/checkout/artifactory/xxkintana/$package_id");
    unzip  $artifact;

 }

运行:./script.pl test-1.0.zip 4370177

错误:

无法在 ./script.pl 第 16 行通过包“test-1.0.zip”找到对象方法“unzip”(也许您忘记加载“test-1.0.zip”?)。

请帮帮我

-谢谢

【问题讨论】:

    标签: perl perl-module


    【解决方案1】:

    使用模块 Archive::Zip 从 zip 存档中提取文件。

    该模块包含一个examples directory,其中一个名为extract.pl

    【讨论】:

    • 谢谢米勒..我从你给出的例子中得到了。我的 $zip = Archive::Zip->new();我的 $status = $zip->read($artifact); $zip->extractTree();
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多