Made archive method import runtime and not compiletime.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@618 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2003-07-09 08:24:09 +00:00
parent 70cb2f31ac
commit afb586fdbb
1 changed files with 6 additions and 5 deletions

View File

@ -69,11 +69,12 @@ if ( ZM_OPT_UPLOAD )
# or don't want to use that format # or don't want to use that format
if ( ZM_UPLOAD_ARCH_FORMAT eq "zip" ) if ( ZM_UPLOAD_ARCH_FORMAT eq "zip" )
{ {
use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); use Archive::Zip;
import Archive::Zip qw( :ERROR_CODES :CONSTANTS );
} }
else else
{ {
use Archive::Tar; require Archive::Tar;
} }
use Net::FTP; use Net::FTP;
} }
@ -403,17 +404,17 @@ sub uploadArchFile
my $zip = Archive::Zip->new(); my $zip = Archive::Zip->new();
print( "Creating upload file '$arch_file'\n" ); print( "Creating upload file '$arch_file'\n" );
my $status = AZ_OK; my $status = &AZ_OK;
foreach my $image_file ( <*$arch_image_path> ) foreach my $image_file ( <*$arch_image_path> )
{ {
print( "Adding $image_file\n" ); print( "Adding $image_file\n" );
my $member = $zip->addFile( $image_file ); my $member = $zip->addFile( $image_file );
last unless ( $member ); last unless ( $member );
$member->desiredCompressionMethod( (ZM_UPLOAD_ARCH_COMPRESS)?COMPRESSION_DEFLATED:COMPRESSION_STORED ); $member->desiredCompressionMethod( (ZM_UPLOAD_ARCH_COMPRESS)?&COMPRESSION_DEFLATED:&COMPRESSION_STORED );
} }
$status = $zip->writeToFileNamed( $arch_file ); $status = $zip->writeToFileNamed( $arch_file );
if ( $arch_error = ($status != AZ_OK) ) if ( $arch_error = ($status != &AZ_OK) )
{ {
print( "Zip error: $status\n " ); print( "Zip error: $status\n " );
} }