Bekomme bei Nutzung von
Archive::Zip diese Fehlermeldung:
Can't call method "desiredCompressionLevel" on an undefined value at C:/strawberry/perl/vendor/lib/Archive/Zip/Archive.pm line 249.
Wenn ich mir das in der Archive.pm anschaue
1
2
3
4
5
6
7
8
9
10
11
12
sub addFile {
my $self = shift;
my ( $fileName, $newName, $compressionLevel );
if ( ref( $_[0] ) eq 'HASH' ) {
$fileName = $_[0]->{filename};
$newName = $_[0]->{zipName};
$compressionLevel = $_[0]->{compressionLevel};
}
else {
( $fileName, $newName, $compressionLevel ) = @_;
}
dann habe ich den Eindruck, bei der Methode
addFile() müsse man einige Parameter angeben.
In der Doku auf CPAN steht hingegen das:
QuoteaddFile( $fileName [, $newName ] )
Append a member whose data comes from an external file, returning the member or undef. The member will have its file name set to the name of the external file, and its desiredCompressionMethod set to COMPRESSION_DEFLATED. The file attributes and last modification time will be set from the file. If the name given does not represent a readable plain file or symbolic link, undef will be returned. $fileName must be in the format required for the local file system. The optional $newName argument sets the internal file name to something different than the given $fileName. $newName, if given, must be in Zip name format (i.e. Unix). The text mode bit will be set if the contents appears to be text (as returned by the -T perl operator).
Dieser
desiredCompressionLevel wird aber laut Doku auf das Member Objekt gesetzt, nicht auf das
addFile() Objekt
$member->desiredCompressionLevel( 9 );
Übersehe ich etwas oder kapiere ich es nur wieder mal nicht?
Wie macht man das richtig?
10 print "Hallo"
20 goto 10