App-SimpleScan-Plugin-LinkCheck

 view release on metacpan or  search on metacpan

lib/App/SimpleScan/Plugin/LinkCheck.pm  view on Meta::CPAN

package App::SimpleScan::Plugin::LinkCheck;

$VERSION = '1.03';

use warnings;
use strict;
use Carp;

use Scalar::Util qw(looks_like_number);
use Text::Balanced qw(extract_quotelike extract_multiple);

sub import {
  no strict 'refs';
  *{caller() . '::_do_has_link'}   = \&_do_has_link;
  *{caller() . '::_do_no_link'}    = \&_do_no_link;
  *{caller() . '::link_condition'} = \&link_condition;
  *{caller() . '::_link_conditions'} = \&_link_conditions;
  *{caller() . '::_add_link_condition'} = \&_add_link_condition;

lib/App/SimpleScan/Plugin/LinkCheck.pm  view on Meta::CPAN

        push @code, qq(fail "$compare is not a legal comparison operator (use < > <= >= == !=)";\n);
        $test_count++;
        $not_bogus = 0;
      }

      if (!defined($count)) {
        push @code, qq(fail "Missing count";\n);
        $test_count++;
        $not_bogus = 0;
      }
      elsif (! looks_like_number($count) ) {
        push @code, qq(fail "$count doesn't look like a legal number to me";\n);
        $test_count++;
        $not_bogus = 0;
      }

      if ($not_bogus) {
        my $last_testspec  = $self->get_current_spec;
        $last_testspec->comment( qq('$name' link count $compare $count) );

        push @code, qq(cmp_ok scalar \@{[mech()->find_all_links(text=>qq($name))]}, qq($compare), qq($count), "'$name' link count $compare $count";\n);

lib/App/SimpleScan/Plugin/LinkCheck.pm  view on Meta::CPAN


=over

=item C<< %s is not a legal comparison operator (use < > <= >= == !=) >>

You supplied a comparison operator that wasn't one we expected.

=item C<< %s doesn't look like a legal number to me >>

The item you supplied as a count of the number of times you expect to 
see the link was not something that looks like a number to Perl.

=back


=head1 CONFIGURATION AND ENVIRONMENT

App::SimpleScan::Plugin::LinkCheck requires no configuration files or environment variables.


=head1 DEPENDENCIES



( run in 0.521 second using v1.01-cache-2.11-cpan-64827b87656 )