Search code examples
perlextractwarphp-ziparchive

Why do I get the error -- "Cannot determine file type for '/tmp/test.war'"?


I'm on Mac 10.7,5 and using Perl version

perl -version
This is perl 5, version 12, subversion 3 (v5.12.3)

I'm trying to extract a WAR file locally, so I use the command:

my $ae = Archive::Extract->new( archive => $downloadedFile );

The above line dies with the error:

Cannot determine file type for '/tmp/test.war' at ./update_artifact.pl line 57

I'm able to unzip the file with the command "unzip /tmp/test.war", so I'm not sure what else I should do to my Perl command to fix my problem. Any advice is appreciated, -


Solution

  • Archive::Extract doesn't know what the .war suffix corresponds to. It needs some help. Use type:

    my $ae = Archive::Extract->new( archive => $downloadedFile, type => 'zip' );