| 1 | =head1 NAME | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | WWW::Link::Reporter::LongList - Long list files which contain broken links | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | use WWW::Link; | ||||||||||||||||||||||||||||
| 8 | use WWW::Link::Reporter::LongList; | ||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | $link=new WWW::Link; | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | #over time do things to the link ...... | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | $reporter = new WWW::Link::Reporter::LongList \*STDOUT, $index; | ||||||||||||||||||||||||||||
| 15 | $reporter->examine($link) | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | or see WWW::Link::Selector for a way to recurse through all of the links. | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | This is a WWW::Link::Reporter very similar to WWW::Link::Reporter::Text, but | ||||||||||||||||||||||||||||
| 22 | when it detects a broken link in a local file it will list that file | ||||||||||||||||||||||||||||
| 23 | in C<ls -l> format. This can be used to allow easy editing, for | ||||||||||||||||||||||||||||
| 24 | example by C<link-report-dired> in C<emacs> | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | =cut | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | package WWW::Link::Reporter::LongList; | ||||||||||||||||||||||||||||
| 29 | 1 | $REVISION=q$Revision: 1.10 $ ; $VERSION = sprintf ( "%d.%02d", $REVISION =~ /(\d+).(\d+)/ ); | |||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 1 | ▶ | use WWW::Link::Reporter::Text; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 32 | 1 | @ISA = qw(WWW::Link::Reporter::Text); | |||||||||||||||||||||||||||
| 33 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 34 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 35 | 1 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 36 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 39 | 0 | my $proto=shift; | |||||||||||||||||||||||||||
| 40 | 0 | my $url_to_file=shift; | |||||||||||||||||||||||||||
| 41 | 0 | ▶ | croak "usage <class>->new(<convert function>,<index>)" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $url_to_file and @_
MC/DC0%0/2
ref $url_to_file and @_
ref $url_to_file
@_
Truth table0%0/3
A and B
A= ref $url_to_fileB= @_
| |||||||||||||||||||||||||||||
| 42 | unless ref $url_to_file and @_; | ||||||||||||||||||||||||||||
| 43 | 0 | ▶ | my $class = ref($proto) || $proto; | ||||||||||||||||||||||||||
|
Condition0%0/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||||||||||
| 44 | 0 | my $self = $class->SUPER::new(@_); | |||||||||||||||||||||||||||
| 45 | 0 | $self->{"url_to_file"}=$url_to_file; | |||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 0 | ▶ | if ( $self->{"verbose"} & 128) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | 0 | my $dump=Dumper($self); | |||||||||||||||||||||||||||
| 49 | 0 | $dump =~ s/[^[:graph:]\s]/_/g; | |||||||||||||||||||||||||||
| 50 | 0 | print "self\n" . $dump . "\n"; | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 0 | return $self; | |||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 0 | ▶ | sub page_list { | ||||||||||||||||||||||||||
|
Subroutine
page_list: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 57 | 0 | my $self=shift; | |||||||||||||||||||||||||||
| 58 | 0 | my @worklist=(); | |||||||||||||||||||||||||||
| 59 | 0 | my @unresolve=(); | |||||||||||||||||||||||||||
| 60 | 0 | my $url_to_file=$self->{"url_to_file"}; | |||||||||||||||||||||||||||
| 61 | 0 | foreach my $url (@_) { | |||||||||||||||||||||||||||
| 62 | 0 | my $file = &$url_to_file($url); | |||||||||||||||||||||||||||
| 63 | 0 | ▶ | if ($file) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 64 | 0 | push @worklist, quotemeta ($file); | |||||||||||||||||||||||||||
| 65 | } else { | ||||||||||||||||||||||||||||
| 66 | 0 | push @unresolve, $url; | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | 0 | ▶ | if ( @worklist ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 70 | 0 | my $workfile=join ' ', @worklist; | |||||||||||||||||||||||||||
| 71 | 0 | print `ls -l $workfile`; | |||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | 0 | ▶ | print 'unresolved:- ', join ("\nunresolved:- ", @unresolve), "\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 74 | if @unresolve; | ||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||