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


In reply to HTTP::Message unblessed reference error? I don't get it. by Intrepid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.