[23502] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 5712 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Oct 26 09:06:00 2003

Date: Sun, 26 Oct 2003 06:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 26 Oct 2003     Volume: 10 Number: 5712

Today's topics:
    Re: -w <bmb@ginger.libs.uga.edu>
    Re: About Expect. <elp@pnsihq.com>
    Re: Cygwin and Microsoft SQL (John Call)
        Fastest Perl Interpreter <trevie@cox.net>
    Re: Fastest Perl Interpreter <dmcbride@naboo.to.org.no.spam.for.me>
    Re: Fastest Perl Interpreter (William Herrera)
    Re: Fastest Perl Interpreter <Juha.Laiho@iki.fi>
    Re: generating html from perl <wwonko@rdwarf.com>
        Getopt::Long and bundling. (Todd Aceman)
    Re: Getopt::Long and bundling. <kuujinbo@hotmail.com>
        Help with script to move email files based on date fiel <mw@stopthespam.here>
    Re: Outlook email headers <tassilo.parseval@rwth-aachen.de>
    Re: Outlook email headers <someone@somewhere.nl>
    Re: Outlook email headers <tassilo.parseval@rwth-aachen.de>
    Re: Problem using Archive::Zip ! (Bill)
        SendMail Problem <defenderjim4@no_dam_spam_juno.com>
    Re: SendMail Problem (Tad McClellan)
    Re: SendMail Problem <noreply@gunnar.cc>
    Re: SendMail Problem <defenderjim4@no_spam_juno.com>
    Re: SendMail Problem <jwillmore@remove.adelphia.net>
    Re: system command question (none) ()
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sun, 26 Oct 2003 07:59:31 -0500
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: -w
Message-Id: <Pine.A41.4.58.0310260756590.15274@ginger.libs.uga.edu>

On Wed, 22 Oct 2003, Abigail wrote:

> Brad Baxter (bmb@ginger.libs.uga.edu) wrote on MMMDCCIII September
> MCMXCIII in <URL:news:Pine.A41.4.58.0310211627160.15228@ginger.libs.uga.edu>:
> &&  One of Abigail's signature lines:
> &&
> &&  perl -swleprint -- -_=Just\ another\ Perl\ Hacker
>
> The -w made you think, didn't it? So, it does have a function...

Very good.  Thanks to all for the confirmation.

Regards,

Brad


------------------------------

Date: Sat, 25 Oct 2003 18:07:32 GMT
From: "Dr. Pastor" <elp@pnsihq.com>
Subject: Re: About Expect.
Message-Id: <EZymb.1642$Px2.155@newsread4.news.pas.earthlink.net>

Jim:
Any written or verbal comment about the successful usage of Expect on W2K
pro
would be suitable, as well as examples. (I did some search with Google.)
Regards.

"James Willmore" <jwillmore@remove.adelphia.net> wrote in message
news:20031024224845.256217d8.jwillmore@remove.adelphia.net...
> On Fri, 24 Oct 2003 21:03:25 GMT
> "Dr. Pastor" <elp@pnsihq.com> wrote:
>
> > Is there any published report about successful usage of Expect?
> > Thanks for any help!
>
> Can you be more specific?  Are you looking for examples?
>
> --
> Jim
>
> Copyright notice: all code written by the author in this post is
>  released under the GPL. http://www.gnu.org/licenses/gpl.txt
> for more information.
>
> a fortune quote ...
> I really hate this damned machine I wish that they would sell it.
> It never does quite what I want But only what I tell it.




------------------------------

Date: 26 Oct 2003 05:58:40 -0800
From: jcall@ellijay.com (John Call)
Subject: Re: Cygwin and Microsoft SQL
Message-Id: <c2dc059.0310260558.2b5d02c8@posting.google.com>

James Willmore <jwillmore@remove.adelphia.net> wrote in message news:<20031025133909.1739c92e.jwillmore@remove.adelphia.net>...
> On 25 Oct 2003 07:05:50 -0700
> jcall@ellijay.com (John Call) wrote:
> > Need to use Expect.pm on Win32. Read this is possible with Cygwin.
> > However, I need to interface with a Microsoft SQL database. Does
> > Cygwin create a virtual computer that doesn't know about windows or
> > should the perl in Cygwin be able to interface with the Microsoft
> > SQL using Win32::ODBC?
> 
> You should thinking about using the Win32::ODBC module -or- the DBI
> module using the appropriate DBD module.
> 
> I'm not sure how Expect is suppose to factor into this - because both
> Win32::ODBC and DBI (in this case) use the listening port on the
> database server to connect.  Unless you're thinking about using Expect
> to emulate a user - in which case I'm thinking you may need to
> re-think you're thinking :-)
> 
> -- 
> Jim


Sorry, I was in such a hurry I didn't make myself very clear. I need
Expect.pm so I can connect to some other boxes with ssh and then su
and run a program but since they want this running on a Win32 box I
will have to use Cygwin for Expect.pm to work. Wasn't sure if the perl
in Cygwin could see Microsoft SQL as being on the same box.

I will be using DBI or Win32::ODBC for the database connection.

Thanks,

John


------------------------------

Date: Sat, 25 Oct 2003 15:34:51 -0700
From: "Michael J. Astrauskas" <trevie@cox.net>
Subject: Fastest Perl Interpreter
Message-Id: <4UCmb.80044$vj2.6293@fed1read06>

I'm attempting build a system that needs to run a perl script very 
quickly. There will be no disk access, but the system will be doing an 
intense amount of network and processor work. Is there any particular 
processor architecture (32-bit AMD/Intel, Opteron, Sun, Apple, etc.), 
operating system, and interpreter that are known to be the most powerful 
combination?

My current idea is to use a dual Xeon with a gigabyte ethernet port and 
at least 2 GB of RAM.

Thank you for any advice, recommendations, and pointers!

-- 
  - Michael J. Astrauskas



------------------------------

Date: Sun, 26 Oct 2003 00:34:30 GMT
From: Darin McBride <dmcbride@naboo.to.org.no.spam.for.me>
Subject: Re: Fastest Perl Interpreter
Message-Id: <qEEmb.179636$pl3.35599@pd7tw3no>

Michael J. Astrauskas wrote:

> I'm attempting build a system that needs to run a perl script very
> quickly. There will be no disk access, but the system will be doing an
> intense amount of network and processor work. Is there any particular
> processor architecture (32-bit AMD/Intel, Opteron, Sun, Apple, etc.),
> operating system, and interpreter that are known to be the most powerful
> combination?

My guess, then, is that you want something that has a big network pipe
and a fast processor.  Perl is perl is perl - the only difference
between the platforms is going to be the C optimiser that you compile
perl itself with.  Well, maybe not *only*, but that will have the
largest effect other than the hardware itself.

For example, Intel promises a percentage-boost simply by compiling with
their Proton or Electron compilers over using MSVC or gcc on the same
platform.  If you compile perl 5.8.1 with the Electron compiler on
Linux/ia32, you'll probably be doing alright for your system.

> My current idea is to use a dual Xeon with a gigabyte ethernet port and
> at least 2 GB of RAM.

As soon as you have multiple CPUs, you'll only see any benefits if you
actually have a multi-threaded or multi-process system running.  That
is, at least one thread of activity per CPU.  If your program can only
do one thing at a time, that second CPU will be 90%+ wasted.

If, however, your program can run multithreaded (dangerous in perl,
last I heard) or multiprocess (i.e. fork() and do stuff in the child
process), then by all means go with the SMP setup.  Note that perl
likes fork()'s, and Windows doesn't, so you might be best off here
going with Linux instead of Windows.

> Thank you for any advice, recommendations, and pointers!

As long as you're going with commodity hardware, dual P4s will probably
saturate your gigabit ethernet.  Depending on what you're doing, you
may want dual gigabit ethernet cards, and go with 4 or more Pentium4's
for better throughput.  This only helps, of course, if the data you're
processing can come in from multiple networks or subnets.  It can
eliminate a hop for people coming in from more than one router away.

But that doesn't change much if you go away from commodity hardware. 
In general, the commercial-unix hardware (RS6000, current SPARCs, etc),
even if not running commercial unix (e.g. Linux on PPC hardware rather
than AIX on the same hardware) may get you better performance, and
possibly less downtime.  But you'll still want gigabit ethernet, and
possibly more than one.  And you'll still want SMP, if your program can
handle it.

There are so many possibilities to keep aware of that your vague
question can only get you vague answers ... but they may point you in
the right way for your situation.


------------------------------

Date: Sun, 26 Oct 2003 04:15:07 GMT
From: wherrera@lynxview.com (William Herrera)
Subject: Re: Fastest Perl Interpreter
Message-Id: <3f9b487f.1968192@news2.news.adelphia.net>

On Sat, 25 Oct 2003 15:34:51 -0700, "Michael J. Astrauskas" <trevie@cox.net>
wrote:

>I'm attempting build a system that needs to run a perl script very 
>quickly. There will be no disk access, but the system will be doing an 
>intense amount of network and processor work. 

In most cases, unless there is a large amount of calculation or disk searching
involved,  this will result in an i/o bound system, where most of the CPU
cycles are spent waiting for the network i/o to complete. In such a case,
system CPU speed will be secondary in system speed impact to network latency
issues. This may guide selection of hardware--spend more on speeding your I/O,
not necessarily your CPU.

OTOH, if your app is really CPU bound, not network bound, maybe you should not
use Perl. Use something compiled.


---
Use the domain skylightview (dot) com for the reply address instead.


------------------------------

Date: Sun, 26 Oct 2003 13:17:00 GMT
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: Fastest Perl Interpreter
Message-Id: <bnghf1$82o$1@ichaos.ichaos-int>

"Michael J. Astrauskas" <trevie@cox.net> said:
>I'm attempting build a system that needs to run a perl script very 
>quickly. There will be no disk access, but the system will be doing an 
>intense amount of network and processor work. Is there any particular 
>processor architecture (32-bit AMD/Intel, Opteron, Sun, Apple, etc.), 
>operating system, and interpreter that are known to be the most powerful 
>combination?
>
>My current idea is to use a dual Xeon with a gigabyte ethernet port and 
>at least 2 GB of RAM.

If you're really going to need that amount of RAM for your processing,
then the memory latency _and_ bandwidth may play big parts in overall
performance. Try to find this info for the choices you're considering.
When reading the info, try to calculate ratios between different speeds
rather than absolute differences - ratios often tell more. For this there
are two factors: the speeds supported by the motherboard, and the speeds
supported by the memory modules.

As for raw CPU performance, the current Intel/AMD setups bring more
"bang for buck" than traditional Unix platforms (IBM Power CPUs,
Solaris Sparc, HP PA-RISC), but may be more limited in I/O bandwidth
and latency. However, for just one 1Gbit/s network adapter, the "PC"
solutions should still be ok. If you were asking for multiple 1Gbit/s
channels and multiple fast disk channels, then I'd rather recommend
something other than "PC" hardware -- or at least would direct you
towards the high-end PC servers.

Then, do you really mean gigabyte ethernet port, i.e. roughly 10 gigabits/s,
or just one gigabit/s? Pay attention, the difference is huge.

When you're talking about 1Gbit/s network speeds, you'll need to look at
the bus architecture of the system: the traditional 32bit/33MHz PCI bus
has theoretical bus bandwidth of just over 1Gbit/s, so it's not enough to
feed a gigabit ethernet channel - you'll need something faster. 64bit/66MHz
PCI bus will do nicely, but will limit the possible hardware choices
(and you can forget the prices of commodity motherboards).
-- 
Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
         PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)


------------------------------

Date: Sun, 26 Oct 2003 05:51:56 +0000 (UTC)
From: Louis Erickson <wwonko@rdwarf.com>
Subject: Re: generating html from perl
Message-Id: <bnfnds$p4d$1@holly.rdwarf.com>

Nick Wedd <nick@maproom.co.uk> wrote:
: In message <bndrls$10g83e$1@ID-184292.news.uni-berlin.de>, Gunnar 
: Hjalmarsson <noreply@gunnar.cc> writes
:>Nick Wedd wrote:
<snip>
:>>  Is there a recommended way of getting round this?  Ideally, I would
:>> like it to leave all the html as it is.
:>
:>If you want to use the here-document syntax, you can do:
:>
:>    print <<'Whole_file';
:>------------^----------^
:>
:>See http://www.perldoc.com/perl5.8.0/pod/perlop.html#%3c%3cEOF

: Thank you.  I now have the script working.

:>Another approach is to keep the HTML page in a separate file, open and 
:>read it into a variable, and print that variable.

If you've only one, you can use the DATA filehandle and __DATA__ keyword.

If you have a line in your script that reads only "__DATA__", anything after
that will be available via the DATA file handle.

(I don't know when this was introduced; it may not be true in every version
of Perl.  Works in 5.6.0, and I suspect later.)

So, you can say:

# Bunch of Perl code...

print while(<DATA>);

# Bunch more perl code

__DATA__
<html>
<!-- Bunch of unedited HTML/javascript/whatever -->
</HTML>

-- 
Louis Erickson - wwonko@rdwarf.com - http://www.rdwarf.com/~wwonko/

Green light in a.m. for new projects.  Red light in P.M. for traffic
tickets.


------------------------------

Date: 26 Oct 2003 00:22:21 -0700
From: tka2@mail.com (Todd Aceman)
Subject: Getopt::Long and bundling.
Message-Id: <7c0c6162.0310252322.45ae2f77@posting.google.com>

Hi folks.

Perhaps i'm being stupid about this, but can you tell me why this
isn't working...

I have a script called "x.pl", that's using Getopt::Long.  The script
looks like this:

  #!/usr/bin/perl
  use Getopt::Long;
  GetOptions (
        "debug" => \$debug,
        "silent" => \$silent );
  print "DEBUG: $debug\n";
  print "SILENT: $silent\n";

When i run this using "./x.pl --debug", As expected, i get the
following response:

  % ./x.pl --debug
  DEBUG: 1
  SILENT:

When i run this using "./x.pl -d", i get the same response: 

  % ./x.pl -d 
  DEBUG: 1
  SILENT:

So far, so good...

However, if i turn on bundling using "Getopt::Long::Configure (
'bundling' );", so that the script now reads:

  #!/usr/bin/perl
  use Getopt::Long;
  Getopt::Long::Configure ( "bundling" );
  GetOptions (
        "debug" => \$debug,
        "silent" => \$silent );
  print "DEBUG: $debug\n";
  print "SILENT: $silent\n";

And i try "./x.pl -ds", i get the following response:

  % ./x.pl -ds
  Unknown option: ds
  DEBUG: 
  SILENT:

If i try just a single "-d" paramter, i still get an error:

  % ./x.pl -d 
  Unknown option: d
  DEBUG:
  SILENT:

From reading the docs for Getopt::Long, it talks about bundling and
says that

    For example, when vax, a, v and x are all valid options,

        -vax

    would set a, v and x...

However, when i try it.  it doesn't work.  Can someone tell me why
when i turn on "bundling", it stops accepting any parameters with a
single dash ("-") character?

This is perl 5.8.0 on Redhat Linux 9 (standard RPM distribution), and
also perl 5.8.0 on Windows XP using cygwin (the standard cygwin
distribution).

Thanks very much.

--tka.


------------------------------

Date: Sun, 26 Oct 2003 17:28:55 +0900
From: ko <kuujinbo@hotmail.com>
Subject: Re: Getopt::Long and bundling.
Message-Id: <bng0p4$kft$1@pin3.tky.plala.or.jp>

Todd Aceman wrote:

[snip]

> However, if i turn on bundling using "Getopt::Long::Configure (
> 'bundling' );", so that the script now reads:
> 
>   #!/usr/bin/perl
>   use Getopt::Long;
>   Getopt::Long::Configure ( "bundling" );
>   GetOptions (
>         "debug" => \$debug,
>         "silent" => \$silent );
>   print "DEBUG: $debug\n";
>   print "SILENT: $silent\n";
> 
> And i try "./x.pl -ds", i get the following response:
> 
>   % ./x.pl -ds
>   Unknown option: ds
>   DEBUG: 
>   SILENT:
> 
> If i try just a single "-d" paramter, i still get an error:
> 
>   % ./x.pl -d 
>   Unknown option: d
>   DEBUG:
>   SILENT:
> 
> From reading the docs for Getopt::Long, it talks about bundling and
> says that
> 
>     For example, when vax, a, v and x are all valid options,
> 
>         -vax
> 
>     would set a, v and x...
> 
> However, when i try it.  it doesn't work.  Can someone tell me why
> when i turn on "bundling", it stops accepting any parameters with a
> single dash ("-") character?

Right before the part you quoted from the docs:

"Configured this way, single-character options can be bundled but long 
options must always start with a double dash -- to avoid abiguity."

So you could use './x.pl --d --s', shorten the options to a single 
character, or use an alias with a single dash:

GetOptions ( # now './x.pl -ds' will work
   "debug|d" => \$debug,
   "silent|s" => \$silent );

[snip]

HTH - keith



------------------------------

Date: Sun, 26 Oct 2003 00:07:38 GMT
From: mw <mw@stopthespam.here>
Subject: Help with script to move email files based on date field in header
Message-Id: <MPG.1a04b0287c37a50b989680@24.69.255.211>


I have several approx 22,000 emails from various mailing lists (Maildir 
format) in a directory that I wish to sort and move to another directory 
based on the date field in the header.

ie: date in email header
Date: 26 Apr 2003 05:53:41 -0000 

ie:
Date: Sat, 28 May 2003 21:44:27 -0400 

Basically I would a script that would move all emails with the word Apr 
in the email date header to a directory called April. All emails with 
the word May in the email date header to be moved to the May directory 
and so on...

I have tried doing it with MUA filtering, however it is painfully 
slow....and my knowledge of grep and bash/perl scripting is at best 
painfully weak. I have googled/played with this for hours, however I 
still cannot get a functional script of any sort to work. 

I would appreciate any advice or pointers.

Regards,
Mark


------------------------------

Date: 25 Oct 2003 18:18:43 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Outlook email headers
Message-Id: <bneeq3$815$1@nets3.rz.RWTH-Aachen.DE>

Also sprach James Willmore:

> On Sat, 25 Oct 2003 13:32:37 +0200
> "Stefan" <someone@somewhere.nl> wrote:
>> Does anybody know how to access MS-Outlook email headers using Perl
>> ?  I tried using Win32::OLE but that doesn't give me the raw
>> internet headers. Same thing when exporting emails to file. Perhaps,
>> someone knows a different method ?  I'm using (Active)Perl, v5.6.1
>> built for MSWin32-x86-multi-thread.
>> 
> 
> I found the following module that _may_ aid in this task: 
> Mail::Transport::Dbx 
> (http://search.cpan.org/~vparseval/Mail-Transport-Dbx-0.04/Dbx.pm)
> 
> Since it can be used (according to the documentation) to extract
> messages, I'm thinking that gives one the ability to parse the message
> - including headers.  That's the good news.  Bad news is it depends
> upon a library that you _may_ have to compile.  However, I'll leave
> the exercise of further research up to you :-)

The library is inlined in the tarball. So on systems with a compiler it
is a matter of 'perl Makefile.PL; make etc.' to compile and install the
module.

For ActivePerl, there are PPMs available. How to install them is described
in the README of the source distribution.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


------------------------------

Date: Sun, 26 Oct 2003 12:36:40 +0100
From: "Stefan" <someone@somewhere.nl>
Subject: Re: Outlook email headers
Message-Id: <3f9bb1cc$0$20989$e4fe514c@dreader12.news.xs4all.nl>

"James Willmore" <jwillmore@remove.adelphia.net> schreef in bericht
news:20031025133346.11211c95.jwillmore@remove.adelphia.net...

> I found the following module that _may_ aid in this task:
> Mail::Transport::Dbx
> (http://search.cpan.org/~vparseval/Mail-Transport-Dbx-0.04/Dbx.pm)
>
> Since it can be used (according to the documentation) to extract
> messages, I'm thinking that gives one the ability to parse the message
> - including headers.  That's the good news.  Bad news is it depends
> upon a library that you _may_ have to compile.  However, I'll leave
> the exercise of further research up to you :-)


That looks very good but this one is for Outlook Express DBX files and I'm
trying to parse MS-Outlook PST files. A library/utility for reading PST
files does exist (libpst & ol2mbox) but unlike Mail::Transport::Dbx, there's
no associated Perl module or Win32 version. It's author did mention
Mail::Outlook:Pst so who knows, perhaps some day ....

I did find a page full of usefull links at
http://www.emailman.com/conversion/index.html  and a mini-HowTo on
converting mailboxes. Without a module, it definitely isn't going to be
easy.

Stefan




------------------------------

Date: 26 Oct 2003 11:55:37 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Outlook email headers
Message-Id: <bngcnp$cpd$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Stefan:

> "James Willmore" <jwillmore@remove.adelphia.net> schreef in bericht
> news:20031025133346.11211c95.jwillmore@remove.adelphia.net...
> 
>> I found the following module that _may_ aid in this task:
>> Mail::Transport::Dbx
>> (http://search.cpan.org/~vparseval/Mail-Transport-Dbx-0.04/Dbx.pm)
>>
>> Since it can be used (according to the documentation) to extract
>> messages, I'm thinking that gives one the ability to parse the message
>> - including headers.  That's the good news.  Bad news is it depends
>> upon a library that you _may_ have to compile.  However, I'll leave
>> the exercise of further research up to you :-)
> 
> 
> That looks very good but this one is for Outlook Express DBX files and I'm
> trying to parse MS-Outlook PST files. A library/utility for reading PST
> files does exist (libpst & ol2mbox) but unlike Mail::Transport::Dbx, there's
> no associated Perl module or Win32 version. It's author did mention
> Mail::Outlook:Pst so who knows, perhaps some day ....

Must be some distant day then. FIrst of all, libpst is considerably more
complex than libdbx. I had a look at it so I am not guessing. Secondly,
I was recently forced to occupy myself with things that are still new to
me, so I need quite some time for it.

And finally (this might be the most important reason), unlike Outlook
Express, Outlook is not freely available. As long as I don't have it, I
would have to write and maintain a module that I can't test myself.

> I did find a page full of usefull links at
> http://www.emailman.com/conversion/index.html  and a mini-HowTo on
> converting mailboxes. Without a module, it definitely isn't going to be
> easy.

All you need is probably some description of the PST file format. Once
you have it, you can relatively easily decipher it with pack/unpack. But
those descriptions are hard to find, especially when the file-format has
been invented by Microsoft.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


------------------------------

Date: 25 Oct 2003 12:59:17 -0700
From: wherrera@lynxview.com (Bill)
Subject: Re: Problem using Archive::Zip !
Message-Id: <239ce42f.0310251159.39a06353@posting.google.com>

Ej <ustsurge@mailcan.com_NOSPAM> wrote in message news:<61a8bde58a3ae71a347da52a73009cb8@news.bubbanews.com>...
> "J. Gleixner" <glex_nospam@qwest.invalid> wrote in
> news:99Wlb.2251$4V5.29115@news.uswest.net: 
> >> I get this message:
> >> Can't call     od "desiredCompressionMethod" without a package or
> >> object reference at zp1.pl line 38.
> >> 
> >> 
> >> however, this does work,
> >> 
> >> foreach $ia (@fla){
> >>  
> >> print "adding $ia<br>";
> >> $status=$zip->addTree( "$ia","$ia" );
> >> }
> >> 

> can someone PLEASE post an example code using $zip->addTree('','')
> that works or maybe this is a bug in Archive::Zip, that does not work.
> 
> thank you.

Something like this, maybe?

>>>>>>>>>>>>>>>>>>>>>>>>>>>>

use strict;
use Carp;
use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
use Archive::Zip::Tree;

my $rootdir = '/tmp';
my $archname = 'archived.zip';
my $destfile = $rootdir . '/' . $archname;

my $bytesdone = 0;
my $progress =  sub {
	my $f = $_;
	return 0 unless(-f $f and lc $f ne $archname);
	$bytesdone += -s $f;
	print $bytesdone, " total bytes archived        ",
	"\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b";
	return 1;
};

my $zip = new Archive::Zip or carp("Cannot make zip object: $!");
print "\nZipping directory $rootdir as $destfile\n";
$zip->addTree($rootdir, undef, $progress) == AZ_OK
	or die "No good adding tree $rootdir";
my @members = $zip->members;
my $member = $members[0];
$member->desiredCompressionMethod(COMPRESSION_DEFLATED);
$member->desiredCompressionLevel(5);
$zip->writeToFileNamed($destfile) == AZ_OK or
	carp ("Write error for zip object to $destfile: $!");
print "\nDone.\n";

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<


------------------------------

Date: Sat, 25 Oct 2003 21:29:19 GMT
From: jim <defenderjim4@no_dam_spam_juno.com>
Subject: SendMail Problem
Message-Id: <PWBmb.4650$Ui3.3081@nwrddc02.gnilink.net>


Hello,

I am having a problem w/SendMail reporting: "No recipient addresses 
found in header".

Funny thing is though, I properly recieve the email message.

What do I need to change to stop recieving the error message in my 
browser?

Thanks for your help.

-jim



Here is the code:


sub my_send_mail
{
local($fromuser, $touser, $subject, $messagebody) = @_;

local($old_path) = $ENV{"PATH"};


$ENV{"PATH"} = "";
$ENV{ENV} = "";

open(SENDMAIL, "| /bin/sendmail -t -n") || &web_error ("Unable to open 
sendmail");

$ENV{"PATH"} = $old_path;

print SENDMAIL "To: $touser\n";
print SENDMAIL "From: $fromuser\n";
print SENDMAIL "Subject: $subject\n\n";
print SENDMAIL "$messagebody\n";
close(SENDMAIL);

}



------------------------------

Date: Sat, 25 Oct 2003 17:10:14 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: SendMail Problem
Message-Id: <slrnbplt66.cfq.tadmc@magna.augustmail.com>

jim <defenderjim4@no_dam_spam_juno.com> wrote:


> I am having a problem w/SendMail 


I can't help with that part, other than checking for
newlines in the arguments.


> sub my_send_mail
> {
> local($fromuser, $touser, $subject, $messagebody) = @_;


You should always prefer lexical (my) variables over dynamic (local)
variables, except when you can't.


   my($fromuser, $touser, $subject, $messagebody) = @_;

   die "newlines in address" if grep /\n/, $fromuser, $touser;


> local($old_path) = $ENV{"PATH"};
> $ENV{"PATH"} = "";
> $ENV{ENV} = "";


Why are you changing environment variables?

Do you have taint checking turned on or something?


> close(SENDMAIL);


You should be checking the return value from close() as well
as from open().


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Sun, 26 Oct 2003 00:10:49 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: SendMail Problem
Message-Id: <bnesr5$10icmm$1@ID-184292.news.uni-berlin.de>

jim wrote:
> I am having a problem w/SendMail reporting: "No recipient addresses
> found in header".
> 
> Funny thing is though, I properly recieve the email message.
> 
> What do I need to change to stop recieving the error message in my
> browser?

Don't know. Whatever the reason is, it has probably nothing to do with
the part of the code you posted.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



------------------------------

Date: Sun, 26 Oct 2003 04:21:12 GMT
From: jim <defenderjim4@no_spam_juno.com>
Subject: Re: SendMail Problem
Message-Id: <YYHmb.9839$Ui3.288@nwrddc02.gnilink.net>

Hey,

>I can't help with that part, other than checking for
Well, that was it.
Thank you for the input.


Now the weird part is that I am receiving two email messages.
I am only sending one.  Very strange.


>You should always prefer lexical (my) variables over dynamic (local)
>variables, except when you can't.
Yep, you certainly are correct.  <lame excuse>...Long story.... Legacy 
code I inherited... Under time pressure to be done w/this project.</lame 
excuse>


>   my($fromuser, $touser, $subject, $messagebody) = @_;
>   die "newlines in address" if grep /\n/, $fromuser, $touser;
Made changes to code.

> $ENV{ENV} = "";
> Do you have taint checking turned on or something?
Yes.



------------------------------

Date: Sun, 26 Oct 2003 06:20:47 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: SendMail Problem
Message-Id: <20031026012046.7e3ae654.jwillmore@remove.adelphia.net>

On Sat, 25 Oct 2003 21:29:19 GMT
jim <defenderjim4@no_dam_spam_juno.com> wrote:
> I am having a problem w/SendMail reporting: "No recipient addresses 
> found in header".
> 
> Funny thing is though, I properly recieve the email message.
> 
> What do I need to change to stop recieving the error message in my 
> browser?
<snip>

Have you considered using the many email modules available in Perl?

I know this doesn't directly answer your question, but I find this a
rather poor way to send email.  It's not portable and relies upon
_you_ to check for errors, know how to pass parameters to the
executing application (in this case, sendmail), and it makes for a
nightmare for maintainence.  But, that's all just my opinion :-)

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
Twenty Percent of Zero is Better than Nothing.   -- Walt Kelly 



------------------------------

Date: Sun, 26 Oct 2003 00:28:29 +0000 (UTC)
From: mauzo@mauzo.(none) ()
Subject: Re: system command question
Message-Id: <bnf4fd$i31$1@wisteria.csv.warwick.ac.uk>

In article <bk4l5q$1uv$1@mamenchi.zrz.TU-Berlin.DE>,
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>> Ah, OK, I thought it used the user's shell.  OK, then,
>> system "$cmd >xyz.log 2>&1" should be the answer, assuming
>> the OP is on a Unix system (which seems logical, since he's
>> trying to use csh syntax).
>
>Except that he isn't.  "$cmd >& xyz.log" would be csh syntax.
>"$cmd &> xyz.log" is neither here nor there.

It's zsh syntax.

Ben
-- 
And if you wanna make sense / Whatcha looking at me for?          (Fiona Apple)
                            * ben@morrow.me.uk *


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 5712
***************************************


home help back first fref pref prev next nref lref last post