Re: Need ideas on how to make this code faster than a speeding turtle



"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> 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?
>>
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
>> effort.
>>
>> 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

--
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 ---------
.



Relevant Pages

  • Re: loading html pages in frames
    ... http://server/temp/data/report.html it still wants to download the file. ... >> default web site.(ie. To the default web a virtual directory call temp ... >> On the server when we click on the link we get a momentary downloading ... >> to load it but I get the same behaviour as trying to load from the ...
    (microsoft.public.inetserver.iis)
  • Re: loading html pages in frames
    ... > another virtual directory. ... > default web site.(ie. To the default web a virtual directory call temp ... > checked the web server logging files. ... > to load it but I get the same behaviour as trying to load from the ...
    (microsoft.public.inetserver.iis)
  • Re: Problem trying insert data into a temp table via SP
    ... needs to load some data into a temp table. ... But throws another exception, -535 (Already in transaction), this ... fact that DB-Access is a separate session will kill you again - ...
    (comp.databases.informix)
  • Re: Using Perl to find what address bar says
    ... I'm hoping there's a way to do it in Perl. ... Now, load this normally in your browser, then load it again using ... Doing a side-by-side comparison, you'll see several discrepancies. ... so, I can simply load a session variable on one page, then ...
    (comp.lang.perl.misc)
  • DBI make test fails - trying to load old Storable
    ... Installing DBI-1.51 - 'make test' returns results that seem strange. ... tests that 'use Storable' attempt to load an old version installed under ... A newer version of Storable is installed under Perl 5.8. ... support iThreads ...
    (perl.dbi.users)