Archive::Zip not Ingesting Directories
am 15.03.2007 16:01:59 von Joshua.PerlmutterThis is a multi-part message in MIME format.
--===============0184376066==
Content-class: urn:content-classes:message
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C76712.E208BE20"
This is a multi-part message in MIME format.
------_=_NextPart_001_01C76712.E208BE20
Content-Type: text/plain;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable
Dear Gurus-
=20
I have a feeling that this will turn out to be user error
=20
I have the following code snippet and it refuses to zip up the
directories. The flat file has been moved several times as to where I
ingest that. It is the ONLY thing in the zip each time.
It is also the ONLY file that is a relative path and therefore the only
one with an apriori knowledge of where it will be.
=20
[code snippet begin]
# create archive using SMInf and configs/logs
# this builds to what should be default logs/configs directories
my $zip =3D Archive::Zip->new();
&rep("silent debug locations:\nwebloc: $webloc\npolloc: $polloc",0);
if($webloc){
my $config=3D"$webloc/config/";
my $logd=3D"$webloc/log/";
my $dir_member =3D $zip->addDirectory( $config );
$dir_member =3D $zip->addDirectory( $logd );
&rep("silent debug specific-wa:\nconfig: $config\nlogd: $logd",0);
}
if($polloc){
my $config=3D"$polloc/config/"; $config =3D~ s/\\/\//g;
my $logd=3D"$polloc/log/"; $logd =3D~ s/\\/\//g;
my$dir_member =3D $zip->addDirectory( $config );
$dir_member =3D $zip->addDirectory( "$logd" );
&rep("silent debug specific-ps:\nconfig: $config\nlogd: $logd",0);
}
my $file_member =3D $zip->addFile( 'SMInf.txt' );
=20
unless ( $zip->writeToFileNamed('SMProfile.zip') == AZ_OK ) {
die "write error-zip: $^O";
}
[code snippet end]
=20
Josh Perlmutter
=20
This e-mail and any files transmitted with it are for the sole use of
the intended recipient(s) and contain information that may be privileged
and confidential. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the intended recipient of
this e-mail, please delete this e-mail and any files transmitted with it
and notify the sender immediately.
=20
------_=_NextPart_001_01C76712.E208BE20
Content-Type: text/html;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable
xmlns=3D"http://www.w3.org/TR/REC-html40">
charset=3Dus-ascii">
style=3D'font-size:10.0pt;
font-family:Arial'>Dear Gurus-
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>I have a feeling that this will turn out to be user =
error
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>I have the following code snippet and it refuses to =
zip up
the directories. The flat file has been moved several times as to where =
I ingest
that. It is the ONLY thing in the zip each =
time.
style=3D'font-size:10.0pt;
font-family:Arial'>It is also the ONLY file that is a relative path and
therefore the only one with an apriori knowledge of where it will =
be.
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>[code snippet begin]
style=3D'font-size:10.0pt;
font-family:Arial'># create archive using SMInf and =
configs/logs
style=3D'font-size:10.0pt;
font-family:Arial'># this builds to what should be default logs/configs
directories
style=3D'font-size:10.0pt;
font-family:Arial'>my $zip =3D =
Archive::Zip->new();
style=3D'font-size:10.0pt;
font-family:Arial'>&rep("silent debug locations:\nwebloc:
$webloc\npolloc: $polloc",0);
style=3D'font-size:10.0pt;
font-family:Arial'>if($webloc){
style=3D'font-size:10.0pt;
font-family:Arial'> my =
$config=3D"$webloc/config/";
style=3D'font-size:10.0pt;
font-family:Arial'> my =
$logd=3D"$webloc/log/";
style=3D'font-size:10.0pt;
font-family:Arial'> my $dir_member =3D $zip->addDirectory( =
$config );
style=3D'font-size:10.0pt;
font-family:Arial'> $dir_member =3D $zip->addDirectory( $logd =
);
style=3D'font-size:10.0pt;
font-family:Arial'> &rep("silent debug =
specific-wa:\nconfig:
$config\nlogd: $logd",0);
style=3D'font-size:10.0pt;
font-family:Arial'>}
style=3D'font-size:10.0pt;
font-family:Arial'>if($polloc){
style=3D'font-size:10.0pt;
font-family:Arial'> my $config=3D"$polloc/config/"; =
$config =3D~
s/\\/\//g;
style=3D'font-size:10.0pt;
font-family:Arial'> my $logd=3D"$polloc/log/"; $logd =
=3D~
s/\\/\//g;
style=3D'font-size:10.0pt;
font-family:Arial'> my$dir_member =3D $zip->addDirectory( =
$config );
style=3D'font-size:10.0pt;
font-family:Arial'> $dir_member =3D $zip->addDirectory(
"$logd" );
style=3D'font-size:10.0pt;
font-family:Arial'> &rep("silent debug =
specific-ps:\nconfig:
$config\nlogd: $logd",0);
style=3D'font-size:10.0pt;
font-family:Arial'>}
style=3D'font-size:10.0pt;
font-family:Arial'>my $file_member =3D $zip->addFile( 'SMInf.txt' =
);
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>unless ( $zip->writeToFileNamed('SMProfile.zip') =
== AZ_OK
) {
style=3D'font-size:10.0pt;
font-family:Arial'> die "write error-zip: =
$^O";
style=3D'font-size:10.0pt;
font-family:Arial'>}
style=3D'font-size:10.0pt;
font-family:Arial'>[code snippet end]
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>Josh Perlmutter
style=3D'font-size:
12.0pt'>
style=3D'font-size:8.0pt;
font-family:Verdana'>This e-mail and any files transmitted with it are =
for the
sole use of the intended recipient(s) and contain information that may =
be
privileged and confidential. Any unauthorized review, use, =
disclosure or
distribution is prohibited. If you are not the intended recipient =
of this
e-mail, please delete this e-mail and any files =
transmitted with it
and notify the sender immediately.
style=3D'font-size:
12.0pt'>
------_=_NextPart_001_01C76712.E208BE20--
--===============0184376066==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0184376066==--