NAME

App::SimpleScan::Plugin::LinkCheck - Link counting/presence/absence plugin

VERSION

This document describes App::SimpleScan::Plugin::LinkCheck version 1.00

SYNOPSIS

  # After this plugin is installed:
  %%has_link 'My stuff'
  %%no_link  'Send email'

  # The has_link and no_link checks will run for every test spec.
  http://someplace.com /foo/ Y Got my page
  http://someplace.com/subpage /foo/ Y Got my subpage

  # Stop checking for the 'My stuff' link
  %%forget_link 'My stuff'

  # Now only the "no 'Send email' link' test will run.
  http://someplace.com/map  /foo/ Y Get map page

  # More specific tests can be done:
  # The page will have exactly one 'home' link
  %%has_link 'Home' == 1

  # The page will have a non-zero number of 'offsite' links.
  %%has_link 'offsite' > 0

  http://someplace.com/links /foo/ Y Get links page
  # Now both these tests and the 'send email' test will run.

DESCRIPTION

Th Linkcheck plugin adds simple link counting and presence/absence checking pragmas to simple_scan. These pragmas are assertions; they will be run for every test spec occurring after the pragma(s) appear in the intput file.

You can, for instance, assert that you do not want to see a link named 'Click here' anywhere in the pages referenced by the test specs in this test:

%%no_link 'Click here' 

Additional test specs generated by variable substitution will each have the check made, so for example

%%which bar baz quux
http://<which>.foo.com  /foo.com/ Y   Fetch page

would check for /foo.com/ on each of bar.foo.com, baz.foo.com, and quux.foo.com, and also check for zero links whose name is 'Click here' on each of these pages.

Conversely, you can assert that a link must be present on each page you look at:

%%has_link 'back'

This means that a link named 'back' must appear on every page you fetch after this pragma occurs in the input.

You may want to remove the condition for some pages in your tests; this can easily be done by 'forgetting' the link:

%%forget_link 'back'

The assertion has now been dropped, and will not be tested through the rest of the file. If you want to forget all of the currently-active link-count assertions, just use

%%forget_all_links

and all of the link checks will stop.

If you want to be more specific about the link counts, you can use the extended syntax for '%%has_link':

%%has_link 'beta' >= 0
%%has_link 'up' == 2
%%has_link 'report_problems' != 1

Note that you can use any of the numeric operators and a count for this. These work just like the other tests, in that they apply to every test spec following until either the end of the file, or a '%%forget_link' that drops them.

INTERFACE

init

Sets up the initial (empty) link conditions.

pragmas

Exports the definitions of has_link and no_link to simple_scan.

filters

Returns list of output filter subs to caller (standard callback).

filter

Determines what (if any) link checks are queued up and stackes them, incrementing the test count appropriately.

DIAGNOSTICS

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

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.

CONFIGURATION AND ENVIRONMENT

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

DEPENDENCIES

App::SimpleScan.

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests to bug-app-simplescan-plugin-linkcheck@rt.cpan.org, or through the web interface at http://rt.cpan.org.

AUTHOR

Joe McMahon <mcmahon@yahoo-inc.com>

LICENCE AND COPYRIGHT

Copyright (c) 2006, Yahoo! and Joe McMahon <mcmahon@yahoo-inc.com>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.