| 1 | package WWW::Link::Merge.pm; | ||
| 2 | $REVISION=q$Revision: 1.4 $ ; $VERSION = sprintf ( "%d.%02d", $REVISION =~ /(\d+).(\d+)/ ); | ||
| 3 | |||
| 4 | =head1 NAME | ||
| 5 | |||
| 6 | WWW::Link::Merge.pm - merge two links | ||
| 7 | |||
| 8 | =head1 SYNOPSIS | ||
| 9 | |||
| 10 | B<Not yet implemented> | ||
| 11 | |||
| 12 | =head1 DESCRIPTION | ||
| 13 | |||
| 14 | This provides a simple function which merges two links (related to the | ||
| 15 | same URL) together to extract the maximum information from both of | ||
| 16 | them. For example, the refresh date could be taken from one whilst | ||
| 17 | the test information could come from the other. | ||
| 18 | |||
| 19 | The interface is a simple function | ||
| 20 | |||
| 21 | =cut | ||
| 22 | |||
| 23 | use WWW::Link; | ||
| 24 | |||
| 25 | merge ($$) { | ||
| 26 | my ($first, $second) = @_; | ||
| 27 | |||
| 28 | croak "link urls must be identical for merge" | ||
| 29 | unless $first->{"url"} eq $second->{"url"}; | ||
| 30 | |||
| 31 | my $result=new WWW::Link $first->{"url"}; | ||
| 32 | |||
| 33 | #refresh time should be the latest of either | ||
| 34 | ($first->{"last_refresh"} > $second->{"last_refresh"} | ||
| 35 | && $result->{"last_refresh"} > $first->{"last_refresh"} ); | ||
| 36 | |||
| 37 | #test information.. more complex.. take the latest information, but | ||
| 38 | #if one is broken, but the other has tested okay recently, | ||
| 39 | #compensate apropriately. | ||
| 40 | |||
| 41 | die "not implemented" | ||
| 42 | |||
| 43 | return $result | ||
| 44 | |||
| 45 | } | ||
| 46 | |||
| 47 |