[27925] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9289 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 12 21:05:37 2006

Date: Mon, 12 Jun 2006 18:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 12 Jun 2006     Volume: 10 Number: 9289

Today's topics:
    Re: CGI for collecting phone numbers <sherm@Sherm-Pendleys-Computer.local>
    Re: CGI for collecting phone numbers <sherm@Sherm-Pendleys-Computer.local>
    Re: CGI for collecting phone numbers <sherm@Sherm-Pendleys-Computer.local>
        Converting XML to Perl structures FAST <ignoramus17503@NOSPAM.17503.invalid>
    Re: Converting XML to Perl structures FAST robic0
    Re: Converting XML to Perl structures FAST robic0
    Re: Converting XML to Perl structures FAST robic0
    Re: Converting XML to Perl structures FAST robic0
    Re: Converting XML to Perl structures FAST <jgibson@mail.arc.nasa.gov>
    Re: Converting XML to Perl structures FAST <ignoramus17503@NOSPAM.17503.invalid>
    Re: Converting XML to Perl structures FAST robic0
    Re: Converting XML to Perl structures FAST robic0
    Re: Converting XML to Perl structures FAST <ignoramus17503@NOSPAM.17503.invalid>
    Re: Converting XML to Perl structures FAST robic0
    Re: Error when connecting to database using Win32::ODBC <sherm@Sherm-Pendleys-Computer.local>
    Re: hi Mr.John Bokma <sherm@Sherm-Pendleys-Computer.local>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 12 Jun 2006 18:41:15 -0400
From: Sherm Pendley <sherm@Sherm-Pendleys-Computer.local>
Subject: Re: CGI for collecting phone numbers
Message-Id: <m2odwyvvxw.fsf@Sherm-Pendleys-Computer.local>

Jim Gibson <jgibson@mail.arc.nasa.gov> writes:

>> use CGI::Carp qw(fatalsToBrowser);
>> my $file = '/users/web/king/web/sms.txt';
>
> Print the HTTP header here, before you do anything else. If open fails
> in the next line, you will be sending invalid HTML to the server.

CGI:Carp should take care of that. It overrides die() and warn() with versions
that send headers before their output.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Mon, 12 Jun 2006 18:45:16 -0400
From: Sherm Pendley <sherm@Sherm-Pendleys-Computer.local>
Subject: Re: CGI for collecting phone numbers
Message-Id: <m2k67mvvr7.fsf@Sherm-Pendleys-Computer.local>

"Paul Lalli" <mritty@gmail.com> writes:

> ferreira@unm.edu wrote:
>
>> use CGI::Carp qw(fatalsToBrowser);
>> my $file = '/users/web/king/web/sms.txt';
>> open (FILE, ">>" . $file) or die "cannot open file for appending: $!";
>> flock (FILE, 2) or die "cannot lock file exclusively: $!";
>> print "Content-type: text/html\n\n";
>
> So if either of those system calls fails, you're going to die before
> printing out the HTML header?  Does that really make sense to you?

Makes sense to me. CGI::Carp overrides the built-in die() and warn() functions
with versions that print a basic set of HTTP headers before their messages.

>> [Fri Jun  9 17:28:30 2006] [error] [client 68.35.76.89] Premature end
>> of script headers: /users/web/king/web/sms.pl
>
> Now why do you think you might be getting that?  Could it be that your
> script is die()ing before printing out the headers?

If so, that narrows the problem considerably - it has to be die()ing before
CGI::Carp is being use()d.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Mon, 12 Jun 2006 18:47:46 -0400
From: Sherm Pendley <sherm@Sherm-Pendleys-Computer.local>
Subject: Re: CGI for collecting phone numbers
Message-Id: <m2fyiavvn1.fsf@Sherm-Pendleys-Computer.local>

"ferreira@unm.edu" <ferreira@unm.edu> writes:

> I was able to find the missing piece and it works perfectly now.
> Here is the final code. Maybe someone wanting to submit phone numbers
> from a form to a text file with a cgi will run across this post and
> save the hassle I went through.
>
> #!/usr/bin/perl -w
> use CGI;
> if ($ENV{'REQUEST_METHOD'} eq 'POST') {
>
>         read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
>
>         @pairs = split(/&/, $buffer);
>
>         foreach $pair (@pairs) {
>                 ($name, $value) = split(/=/, $pair);
>                 $value =~ tr/+/ /;
>                 $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",
> hex($1))/eg;
>                 $FORM{$name} = $value;}
>         }

The only purpose the above has is to serve as a horrible example of hand-
written CGI parsing.

Do yourself a favor - buy a good Perl book. Read it.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Mon, 12 Jun 2006 23:30:22 GMT
From: Ignoramus17503 <ignoramus17503@NOSPAM.17503.invalid>
Subject: Converting XML to Perl structures FAST
Message-Id: <iOmjg.14484$Ab3.5451@fe80.usenetserver.com>

Aside from a suggestion to look at RXParse, which I will do, I have
not yet seen what I was looking for, so here's a rephrase of my
question.

I need to convert XML documents to Perl structures, very efficiently,
CPU wise.

I am currently using XML::Simple, which does what I want, but is
slow. 

I have looked at various Perl XML FAQs, manual for XML::LibXML, etc,
looks like they parse XML into all kinds of strange (to me) things.

So, here's my question: what perl module converts XML to perl
structure (hashes of hashes of arrays etc), and does it very
efficiently. 

I am not loooking for suggestions to "use google", I need suggestions
from people who have a real life answer.

Thanks.

i



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

Date: Mon, 12 Jun 2006 16:38:03 -0700
From: robic0
Subject: Re: Converting XML to Perl structures FAST
Message-Id: <4dur82phrunpc5k6qojkjuheticklj35aj@4ax.com>

On Mon, 12 Jun 2006 23:30:22 GMT, Ignoramus17503 <ignoramus17503@NOSPAM.17503.invalid> wrote:

>Aside from a suggestion to look at RXParse, which I will do, I have
>not yet seen what I was looking for, so here's a rephrase of my
>question.
>
>I need to convert XML documents to Perl structures, very efficiently,
>CPU wise.
>
>I am currently using XML::Simple, which does what I want, but is
>slow. 
>
>I have looked at various Perl XML FAQs, manual for XML::LibXML, etc,
>looks like they parse XML into all kinds of strange (to me) things.
>
>So, here's my question: what perl module converts XML to perl
>structure (hashes of hashes of arrays etc), and does it very
>efficiently. 
>
>I am not loooking for suggestions to "use google", I need suggestions
>from people who have a real life answer.
>
>Thanks.
>
>i

There are many here that have used Simple. The general procedure is 
us Expat or Parse, set your handlers, set flags in the handlers,
grab the data when it comes around. Stop the grab when its gone.
When you hit the tag you need, store the "original" content data
that is passed (appeneded to a string, with tags) then pass the
entire "original" xml/xhtml (tags and all) to Simple to glean the hash data.
This avoids unnecessary duality.
Does that about cover it?

robic0
(god of porn)


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

Date: Mon, 12 Jun 2006 16:44:48 -0700
From: robic0
Subject: Re: Converting XML to Perl structures FAST
Message-Id: <srur82dqnnd21ig6i1123uccg8hrlrmh5s@4ax.com>

On Mon, 12 Jun 2006 16:38:03 -0700, robic0 wrote:

>On Mon, 12 Jun 2006 23:30:22 GMT, Ignoramus17503 <ignoramus17503@NOSPAM.17503.invalid> wrote:
>
>>Aside from a suggestion to look at RXParse, which I will do, I have
>>not yet seen what I was looking for, so here's a rephrase of my
>>question.
>>
>>I need to convert XML documents to Perl structures, very efficiently,
>>CPU wise.
>>
>>I am currently using XML::Simple, which does what I want, but is
>>slow. 
>>
>>I have looked at various Perl XML FAQs, manual for XML::LibXML, etc,
>>looks like they parse XML into all kinds of strange (to me) things.
>>
>>So, here's my question: what perl module converts XML to perl
>>structure (hashes of hashes of arrays etc), and does it very
>>efficiently. 
>>
>>I am not loooking for suggestions to "use google", I need suggestions
>>from people who have a real life answer.
>>
>>Thanks.
>>
>>i
>
>There are many here that have used Simple. The general procedure is 
>us Expat or Parse, set your handlers, set flags in the handlers,
>grab the data when it comes around. Stop the grab when its gone.
>When you hit the tag you need, store the "original" content data
>that is passed (appeneded to a string, with tags) then pass the
>entire "original" xml/xhtml (tags and all) to Simple to glean the hash data.
>This avoids unnecessary duality.
>Does that about cover it?
>
>robic0
>(god of porn)

RXParse is just a Create/Filter/Search & Replace (modify)/ parser.
It won't internalize xml data into a hash. Although I did do one of those
posted here along time ago (a Simple replacement).

You need to understand that for what you (think) are trying to do you will have
to lead off with parser handlers to "drill down" to the start of the extraction
data, capture it (raw), wait for the finish, then past the "raw" string to Simple.

That is how its done buddy.....

robic0
(god of porn)


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

Date: Mon, 12 Jun 2006 16:50:35 -0700
From: robic0
Subject: Re: Converting XML to Perl structures FAST
Message-Id: <s6vr825bgnk2bmit7utaidtmnmssbo7ftk@4ax.com>

On Mon, 12 Jun 2006 16:44:48 -0700, robic0 wrote:

>On Mon, 12 Jun 2006 16:38:03 -0700, robic0 wrote:
>
>>On Mon, 12 Jun 2006 23:30:22 GMT, Ignoramus17503 <ignoramus17503@NOSPAM.17503.invalid> wrote:
>>
>>>Aside from a suggestion to look at RXParse, which I will do, I have
>>>not yet seen what I was looking for, so here's a rephrase of my
>>>question.
>>>
>>>I need to convert XML documents to Perl structures, very efficiently,
>>>CPU wise.
>>>
>>>I am currently using XML::Simple, which does what I want, but is
>>>slow. 
>>>
>>>I have looked at various Perl XML FAQs, manual for XML::LibXML, etc,
>>>looks like they parse XML into all kinds of strange (to me) things.
>>>
>>>So, here's my question: what perl module converts XML to perl
>>>structure (hashes of hashes of arrays etc), and does it very
>>>efficiently. 
>>>
>>>I am not loooking for suggestions to "use google", I need suggestions
>>>from people who have a real life answer.
>>>
>>>Thanks.
>>>
>>>i
>>
>>There are many here that have used Simple. The general procedure is 
>>us Expat or Parse, set your handlers, set flags in the handlers,
>>grab the data when it comes around. Stop the grab when its gone.
>>When you hit the tag you need, store the "original" content data
>>that is passed (appeneded to a string, with tags) then pass the
>>entire "original" xml/xhtml (tags and all) to Simple to glean the hash data.
>>This avoids unnecessary duality.
>>Does that about cover it?
>>
>>robic0
>>(god of porn)
>
>RXParse is just a Create/Filter/Search & Replace (modify)/ parser.
>It won't internalize xml data into a hash. Although I did do one of those
>posted here along time ago (a Simple replacement).
>
>You need to understand that for what you (think) are trying to do you will have
>to lead off with parser handlers to "drill down" to the start of the extraction
>data, capture it (raw), wait for the finish, then past the "raw" string to Simple.
>
>That is how its done buddy.....
>
>robic0
>(god of porn)

postscript:

Usually when you capture sub xml/xhtml in this fashion, you will want to encapsulate
the raw data with a tag before you send it to Simple. Simple invokes a user selected
parser (Expat is default, I think). So if its non-compliant it will croak/carp on you.
Expat is better than Parse though.

Like:

<root>

    captured xml/xhtml

</root>

robic0
(god of porn)


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

Date: Mon, 12 Jun 2006 16:55:19 -0700
From: robic0
Subject: Re: Converting XML to Perl structures FAST
Message-Id: <4gvr821vblfovamnkvsljko1rdbnnbitku@4ax.com>

On Mon, 12 Jun 2006 16:50:35 -0700, robic0 wrote:

>On Mon, 12 Jun 2006 16:44:48 -0700, robic0 wrote:
>
>>On Mon, 12 Jun 2006 16:38:03 -0700, robic0 wrote:
>>
>>>On Mon, 12 Jun 2006 23:30:22 GMT, Ignoramus17503 <ignoramus17503@NOSPAM.17503.invalid> wrote:
>>>
>>>>Aside from a suggestion to look at RXParse, which I will do, I have
>>>>not yet seen what I was looking for, so here's a rephrase of my
>>>>question.
>>>>
>>>>I need to convert XML documents to Perl structures, very efficiently,
>>>>CPU wise.
>>>>
>>>>I am currently using XML::Simple, which does what I want, but is
>>>>slow. 
>>>>
>>>>I have looked at various Perl XML FAQs, manual for XML::LibXML, etc,
>>>>looks like they parse XML into all kinds of strange (to me) things.
>>>>
>>>>So, here's my question: what perl module converts XML to perl
>>>>structure (hashes of hashes of arrays etc), and does it very
>>>>efficiently. 
>>>>
>>>>I am not loooking for suggestions to "use google", I need suggestions
>>>>from people who have a real life answer.
>>>>
>>>>Thanks.
>>>>
>>>>i
>>>
>>>There are many here that have used Simple. The general procedure is 
>>>us Expat or Parse, set your handlers, set flags in the handlers,
>>>grab the data when it comes around. Stop the grab when its gone.
>>>When you hit the tag you need, store the "original" content data
>>>that is passed (appeneded to a string, with tags) then pass the
>>>entire "original" xml/xhtml (tags and all) to Simple to glean the hash data.
>>>This avoids unnecessary duality.
>>>Does that about cover it?
>>>
>>>robic0
>>>(god of porn)
>>
>>RXParse is just a Create/Filter/Search & Replace (modify)/ parser.
>>It won't internalize xml data into a hash. Although I did do one of those
>>posted here along time ago (a Simple replacement).
>>
>>You need to understand that for what you (think) are trying to do you will have
>>to lead off with parser handlers to "drill down" to the start of the extraction
>>data, capture it (raw), wait for the finish, then past the "raw" string to Simple.
>>
>>That is how its done buddy.....
>>
>>robic0
>>(god of porn)
>
>postscript:
>
>Usually when you capture sub xml/xhtml in this fashion, you will want to encapsulate
>the raw data with a tag before you send it to Simple. Simple invokes a user selected
>parser (Expat is default, I think). So if its non-compliant it will croak/carp on you.
>Expat is better than Parse though.
>
>Like:
>
><root>
>
>    captured xml/xhtml
>
></root>
>
>robic0
>(god of porn)

Btw, Simple doesen't know of RXParse, so it won't invoke it. RXParse is faster than Expat
and Parse, which each use a C dll interface. RXParse is a very fast (er than them) Perl only
parser. So they will not support it until its formalized on CPan or something. I won't take it
to CPan. I reject the Perl establishment, period. I am going to force the maggpies to come to me!!!

robic0
(god of porn)


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

Date: Mon, 12 Jun 2006 17:13:26 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Converting XML to Perl structures FAST
Message-Id: <120620061713265275%jgibson@mail.arc.nasa.gov>

In article <iOmjg.14484$Ab3.5451@fe80.usenetserver.com>, Ignoramus17503
<ignoramus17503@NOSPAM.17503.invalid> wrote:

> Aside from a suggestion to look at RXParse, which I will do, I have
> not yet seen what I was looking for, so here's a rephrase of my
> question.

Why have you started a new thread?

Please ignore any post from robic0 and don't consider trying to use
RXParse. If you do, you will get no help from anyone here (including
robic0).

I have used XML::Parser and the expat library
(<http://expat.sourceforge.net/>) to parse XML. I started developing a
program that uses XML by using XML::SAX::PurePerl. It worked on small
test files. When I was ready to test on larger files, I installed the
expat library and used XML::Parser. The speed-up was about a factor of
40.

> 
> I need to convert XML documents to Perl structures, very efficiently,
> CPU wise.
> 
> I am currently using XML::Simple, which does what I want, but is
> slow. 
> 
> I have looked at various Perl XML FAQs, manual for XML::LibXML, etc,
> looks like they parse XML into all kinds of strange (to me) things.
> 
> So, here's my question: what perl module converts XML to perl
> structure (hashes of hashes of arrays etc), and does it very
> efficiently. 

SAX parsers do not produce Perl data structures. They call your
routines on each element. You then store the data in your own
structures. It is very efficient, but I do not have any experience with
XML::Simple or XML::Twig, so cannot give you a comparison.


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

Date: Tue, 13 Jun 2006 00:25:17 GMT
From: Ignoramus17503 <ignoramus17503@NOSPAM.17503.invalid>
Subject: Re: Converting XML to Perl structures FAST
Message-Id: <NBnjg.7132$gy3.2745@fe72.usenetserver.com>

On Mon, 12 Jun 2006 17:13:26 -0700, Jim Gibson <jgibson@mail.arc.nasa.gov> wrote:
> In article <iOmjg.14484$Ab3.5451@fe80.usenetserver.com>, Ignoramus17503
><ignoramus17503@NOSPAM.17503.invalid> wrote:
>
>> Aside from a suggestion to look at RXParse, which I will do, I have
>> not yet seen what I was looking for, so here's a rephrase of my
>> question.
>
> Why have you started a new thread?
>
> Please ignore any post from robic0 and don't consider trying to use
> RXParse. If you do, you will get no help from anyone here (including
> robic0).
>
> I have used XML::Parser and the expat library
> (<http://expat.sourceforge.net/>) to parse XML. I started developing a
> program that uses XML by using XML::SAX::PurePerl. It worked on small
> test files. When I was ready to test on larger files, I installed the
> expat library and used XML::Parser. The speed-up was about a factor of
> 40.

Do you have any code sample that you could share?

>> 
>> I need to convert XML documents to Perl structures, very efficiently,
>> CPU wise.
>> 
>> I am currently using XML::Simple, which does what I want, but is
>> slow. 
>> 
>> I have looked at various Perl XML FAQs, manual for XML::LibXML, etc,
>> looks like they parse XML into all kinds of strange (to me) things.
>> 
>> So, here's my question: what perl module converts XML to perl
>> structure (hashes of hashes of arrays etc), and does it very
>> efficiently. 
>
> SAX parsers do not produce Perl data structures. They call your
> routines on each element. You then store the data in your own
> structures. It is very efficient, but I do not have any experience with
> XML::Simple or XML::Twig, so cannot give you a comparison.

Thank you for the tips. 

I installed XML::Twig, and things seem, so far, to be a lot faster and
CPU use is way down. It is not quite as easy to use, but I can live
with it.

I am running my process, which repeatedly parses large XML structures,
now, it will run for the rest of the evening. Time will tell  if it
slows down with more parsed documents, maybe due to memory leaks or
who knows what.

i



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

Date: Mon, 12 Jun 2006 17:31:51 -0700
From: robic0
Subject: Re: Converting XML to Perl structures FAST
Message-Id: <v91s8217l1ofhl9q6rg97qt0rb53ssafop@4ax.com>

On Mon, 12 Jun 2006 17:13:26 -0700, Jim Gibson <jgibson@mail.arc.nasa.gov> wrote:

>In article <iOmjg.14484$Ab3.5451@fe80.usenetserver.com>, Ignoramus17503
><ignoramus17503@NOSPAM.17503.invalid> wrote:
>
>> Aside from a suggestion to look at RXParse, which I will do, I have
>> not yet seen what I was looking for, so here's a rephrase of my
>> question.
>
>Why have you started a new thread?
>
>Please ignore any post from robic0 and don't consider trying to use
>RXParse. If you do, you will get no help from anyone here (including
>robic0).
>
>I have used XML::Parser and the expat library
>(<http://expat.sourceforge.net/>) to parse XML. I started developing a
>program that uses XML by using XML::SAX::PurePerl. It worked on small
>test files. When I was ready to test on larger files, I installed the
>expat library and used XML::Parser. The speed-up was about a factor of
>40.
>
>> 
>> I need to convert XML documents to Perl structures, very efficiently,
>> CPU wise.
>> 
>> I am currently using XML::Simple, which does what I want, but is
>> slow. 
>> 
>> I have looked at various Perl XML FAQs, manual for XML::LibXML, etc,
>> looks like they parse XML into all kinds of strange (to me) things.
>> 
>> So, here's my question: what perl module converts XML to perl
>> structure (hashes of hashes of arrays etc), and does it very
>> efficiently. 
>
>SAX parsers do not produce Perl data structures. They call your
>routines on each element. You then store the data in your own
>structures. It is very efficient, but I do not have any experience with
>XML::Simple or XML::Twig, so cannot give you a comparison.

I'm gonna let this slight go Jim, consider yourself lucky!!!

Since you do not have experience with Simple or Twig, I consider
you post a light easy breeze that fades with the tides. I would not
have folled you comments but for the "indirect" reference to ignore
robic0 entirely! I have a long memory and will not forget this.

I've been purposely absent and choose posts now based on my expertise.
I have on now. A really big, complicated one. 

He never mentioned SAX (simple api xml), why did you? You don't know 
what xml is and you will never. I don't take kindly to personal attacks!
The next one and I will rip you a new asshole!!!!!!

robic0
(god of porn)


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

Date: Mon, 12 Jun 2006 17:39:41 -0700
From: robic0
Subject: Re: Converting XML to Perl structures FAST
Message-Id: <412s82p2gfttl8bs5diq68r411mmtv5a9n@4ax.com>

On Tue, 13 Jun 2006 00:25:17 GMT, Ignoramus17503 <ignoramus17503@NOSPAM.17503.invalid> wrote:

>On Mon, 12 Jun 2006 17:13:26 -0700, Jim Gibson <jgibson@mail.arc.nasa.gov> wrote:
>> In article <iOmjg.14484$Ab3.5451@fe80.usenetserver.com>, Ignoramus17503
>><ignoramus17503@NOSPAM.17503.invalid> wrote:
>>
>>> Aside from a suggestion to look at RXParse, which I will do, I have
>>> not yet seen what I was looking for, so here's a rephrase of my
>>> question.
>>
>> Why have you started a new thread?
>>
>> Please ignore any post from robic0 and don't consider trying to use
>> RXParse. If you do, you will get no help from anyone here (including
>> robic0).
>>
>> I have used XML::Parser and the expat library
>> (<http://expat.sourceforge.net/>) to parse XML. I started developing a
>> program that uses XML by using XML::SAX::PurePerl. It worked on small
>> test files. When I was ready to test on larger files, I installed the
>> expat library and used XML::Parser. The speed-up was about a factor of
>> 40.
>
>Do you have any code sample that you could share?
>
>>> 
>>> I need to convert XML documents to Perl structures, very efficiently,
>>> CPU wise.
>>> 
>>> I am currently using XML::Simple, which does what I want, but is
>>> slow. 
>>> 
>>> I have looked at various Perl XML FAQs, manual for XML::LibXML, etc,
>>> looks like they parse XML into all kinds of strange (to me) things.
>>> 
>>> So, here's my question: what perl module converts XML to perl
>>> structure (hashes of hashes of arrays etc), and does it very
>>> efficiently. 
>>
>> SAX parsers do not produce Perl data structures. They call your
>> routines on each element. You then store the data in your own
>> structures. It is very efficient, but I do not have any experience with
>> XML::Simple or XML::Twig, so cannot give you a comparison.
>
>Thank you for the tips. 
>
>I installed XML::Twig, and things seem, so far, to be a lot faster and
>CPU use is way down. It is not quite as easy to use, but I can live
>with it.
>
>I am running my process, which repeatedly parses large XML structures,
>now, it will run for the rest of the evening. Time will tell  if it
>slows down with more parsed documents, maybe due to memory leaks or
>who knows what.
>
>i
Oh I thought your intention was to create data structures? Or was it to 
parse xml? Or create data structures from parsed xml?
Its a really, really hard, hard thing to get from you the simplest of 
simple answers.

The volume of folks (I know of) here, know these answers intimately,
me one of them. 

You are indeed an Ebiotch asshole !!!!!!!!!!!
(this line above won't get you anymore answers)

robic0
(god of porn)


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

Date: Tue, 13 Jun 2006 00:42:54 GMT
From: Ignoramus17503 <ignoramus17503@NOSPAM.17503.invalid>
Subject: Re: Converting XML to Perl structures FAST
Message-Id: <iSnjg.25003$641.23968@fe52.usenetserver.com>

On Mon, 12 Jun 2006 17:39:41 -0700, robic0 <robic0> wrote:
> On Tue, 13 Jun 2006 00:25:17 GMT, Ignoramus17503 <ignoramus17503@NOSPAM.17503.invalid> wrote:
>
>>On Mon, 12 Jun 2006 17:13:26 -0700, Jim Gibson <jgibson@mail.arc.nasa.gov> wrote:
>>> In article <iOmjg.14484$Ab3.5451@fe80.usenetserver.com>, Ignoramus17503
>>><ignoramus17503@NOSPAM.17503.invalid> wrote:
>>>
>>>> Aside from a suggestion to look at RXParse, which I will do, I have
>>>> not yet seen what I was looking for, so here's a rephrase of my
>>>> question.
>>>
>>> Why have you started a new thread?
>>>
>>> Please ignore any post from robic0 and don't consider trying to use
>>> RXParse. If you do, you will get no help from anyone here (including
>>> robic0).
>>>
>>> I have used XML::Parser and the expat library
>>> (<http://expat.sourceforge.net/>) to parse XML. I started developing a
>>> program that uses XML by using XML::SAX::PurePerl. It worked on small
>>> test files. When I was ready to test on larger files, I installed the
>>> expat library and used XML::Parser. The speed-up was about a factor of
>>> 40.
>>
>>Do you have any code sample that you could share?
>>
>>>> 
>>>> I need to convert XML documents to Perl structures, very efficiently,
>>>> CPU wise.
>>>> 
>>>> I am currently using XML::Simple, which does what I want, but is
>>>> slow. 
>>>> 
>>>> I have looked at various Perl XML FAQs, manual for XML::LibXML, etc,
>>>> looks like they parse XML into all kinds of strange (to me) things.
>>>> 
>>>> So, here's my question: what perl module converts XML to perl
>>>> structure (hashes of hashes of arrays etc), and does it very
>>>> efficiently. 
>>>
>>> SAX parsers do not produce Perl data structures. They call your
>>> routines on each element. You then store the data in your own
>>> structures. It is very efficient, but I do not have any experience with
>>> XML::Simple or XML::Twig, so cannot give you a comparison.
>>
>>Thank you for the tips. 
>>
>>I installed XML::Twig, and things seem, so far, to be a lot faster and
>>CPU use is way down. It is not quite as easy to use, but I can live
>>with it.
>>
>>I am running my process, which repeatedly parses large XML structures,
>>now, it will run for the rest of the evening. Time will tell  if it
>>slows down with more parsed documents, maybe due to memory leaks or
>>who knows what.
>>
>>i
> Oh I thought your intention was to create data structures? Or was it to 
> parse xml? Or create data structures from parsed xml?
> Its a really, really hard, hard thing to get from you the simplest of 
> simple answers.
>
> The volume of folks (I know of) here, know these answers intimately,
> me one of them. 
>
> You are indeed an Ebiotch asshole !!!!!!!!!!!
> (this line above won't get you anymore answers)
>
> robic0
> (god of porn)

My goal was to parse XML into usable data structures.

i



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

Date: Mon, 12 Jun 2006 17:53:01 -0700
From: robic0
Subject: Re: Converting XML to Perl structures FAST
Message-Id: <8t2s8216e66iqf4j00gf6115s8kjd3q8id@4ax.com>

On Tue, 13 Jun 2006 00:42:54 GMT, Ignoramus17503 <ignoramus17503@NOSPAM.17503.invalid> wrote:

>On Mon, 12 Jun 2006 17:39:41 -0700, robic0 <robic0> wrote:
>> On Tue, 13 Jun 2006 00:25:17 GMT, Ignoramus17503 <ignoramus17503@NOSPAM.17503.invalid> wrote:
>>
>>>On Mon, 12 Jun 2006 17:13:26 -0700, Jim Gibson <jgibson@mail.arc.nasa.gov> wrote:
>>>> In article <iOmjg.14484$Ab3.5451@fe80.usenetserver.com>, Ignoramus17503
>>>><ignoramus17503@NOSPAM.17503.invalid> wrote:
>>>>
>>>>> Aside from a suggestion to look at RXParse, which I will do, I have
>>>>> not yet seen what I was looking for, so here's a rephrase of my
>>>>> question.
>>>>
>>>> Why have you started a new thread?
>>>>
>>>> Please ignore any post from robic0 and don't consider trying to use
>>>> RXParse. If you do, you will get no help from anyone here (including
>>>> robic0).
>>>>
>>>> I have used XML::Parser and the expat library
>>>> (<http://expat.sourceforge.net/>) to parse XML. I started developing a
>>>> program that uses XML by using XML::SAX::PurePerl. It worked on small
>>>> test files. When I was ready to test on larger files, I installed the
>>>> expat library and used XML::Parser. The speed-up was about a factor of
>>>> 40.
>>>
>>>Do you have any code sample that you could share?
>>>
>>>>> 
>>>>> I need to convert XML documents to Perl structures, very efficiently,
>>>>> CPU wise.
>>>>> 
>>>>> I am currently using XML::Simple, which does what I want, but is
>>>>> slow. 
>>>>> 
>>>>> I have looked at various Perl XML FAQs, manual for XML::LibXML, etc,
>>>>> looks like they parse XML into all kinds of strange (to me) things.
>>>>> 
>>>>> So, here's my question: what perl module converts XML to perl
>>>>> structure (hashes of hashes of arrays etc), and does it very
>>>>> efficiently. 
>>>>
>>>> SAX parsers do not produce Perl data structures. They call your
>>>> routines on each element. You then store the data in your own
>>>> structures. It is very efficient, but I do not have any experience with
>>>> XML::Simple or XML::Twig, so cannot give you a comparison.
>>>
>>>Thank you for the tips. 
>>>
>>>I installed XML::Twig, and things seem, so far, to be a lot faster and
>>>CPU use is way down. It is not quite as easy to use, but I can live
>>>with it.
>>>
>>>I am running my process, which repeatedly parses large XML structures,
>>>now, it will run for the rest of the evening. Time will tell  if it
>>>slows down with more parsed documents, maybe due to memory leaks or
>>>who knows what.
>>>
>>>i
>> Oh I thought your intention was to create data structures? Or was it to 
>> parse xml? Or create data structures from parsed xml?
>> Its a really, really hard, hard thing to get from you the simplest of 
>> simple answers.
>>
>> The volume of folks (I know of) here, know these answers intimately,
>> me one of them. 
>>
>> You are indeed an Ebiotch asshole !!!!!!!!!!!
>> (this line above won't get you anymore answers)
>>
>> robic0
>> (god of porn)
>
>My goal was to parse XML into usable data structures.
>
>i

Its been said over and over again in the last hour....

This is a little info for you. It is extremely *HARD*
to divine xml into data structures!!!!!!!!

Given a flat requirement, passing a module to such that does
so will prove useless to the requestor!

DO YOU NOT FLUCKIN UNDERSTAND THAT??????????????????????

robic0
(god of porn)


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

Date: Mon, 12 Jun 2006 18:37:22 -0400
From: Sherm Pendley <sherm@Sherm-Pendleys-Computer.local>
Subject: Re: Error when connecting to database using Win32::ODBC
Message-Id: <m2wtbmvw4d.fsf@Sherm-Pendleys-Computer.local>

"madan" <madan.narra@gmail.com> writes:

> sir,

Who are you "sir"-ing? Please post quotes and attributions the way the rest
of us do, thanks.

> still the same error

Then why start a new thread? If you want to post a followup, post a followup.

Have you read the posting guidelines for this group yet?

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Mon, 12 Jun 2006 18:27:05 -0400
From: Sherm Pendley <sherm@Sherm-Pendleys-Computer.local>
Subject: Re: hi Mr.John Bokma
Message-Id: <m264j6xb5y.fsf@Sherm-Pendleys-Computer.local>

"madan" <madan.narra@gmail.com> writes:

> hello Mr.John Bokma
> thanks for ur replay

It's spelled "your". This is usenet, not instant messaging.

And what reply are you speaking of? If you mean to post a reply, please don't
start a new thread to do so.

>..but i modified the source code as u specified but

It's spelled "you". This is usenet, not instant messaging.

> #######################################################################
>
>
>
> #! /usr/bin/perl
>
>
> use lib '/cgi-bin/lib';

This will almost certainly not do what you expect it to. Is your cgi-bin
directory *really* at the root level on your hard drive? (Note that being
at the root level of your web site - i.e. http://invalid.com/cgi-bin - is
almost certainly *not* the same thing.)

> require("CGI.pm");
> use strict;
> use warnings;
>
>
> use CGI::Carp 'fatalsToBrowser';
> use CGI;

Why did you import CGI.pm twice?

> use Win32::ODBC;
> my $cgi = CGI->new;
> $dbh= new Win32::ODBC("dsn=madan; uid=madan; pwd=madan");

my $dbh = ...

> if(!$dbh)
>  {
>   &printFailure;

Don't use & to call subroutines unless you know what that does and why you
need it.

     printFailure;

>   exit();
>  }
> else
>  {
>   &printSucess;

    printSuccess;

>  }

Whether $dbh is defined or not, the above if/else will print *somehing* before
your scripts gets any chance to print HTTP headers.

> print $cgi->header( 'text/html' );
> print $cgi->start_html;
> print $cgi->startform("get","/cgi-bin/data.cgi");

Move these three lines above the $dbh, so that the headers are printed before
the output from printFailure() or printSuccess().

> the following error is being displayed on the screen:
>
>
> #######################################################################
>
> Software error:
> Undefined subroutine &Scalar::Util::blessed called at
> W:/usr/lib/overload.pm line 89.

Are you using Perl 5.6? If so, have you installed the Scalar::Util module? It
became a core module (i.e. included with Perl) as of 5.8, so you'll need to
install it separately if you're using 5.6.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

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


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