Intrepid has asked for the wisdom of the Perl Monks concerning the following question:
I start out with this:
use vars qw($Pua $parsor $spp_Array);
$Pua = new LWP::UserAgent;
$spp_Array = 0;
$parsor = HTML::LinkExtor->new(\&callback);
my $res = $Pua->request(HTTP::Request->
new(GET => $WebPage),sub {$parsor->parse($_[0])});
$Ubase = $res->base;
sub callback {
my($tag, %attr) = @_ ;
my $Urray = ($spp_Array)? \@main::morePicpages : \@main::Picpages;
return if $tag ne 'a';
push(@$Urray, values %attr);
}
This works great once. Then much further down into my code, based all sorts
of conditional stuff far too lengthy to post here, I try this:
my ($all_links, $response, $parser_agin);
$spp_Array = 1;
$parsor_agin = HTML::LinkExtor->new(\&callback);
$response = $Pua->request(
HTTP::Request->new(
GET => $all_links, sub {$parsor_agin->parse($_[0])})
);
This is how that code fails:
Can't call method "clone" on unblessed reference at D:\perl\site\lib/HTTP/Message.pm line 53.
Help. Cannot see why it worked once then will not work again, and
there's a suspicion in my mind that some OO thing that I don't get
is biting me. BTW, pls remember if you would reply that lots of
perlers don't totally grasp OO, and this is not a pissing contest
but each of us individually on a long-term path of seeking to improve
our depth of understanding. In that spirit, and not merely out of
individual thin-skinned-ness, flame-like replies will be ignored.
Thanks
soren
- Comment on HTTP::Message unblessed reference error? I don't get it.
| Replies are listed 'Best First'. | |
|---|---|
|
Re: HTTP::Message unblessed reference error? I don't get it.
by tye (Sage) on Aug 06, 2000 at 08:44 UTC | |
|
Re: HTTP::Message unblessed reference error? I don't get it.
by Intrepid (Curate) on Aug 07, 2000 at 05:18 UTC |