Hi All,

I am developing a perl script using the LWP library to extract all the links from a website.

I only am planning to extract the internal links of a website.

Now there is a URI class which has a hostname instance variable, which will always extract the domain name of the URL we extract. this domain name we can compare with the base dns which we store.

But for subdomains this hostname will not compare to the base dns for a website.

How do I check if the subdomain is from the same domain so that the links extracted from the subdomains also appear in the list of URLs extracted from the website.

P.S. base dns is the website from which we are extracting all the links.

Regards
Vaibhav

sub uri_split
{
	my $url = shift;
	return $url =~ m|(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?|;
}

my ($scheme, $auth, $path, $query, $frag) = &uri_split($url);

split the uri and compare it