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, 7:06 pm
Newsgroups: comp.lang.perl.misc
From: cha...@lonemerchant.com
Date: Thu, 15 May 2008 16:06:25 -0700 (PDT)
Local: Thurs, May 15 2008 7:06 pm
Subject: Re: Need ideas on how to make this code faster than a speeding turtle
On May 15, 3:16 pm, "Gordon Etly" <ge...@bentsys-INVALID.com> wrote:

> cha...@lonemerchant.com wrote:
> > On May 15, 1:37 pm, Uri Guttman <u...@stemsystems.com> wrote:
> > 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.

> He seems to constantly come across this way. I really wish he could see
> things from other points of view.
> ...

> As a simple answer, take a look at LWP:UserAgent
> (http://search.cpan.org/~gaas/libwww-perl-5.812/lib/LWP/UserAgent.pm),
> as a good start in the right direction.

> --
> G.Etly

I just tried LWP, and now I can't get the code to work for the life of
me. Here is what I attempted

#!/usr/bin/perl -w

use LWP::UserAgent;
use HTTP::Request;
use HTTP::Cookies;

my ($read, $build, @product, @id, @sku, @upc, @weight);
my @temp;

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

my $ua = LWP::UserAgent->new;
$ua->agent("OMEGA SPARC DESTROYER/69");

my $request = HTTP::Request->new('GET');
$request->url($build);

my $cookie_jar = HTTP::Cookies->new;
$cookie_jar->add_cookie_header($request);

my $response = $ua->request($request);

my $code = $response->code;
print $code;

@temp = $request->content;

@product = grep(/Product ID/, @temp);
@id = grep(/Item ID/, @temp);
@sku = grep(/SKU/, @temp);
@upc = grep(/UPC/, @temp);
@weight = grep(/Weight/, @temp);

print @product;
print @id;
print @sku;
print @upc;
print @weight;

% ./parse.pl
500%


    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