Re: Need ideas on how to make this code faster than a speeding turtle
- From: Uri Guttman <uri@xxxxxxxxxxxxxxx>
- Date: Thu, 15 May 2008 21:37:30 GMT
"c" == chadda <chadda@xxxxxxxxxxxxxxxx> writes:
c> On May 15, 1:37 pm, Uri Guttman <u...@xxxxxxxxxxxxxxx> wrote:
>> >>>>> "c" == chadda <cha...@xxxxxxxxxxxxxxxx> writes:
>> i have to know if you could write this mess any slower? you are doing
>> everything possible to slow you down.
c> I know I shouldn't critize free help, but you seem to have some anger
c> management issues.
nope. i have bad code anger issues. i deal with this in code reviews all
the time. i just don't get how people come up with wacky and slow ways
to do things. i have seen worse code that read in files, parsed them,
wrote them out (untouched) and read them in again.
c> open(IN, '<', 'input') || die "cant open: $!";
c> $read = <IN>;
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?
c> Would using LWP speed up the code? By the way, this code is meant to
c> run on a server with restricted access. Ie, I can't install stuff from
c> cpan on that server.
if you have access to load scripts you can load pure perl modules
too. this is an FAQ.
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
>> also calling it @shit is not a good thing.
c> Huh? Are you saying I don't need the 'out' file?
yes. why do you think you need that file? you call backticks and get the
html page in $temp. why do you think you need a file to process that
data? you already have it inside perl.
Uri Guttman ------ uri@xxxxxxxxxxxxxxx -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
- Prev by Date: Re: Need ideas on how to make this code faster than a speeding turtle
- Next by Date: Re: Need ideas on how to make this code faster than a speeding turtle
- Previous by thread: Re: Need ideas on how to make this code faster than a speeding turtle
- Next by thread: Re: Need ideas on how to make this code faster than a speeding turtle