[26554] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8695 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 22 03:05:37 2005

Date: Tue, 22 Nov 2005 00:05:04 -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           Tue, 22 Nov 2005     Volume: 10 Number: 8695

Today's topics:
        Perl analysing a Microsoft .msg file <clydenospamorham@nospamorhamgetofftheline.freeservenospamorham.co.uk>
    Re: XML Parsing too slow with XML::Simple <toddrw69@excite.com>
    Re: XML Parsing too slow with XML::Simple <mirod@mirod.org>
    Re: XML Parsing too slow with XML::Simple <matthew.garrish@sympatico.ca>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 21 Nov 2005 23:33:56 GMT
From: "Clyde Ingram" <clydenospamorham@nospamorhamgetofftheline.freeservenospamorham.co.uk>
Subject: Perl analysing a Microsoft .msg file
Message-Id: <EPsgf.8551$D03.1738@newsfe5-gui.ntli.net>

Can anyone show me how to crack open a Micro$soft .msg file, such as one 
that LookOut!! can create or receive?

CPAN offers a wealth of modules for parsing SMTP mail, and lots of 
Win32::OLE modules -- but none, that I can find, on extracting elements 
(Subject, Originator, Attachments, etc) from Outlook.

The ActiveState Perl manual does present an example of connecting to an 
Outlook mailbox and creating a mail message.
But rather than connect to a mailbox, I just start with a .msg file.

In ActiveState Perl, I have stumbled on a Win32::OLE  - Type Library Browser 
at \Perl\html\OLE-Browser\Browser.html.  Under Microsoft Outlook 11.0 Object 
Library, this lists properties of a MailItem, including Recipients, 
SenderEmailAddress, Subject.  But I do not know how to use Perl to enumerate 
or read or write such properties, let alone how to access the MailItem 
class.

I'd appreciate any help CLPM can offfer, while understanding, from the 
ActiveState FAQ, that this NG concentrates on Unix-based Perl.  You see, one 
of my colleagues at work has appealed for a programmatic way to analyse .msg 
files, and I'd really like to show him a sound Perl alternative to some hack 
like Visual Basic or VBscript.

Thank-you,
Clyde




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

Date: Mon, 21 Nov 2005 23:55:15 GMT
From: "Todd W" <toddrw69@excite.com>
Subject: Re: XML Parsing too slow with XML::Simple
Message-Id: <D7tgf.1905$nA2.512@newssvr22.news.prodigy.net>


"Michel Rodriguez" <mirod@mirod.org> wrote in message
news:4381a247$0$8480$5fc30a8@news.tiscali.it...
> Todd W wrote:
>
> > For high performance XML parsing I use SAX. SAX is a language
independent
> > light weight XML interface. As with all XML interfaces, it has somewhat
of a
> > learning curve.
>
> Just to get the record straight: the last time I checked, SAX was NOT
> fast. At least in Perl.
>
> See http://www.xmltwig.com/article/simple_benchmark/ The last test is
> especially telling: for a multi-step process, it is basically twice as
> fast to use XML::LibXML and temporary XML files between steps than to
> pass SAX events around.
>

I guess because I was thinking in general terms I should've given more
general advice.

For big files (and even the word "big" is relative here) an event based
parser is going to be faster than a tree based parser.

Todd W.




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

Date: Tue, 22 Nov 2005 02:26:48 +0100
From: Michel Rodriguez <mirod@mirod.org>
Subject: Re: XML Parsing too slow with XML::Simple
Message-Id: <438273d9$0$8487$5fc30a8@news.tiscali.it>

Todd W wrote:

> For big files (and even the word "big" is relative here) an event based
> parser is going to be faster than a tree based parser.

Actually, an event-based parser is going to require less memory than a 
tree-based parser. A mixed model (XML::Twig, sorry, I have to toot my 
own horn somewhere in this thread) can be a good trade-off.

As far as speed goes, the reality seems to be: a regexp-based, non-XML 
parser is going to be faster than a "close to the metal" parser 
(XML::Parser or XML::LibXML), which is going to be faster than a more 
convenient parser (XML::Simple, XML::Twig) which is going to be faster 
than a pipeline involving passing events througth various 
object-oriented layers (XML::SAX).

-- 
mirod


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

Date: Mon, 21 Nov 2005 20:48:09 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: XML Parsing too slow with XML::Simple
Message-Id: <pNugf.1050$e43.143831@news20.bellglobal.com>


"Michel Rodriguez" <mirod@mirod.org> wrote in message 
news:4381ebd3$0$8495$5fc30a8@news.tiscali.it...
> A. Sinan Unur wrote:
>
>> Well, after seeing this, I became curious, and downloaded your benchmark 
>> code at 
>> <URL:http://www.xmltwig.com/article/simple_benchmark/simple_benchmark.tar.gz>
>>
>> Tried to run the script run_all, but:
>>
>> D:\Dload\simple_benchmark> perl run_all
>> Can't find string terminator "'" anywhere before EOF at -e line 1.
>> -uThe system cannot find the file specified.
>> Module versions:
>> Can't find string terminator "'" anywhere before EOF at -e line 1.
>> -uThe system cannot find the file specified.
>> Can't call method "size" on an undefined value at run_all line 41.
>>
>> is all I get.
>>
>> I am on Windows XP SP2 with Perl 5.8.7
>
>
> Oops!
>
> Sorry for the screw-up, a combination of not testing the tar file in a 
> separate directory (it missed a library) and code rot. I fixed it, 
> hopefully, at the same address. Under Windows you won't get the memory 
> used (it's Linux-dependant). You need xmllint in the path too.
>

I don't see that your benchmarks prove anything, other than using libxml and 
xpath to grab a few nodes is faster than iterating over the entire nodeset 
using SAX with calls to perl subroutines on small-ish files. That's hardly 
going to win you accolades for benchmark of the year.

I completely agree with you that DOM can be as effective, and more so in 
some situations, than SAX parsing, but speed tests like the ones you tried 
to build don't do anything to make me rethink when I'll use one or the 
other.

Your benchmarks are also going to rapidly deteriorate the larger the data 
files get, to the point where only a SAX parser will work as happened to the 
OP (unless you have RAM up the ying-yang on your machine). But even that 
isn't a complete deterrent, either. I've chunked my incoming files on 
occasion (by regex) to smaller pieces prior to processing if it makes more 
sense to use a DOM tree for what I'm doing to the data (and the data lends 
itself to easy decomposition).

Matt 




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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 8695
***************************************


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