in reply to Checking links between web-pages
If I grok what you mean
When Page 3 links to Page 7 you wish to ensure Page 7 also links back to Page 3...
Pass 1, examine all pages and build a hash keyed by linked page containing arrayrefs to an array of pages that linked it. for instance if on page 3 you found a link to page 7 push @{$hash{7}}, 3 of course you check first the key for 7 exists and create if required
Pass 2, go through the hash keys and see what is in the attached array to get a list of all pages that linked to this page
Here is a rough framework
# something like this.... # @Pages is a list of integer page numbers # get_links_linked_from($) does what it looks like foreach my $page (@Pages) { my @Links=&get_pages_linked_from($page); foreach (@Links) { $Link_Store[$_]=[] unless $Link_Store[$_]; push @{$Link_Store[$_]}, $page; } } # assuming you start on page 1 for (my $i=1; $i<=$#Link_Store; $i++) { my $linkers = join ", ", @{$Link_Store[$i]}; print "Page $i linked from $linkers\n" }
Cheers,
R.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Checking links between web-pages
by yacoubean (Scribe) on Oct 13, 2004 at 16:37 UTC |