in reply to Re: Re: File Find error
in thread File Find error

I think the reason that you get no output is that you are not really feeding the html file content to the parser. Your while loop starts like this:
while(my $line = <FH>)
but even if you have localized $/ to be undefined, as suggested above, none of the steps carried out within the loop ever use the value of $line. Seems to me you have to pass $line as the arg to the $parser->$parse() call.

Also, it might help to add some sanity checks; e.g.:

@links = $parser->links; if ( @links == 0 ) { warn "no links found in $name\n"; return; }

Replies are listed 'Best First'.
Re: Re: Re: Re: File Find error
by Anonymous Monk on Jun 24, 2003 at 21:21 UTC
    Thanks I tried as suggested and still not finding links. It now comes back with listing of all files recursively saying: no links were found in each file.

    The good part is it does search all my files but why cant I extract any links in any of them?
    return unless -f $name; open ( FH, $name ) or die "error $!: $name\n"; local $/; while(my $line = <FH>) { $base_url = $name; $parser = HTML::LinkExtor->new(undef, $name); $parser->parse(get($line))->eof; @links = $parser->links; if ( @links == 0 ) { warn "no links found in $name\n"; return; } foreach $linkarray (@links)