Google Groups Home
Help | Sign in
Message from discussion Need ideas on how to make this code faster than a speeding turtle
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
cha...@lonemerchant.com  
View profile
 More options May 15, 5:21 pm
Newsgroups: comp.lang.perl.misc
From: cha...@lonemerchant.com
Date: Thu, 15 May 2008 14:21:23 -0700 (PDT)
Local: Thurs, May 15 2008 5:21 pm
Subject: Re: Need ideas on how to make this code faster than a speeding turtle
On May 15, 1:37 pm, Uri Guttman <u...@stemsystems.com> wrote:

> >>>>> "c" == chadda  <cha...@lonemerchant.com> writes:

> i have to know if you could write this mess any slower? you are doing
> everything possible to slow you down.

I know I shouldn't critize free help, but you seem to have some anger
management issues.

>   c> open(IN, '<', 'input') || die "cant open: $!";
>   c> $read = <IN>;
>   c> chomp($read);
>   c> $build = "http://www.doba.com/members/catalog/".$read.".html";
>   c> $temp = `lynx -accept_all_cookies -dump $build`;

> why are you calling out to a program when perl can load web pages just
> fine with LWP? did you even look for web stuff on cpan?

Would using LWP speed up the code? By the way, this code is meant to
run on a server with restricted access. Ie, I can't install stuff from
cpan on that server.

>   c> open(OUTFILE, '>out');
>   c> print OUTFILE $temp;
>   c> close OUTFILE;

>   c> open(OUT, '<', 'out') || die "cant open: $!";
>   c> @shit = <OUT>;

> why are you writing out the output of lynx JUST TO READ IT BACK IN
> AGAIN? this is the most absurd part of this program.

> you have the text in $temp. you know how to use backticks but why do you
> do the file write and reading back in? if you assigned the backticks to
> an array you would get the same thing as in @shit without the wasted
> effort.

> also calling it @shit is not a good thing.

Huh? Are you saying I don't need the 'out' file?
>   c> @product = grep(/Product ID/, @shit);
>   c> @id = grep(/Item ID/, @shit);
>   c> @sku = grep(/SKU/, @shit);
>   c> @upc = grep(/UPC/, @shit); #this part doesn't grep UPC correctly. I
>   c> get some extra data after UPC.

> that is a problem with the format of the html page. html isn't line
> oriented and you are grepping over lines. the proper way to deal with
> html is with a parser. or in special very well defined cases with
> regexes to actually grab what you want from the text. whole html lines
> are almost never what you want.

> uri


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google