Gossamer Forum
Quote Reply
Error: not a coderef
I have the following global:
Code:
sub {
my $ip_address = shift;
use strict;
use Net::DNS;
use IO::Select;

my $timeout = 5;
my $nameserver = "ns.phys.uu.nl";
my %host;
my $result;
my $res = new Net::DNS::Resolver;
$res->nameservers( $nameserver );
my $bgsock = $res->bgsend( $ip_address );
my $sel = new IO::Select($bgsock);
my @ready = $sel->can_read($timeout);
if (@ready) {
foreach my $sock (@ready) {
if ($sock == $bgsock) {
my $packet = $res->bgread($bgsock);
if ($packet) {
foreach my $rr ($packet->answer) {
my $hostname = $rr->rdatastr;
$hostname =~ s/\.$//g;
$result = $hostname;
}
}
else {
$result = $ip_address;
}
$bgsock = undef;
}
$sel->remove($sock);
$sock = undef;

}
}
else {
$result = $ip_address;
}
if ( $result eq "" ) { $result = $ip_address; }
return $result;
}

When I use <%hostlookup($online_ip)%>, I get Error: Variable 'hostlookup' is not a code reference

Any ideas what might cause this? The thing is, the code used to work in GForum v 1.0.0, but it doesn't in 1.1.1. I already tried to change the last line into "return \$result;" but that wouldn't work.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Subject Author Views Date
Thread Error: not a coderef yogi 3622 Jan 28, 2002, 6:38 AM
Thread Re: [yogi] Error: not a coderef
Jagerman 3522 Jan 28, 2002, 5:28 PM
Thread Re: [jagerman] Error: not a coderef
yogi 3527 Jan 29, 2002, 1:36 AM
Post Re: [yogi] Error: not a coderef
Jagerman 3507 Jan 29, 2002, 9:58 AM