Archive::Zip not Ingesting Directories

Archive::Zip not Ingesting Directories

am 15.03.2007 16:01:59 von Joshua.Perlmutter

This 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:w=3D"urn:schemas-microsoft-com:office:word" =
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==--

RE: Archive::Zip not Ingesting Directories

am 15.03.2007 16:18:44 von fwashbur

This is a multi-part message in MIME format.

--===============2065719636==
Content-class: urn:content-classes:message
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C76715.3D5B9898"

This is a multi-part message in MIME format.

------_=_NextPart_001_01C76715.3D5B9898
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

I use addTree to do this and it works great, following code is an
example:

=20

=20

my $zip =3D Archive::Zip->new();

my $releaseRoot =3D "C:\\temp\\release";

my $rslt =3D $zip->addTree($releaseRoot);

$rslt =3D $zip->writeToFileNamed($zipFile);

if (!$rslt) {

print "SUCCESS\n";

} else {

AbortWithError("Failed to create zip file for release");

}

=20

________________________________

From: activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of
Perlmutter, Joshua B
Sent: Thursday, March 15, 2007 8:02 AM
To: activeperl@listserv.ActiveState.com
Subject: Archive::Zip not Ingesting Directories

=20

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_01C76715.3D5B9898
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable




charset=3Dus-ascii">









style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>I use addTree to do this and it =
works
great, following code is an example:



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> 



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>      =



style=3D'font-size:10.0pt;font-family:Arial;color:navy;font- weight:bold'>=
      my
$zip =3D Archive::Zip->new();



style=3D'font-size:10.0pt;font-family:Arial;color:navy;font- weight:bold'>=
      my
$releaseRoot =3D “C:\\temp\\release”;



style=3D'font-size:10.0pt;font-family:Arial;color:navy;font- weight:bold'>=
      my
$rslt =3D $zip->addTree($releaseRoot);



style=3D'font-size:10.0pt;font-family:Arial;color:navy;font- weight:bold'>=
     
$rslt =3D $zip->writeToFileNamed($zipFile);



style=3D'font-size:10.0pt;font-family:Arial;color:navy;font- weight:bold'>=
      if
(!$rslt) {



style=3D'font-size:10.0pt;font-family:Arial;color:navy;font- weight:bold'>=
        
print "SUCCESS\n";



style=3D'font-size:10.0pt;font-family:Arial;color:navy;font- weight:bold'>=
      }
else {



style=3D'font-size:10.0pt;font-family:Arial;color:navy;font- weight:bold'>=
        
AbortWithError("Failed to create zip file for =
release");



style=3D'font-size:10.0pt;font-family:Arial;color:navy;font- weight:bold'>=
      }



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> 





size=3D3
face=3D"Times New Roman">






style=3D'font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:
size=3D2
face=3DTahoma>
activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] style=3D'font-weight:
bold'>On Behalf Of
Perlmutter, Joshua B

Sent: Thursday, March 15, =
2007
8:02 AM

To:
activeperl@listserv.ActiveState.com

Subject: Archive::Zip not
Ingesting Directories





style=3D'font-size:
12.0pt'> 



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_01C76715.3D5B9898--

--===============2065719636==
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
--===============2065719636==--

RE: Archive::Zip not Ingesting Directories

am 15.03.2007 16:37:07 von Brian Raven

=

From: activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of
Perlmutter, Joshua B
Sent: 15 March 2007 15:02
To: activeperl@listserv.ActiveState.com
Subject: Archive::Zip not Ingesting Directories

> Dear Gurus-
> =

> I have a feeling that this will turn out to be user error

Commonly referred to as a problem between keyboard and chair. I think
most people experience those kinds of errors. I know I do.

> =

> 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.
> =

> [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);

It may have been mentioned before, but you shouldn't call subs with the
'&' prefix, unless you know what it does and you actually need it, which
should be pretty rare.

> 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' );
> =

> unless ( $zip->writeToFileNamed('SMProfile.zip') == AZ_OK ) {
> die "write error-zip: $^O";
> }
> [code snippet end]

Do $webloc and $polloc actually evaluate to a true value? You don't say.

Do the directories actually exist? You don't say, and you don't
explicitly check.

Perhaps you should also check the result of the addDirectory and addFile
calls.

I don't understand the sentence "The flat file has been moved several
times as to where I ingest that." means, or how it is relevant.

HTH

-- =

Brian Raven =


==================== =====3D=
================
Atos Euronext Market Solutions Disclaimer
==================== =====3D=
================

The information contained in this e-mail is confidential and solely for the=
intended addressee(s). Unauthorised reproduction, disclosure, modification=
, and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediat=
ely and delete it from your system. The views expressed in this message do =
not necessarily reflect those of Atos Euronext Market Solutions.

Atos Euronext Market Solutions Limited - Registered in England & Wales with=
registration no. 3962327. Registered office address at 25 Bank Street Lon=
don E14 5NQ United Kingdom. =

Atos Euronext Market Solutions SAS - Registered in France with registration=
no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 750=
09 Paris France.

L'information contenue dans cet e-mail est confidentielle et uniquement des=
tinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Tou=
te copie, publication ou diffusion de cet email est interdite. Si cet e-mai=
l vous parvient par erreur, nous vous prions de bien vouloir prevenir l'exp=
editeur immediatement et d'effacer le e-mail et annexes jointes de votre sy=
steme. Le contenu de ce message electronique ne represente pas necessaireme=
nt la position ou le point de vue d'Atos Euronext Market Solutions.
Atos Euronext Market Solutions Limited Soci=E9t=E9 de droit anglais, enregi=
str=E9e au Royaume Uni sous le num=E9ro 3962327, dont le si=E8ge social se =
situe 25 Bank Street E14 5NQ Londres Royaume Uni.

Atos Euronext Market Solutions SAS, soci=E9t=E9 par actions simplifi=E9e, e=
nregistr=E9 au registre dui commerce et des soci=E9t=E9s sous le num=E9ro 4=
25 100 294 RCS Paris et dont le si=E8ge social se situe 6/8 Boulevard Hauss=
mann 75009 Paris France.
==================== =====3D=
================

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

RE: Archive::Zip not Ingesting Directories

am 15.03.2007 16:46:31 von Joshua.Perlmutter

Brian-

>Do $webloc and $polloc actually evaluate to a true value? You don't
say.

Yes, I initially set them to 0 and then change them if a location is
found, to the location (I believe that should make them true since they
are not 0)

>Do the directories actually exist? You don't say, and you don't
>explicitly check.

>Perhaps you should also check the result of the addDirectory and
addFile
>calls.

I'm new to Archive::Zip (this is my first time using it) I'll go add
those check now and see if that is working.

>I don't understand the sentence "The flat file has been moved several
>times as to where I ingest that." means, or how it is relevant.

The file is a flat text file that is created by the program and made in
the same directory. Where I had it added in relation to the directories
was originally first, then in the center, trying to see if that would
make a difference.

Thank you for the fast response.

-Josh


HTH

--
Brian Raven
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

RE: Archive::Zip not Ingesting Directories

am 15.03.2007 17:09:50 von Joshua.Perlmutter

This is a multi-part message in MIME format.

--===============1402237918==
Content-class: urn:content-classes:message
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C7671C.5C985B3D"

This is a multi-part message in MIME format.

------_=_NextPart_001_01C7671C.5C985B3D
Content-Type: text/plain;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

Thank you Frederick, that worked like a charm.

=20

-Josh

=20

________________________________

From: Washburn, Frederick [mailto:fwashbur@qualcomm.com]=20
Sent: Thursday, March 15, 2007 11:19 AM
To: Perlmutter, Joshua B; activeperl@listserv.ActiveState.com
Subject: RE: Archive::Zip not Ingesting Directories

=20

I use addTree to do this and it works great, following code is an
example:

=20

=20

my $zip =3D Archive::Zip->new();

my $releaseRoot =3D "C:\\temp\\release";

my $rslt =3D $zip->addTree($releaseRoot);

$rslt =3D $zip->writeToFileNamed($zipFile);

if (!$rslt) {

print "SUCCESS\n";

} else {

AbortWithError("Failed to create zip file for release");

}

=20

________________________________

From: activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of
Perlmutter, Joshua B
Sent: Thursday, March 15, 2007 8:02 AM
To: activeperl@listserv.ActiveState.com
Subject: Archive::Zip not Ingesting Directories

=20

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_01C7671C.5C985B3D
Content-Type: text/html;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:st1=3D"urn:schemas-microsoft-com:office:smarttags" =
xmlns=3D"http://www.w3.org/TR/REC-html40">


charset=3Dus-ascii">

namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags" =
name=3D"City"/>
namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags"
name=3D"place"/>









style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Thank you w:st=3D"on"> w:st=3D"on">Frederick, that worked like a =
charm.



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> 



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>-Josh



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> 





size=3D3
face=3D"Times New Roman">






style=3D'font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:
size=3D2
face=3DTahoma> =
Washburn,
Frederick [mailto:fwashbur@qualcomm.com]

Sent: Thursday, March 15, =
2007
11:19 AM

To: Perlmutter, Joshua B;
activeperl@listserv.ActiveState.com

Subject: RE: Archive::Zip =
not
Ingesting Directories





style=3D'font-size:
12.0pt'> 



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>I use addTree to do this and it =
works
great, following code is an example:



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> 



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>      =



style=3D'font-size:10.0pt;font-family:Arial;color:navy;font- weight:bold'>=
     
my $zip =3D Archive::Zip->new();



style=3D'font-size:10.0pt;font-family:Arial;color:navy;font- weight:bold'>=
     
my $releaseRoot =3D =
“C:\\temp\\release”;



style=3D'font-size:10.0pt;font-family:Arial;color:navy;font- weight:bold'>=
     
my $rslt =3D =
$zip->addTree($releaseRoot);



style=3D'font-size:10.0pt;font-family:Arial;color:navy;font- weight:bold'>=
     
$rslt =3D =
$zip->writeToFileNamed($zipFile);



style=3D'font-size:10.0pt;font-family:Arial;color:navy;font- weight:bold'>=
     
if (!$rslt) {



style=3D'font-size:10.0pt;font-family:Arial;color:navy;font- weight:bold'>=
        
print "SUCCESS\n";



style=3D'font-size:10.0pt;font-family:Arial;color:navy;font- weight:bold'>=
     
} else {



style=3D'font-size:10.0pt;font-family:Arial;color:navy;font- weight:bold'>=
        
AbortWithError("Failed to create zip file for =
release");



style=3D'font-size:10.0pt;font-family:Arial;color:navy;font- weight:bold'>=
     
}



style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> 





size=3D3
face=3D"Times New Roman">






style=3D'font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:
size=3D2
face=3DTahoma>
activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] style=3D'font-weight:
bold'>On Behalf Of
Perlmutter, Joshua B

Sent: Thursday, March 15, =
2007
8:02 AM

To:
activeperl@listserv.ActiveState.com

Subject: Archive::Zip not =
Ingesting
Directories





style=3D'font-size:
12.0pt'> 



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_01C7671C.5C985B3D--

--===============1402237918==
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
--===============1402237918==--