Gossamer Forum
Home : Products : DBMan SQL : Discussion :

verifying URL

Quote Reply
verifying URL
I am currently running DBMan SQL 2.0.3, and am attempting to call a perl function in the search_results template:

<%set broken_link = Dbsql::HTML::check_url(current_URL)%>

I added this funciton to the HTML.pm file:

sub check_url {
# --------------------------------------------------------
# Checks to see if the URL is valid
use LWP::Simple;
$URL = shift;
unless (defined ($content = get $URL)) {
return "0";
}
return "1";
}

When the link is broken, the variable broken_link should be set to 0. This worked fine in the flat-file version of DBMan, but I get the error:

Error: Unable to load module: Dbsql::HTML. Reason:

Compilation failed in require at /www/cgi-bin/admin/GT/Template.pm line 656. ,
Error: No subroutine 'Dbsql::HTML::check_url' in 'Dbsql.pm'

Any help would be appreciated. Thanks.
Quote Reply
Re: [mrsnyder] verifying URL In reply to
You could/should change it to:

Code:
sub check_url {
# --------------------------------------------------------
# Checks to see if the URL is valid

use LWP::Simple;
return defined get($_[0]) ? 1 : 0;

}

Are you sure you have the case right for the module?

Last edited by:

RedRum: Feb 23, 2002, 2:37 AM
Quote Reply
Re: [RedRum] verifying URL In reply to
Worked like a charm. Thanks RedRum!