develooper Front page | perl.libwww | Postings from October 2001

Can't locate object method "host" via package "URI::mailto"

Thread Next
Bill Moseley
October 1, 2001 13:52
Can't locate object method "host" via package "URI::mailto"
Message ID:
What's the correct way to do deal with these?  

I'm spidering, and I want to extract out links, but only links on the same
server.  I use %HTML::Tagset::linkElements and a list of tags (e.g. <a>
<frame>) to find links to follow.  But, if I grab a mailto: or file:// that
doesn't have a host method, then I get the errors.  


sub UNIVERSAL::host { '' }; 
sub UNIVERSAL::port { '' }; 

for all the methods that I use?  What's the best way to handle this?

for ( @$links ) {

    my $u = URI->new_abs( $attr{$_},$base );

    $u->fragment( undef );

    # Ignore duplicates on the same page
    next if $seen{$u}++;

    # Must have a host name
    next unless $u->host;

    # Make sure the server name is one listed 
    next unless grep { $u->authority eq $_ } @valid_servers;

    # Force all the same host name
    $u->authority( $server->{authority} );

    push @links, $u;

Bill Moseley

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About