[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Writing GlobalSub in minivend.cfg
Hi,
I am trying to get a GlobalSub in minivend.cfg working.
When I restart the server, the error looks like:
Bareword "UserAgent" not allowed while "strict subs" in use at
(eval 7) line 15, <GLOBAL> chunk 441.
Bad GlobalSub 'geturl'
In line 441 of the configuration file 'minivend.cfg':
GlobalSub <<EndOfSub
The GlobalSub looks like this(Which is written by B.J. Bezemer) :
GlobalSub <<EndOfSub
sub geturl {
#
# This subroutine returns the response of a http request on a supplied
# url-address
#
my($url) = @_;
require LWP::UserAgent;
require HTTP::Request;
print("geturl url $url\n") if $Global::DEBUG;
my $string = "";
$url = "http://$url" unless ($url =~ /^\w+:\/\//);
my $ua = new LWP:UserAgent;
my $request = new HTTP::Request 'GET', $url;
my $response = $ua->request($request);
if ($response->is_success)
{
$string = $response->content();
}
return $string;
}
EndOfSub
--
____________________________________________________________________________
Shao Zhang - Running Debian 2.1 ___ _ _____
Department of Communications / __| |_ __ _ ___ |_ / |_ __ _ _ _ __ _
University of New South Wales \__ \ ' \/ _` / _ \ / /| ' \/ _` | ' \/ _` |
Sydney, Australia |___/_||_\__,_\___/ /___|_||_\__,_|_||_\__, |
Email: shao@cia.com.au |___/
_____________________________________________________________________________