D
Dave
Hi,
I have one routine called "browserbuilder" which builds a moderately
complex LWP user agent, among other things. I want to be able to call
the browserbuilder sub from another routine and have browserbuilder
return the browser object to that subroutine. I then want that
subroutine to return the browser object when it is called from another
routine, which will end up using the browser object.
I clearly have something wrong, but I have not delt with objects and
references enough to figure out what. Can anyone tell me how to do it
correctly or point me in the right direction?
Thanks,
Dave
------------------------------------------------
I have a certain point in the browserbuilder subroutine right now that
looks like this:
if ($vlinkcall eq "yes")
{
$xbrowser->max_size(undef); # i built the rest of $xbrowser
elsewhere
return \$xbrowser; #$xbrowser is the name of my LWP::UserAgent
object
}
The command in the second subroutine, called "load_browser", which
calls the browserbuilder subroutine looks like this:
$browser=&browserbuilder($xurlid, $xusername, $xurl, $xtimezone,
$xauthusername, $xauthpassword, $xpostdata, $xcookieurl, $xrefurl,
$xtextstring1, $xtextstring2, $xaltcode, $xhackerchecksum, $i,
$xpalerts, $xsalerts, $xcheckrecovery, $xauthtype, $newchecksum,
$xlinkcall);
return \$browser;
The routine that needs the browser object uses this code:
$xbrowser=&load_browser($vurlid);
$xresponse= $xbrowser->get($murl);
The error message is:
Can't call method "get" on unblessed reference at ./simplelinks.cgi
line 80.
I have one routine called "browserbuilder" which builds a moderately
complex LWP user agent, among other things. I want to be able to call
the browserbuilder sub from another routine and have browserbuilder
return the browser object to that subroutine. I then want that
subroutine to return the browser object when it is called from another
routine, which will end up using the browser object.
I clearly have something wrong, but I have not delt with objects and
references enough to figure out what. Can anyone tell me how to do it
correctly or point me in the right direction?
Thanks,
Dave
------------------------------------------------
I have a certain point in the browserbuilder subroutine right now that
looks like this:
if ($vlinkcall eq "yes")
{
$xbrowser->max_size(undef); # i built the rest of $xbrowser
elsewhere
return \$xbrowser; #$xbrowser is the name of my LWP::UserAgent
object
}
The command in the second subroutine, called "load_browser", which
calls the browserbuilder subroutine looks like this:
$browser=&browserbuilder($xurlid, $xusername, $xurl, $xtimezone,
$xauthusername, $xauthpassword, $xpostdata, $xcookieurl, $xrefurl,
$xtextstring1, $xtextstring2, $xaltcode, $xhackerchecksum, $i,
$xpalerts, $xsalerts, $xcheckrecovery, $xauthtype, $newchecksum,
$xlinkcall);
return \$browser;
The routine that needs the browser object uses this code:
$xbrowser=&load_browser($vurlid);
$xresponse= $xbrowser->get($murl);
The error message is:
Can't call method "get" on unblessed reference at ./simplelinks.cgi
line 80.