Skip to content

Commit

Permalink
Merge 74bab31 into 71df140
Browse files Browse the repository at this point in the history
  • Loading branch information
ferki committed Nov 27, 2019
2 parents 71df140 + 74bab31 commit d4997a6
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion lib/Statocles/Plugin/LinkCheck.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ use Statocles::Base 'Class';
with 'Statocles::Plugin';
use Mojo::Util qw( url_escape url_unescape );

=attr fatal
If set to true, and there are any broken linke, the plugin will also call
C<die()> after printing the problems. Defaults to false.
=cut

has fatal => (
is => 'ro',
isa => Bool,
default => 0,
);

=attr ignore
An array of URL patterns to ignore. These are interpreted as regular expressions,
Expand Down Expand Up @@ -95,6 +108,8 @@ sub check_pages {
;
$event->emitter->log->warn( "URL broken on $m->[1]: $msg" );
}

die 'Link check failed!' if $self->fatal;
}
}

Expand Down Expand Up @@ -124,5 +139,6 @@ sub register {
=head1 DESCRIPTION
This plugin checks all of the links and images to ensure they exist. If something
is missing, this plugin will write a warning to the screen.
is missing, this plugin will write a warning to the screen. If fatal is set to true,
it will also call C<die()> afterwards.

0 comments on commit d4997a6

Please sign in to comment.