Rubric::CLI::Command::linkcheck - check validity of links in the database


Rubric documentation Contained in the Rubric distribution.

Index


Code Index:

NAME

Top

Rubric::CLI::Command::linkcheck - check validity of links in the database

VERSION

Top

version 0.147


Rubric documentation Contained in the Rubric distribution.

use strict;
use warnings;
package Rubric::CLI::Command::linkcheck;
use base qw(Rubric::CLI::Command);
our $VERSION = '0.147';

use LWP::Simple ();
use Rubric::DBI::Setup;

sub run {
  my ($self, $opt, $args) = @_;

  my $links = Rubric::Link->retrieve_all;

  while (my $link = $links->next) {
    my $uri = $link->uri;
    if ($uri->scheme ne 'http') {
      print "unknown scheme on link $link\n";
      next;
    }

    unless (LWP::Simple::head($uri)) {
      print "couldn't get headers for $uri\n";
    }
  }
}

1;