Test::URI - Check Uniform Resource Identifiers
use Test::More tests => 5; use Test::URI; # http://www.example.com:8080/index.html#name uri_scheme_ok( $uri, 'http' ); uri_host_ok( $uri, 'www.example.com' ); uri_port_ok( $uri, '8080' ); uri_path_ok( $uri, '/index.html' ); uri_fragment_ok( $uri, 'name' );
Check various parts of Uniform Resource Locators
Ok is the STRING is a valid URI, in any format that URI accepts, and the URI uses the same SCHEME (i.e. protocol: http, ftp, ...). SCHEME is not case sensitive.
STRING can be an URI object.
Ok is the STRING is a valid URI, in any format that URI accepts, and the URI uses the same HOST. HOST is not case sensitive.
Not Ok is the URI scheme does not have a host portion.
Ok is the STRING is a valid URI, in any format that URI accepts, and the URI uses the same PORT.
Not Ok is the URI scheme does not have a port portion.
UNIMPLEMENTED. I'm not sure why I thought this should be a test. If anyone else knows, I'll implement it.
Ok is the STRING is a valid URI, in any format that URI accepts, and the URI has the path PATH. Remember that paths start with a /, even if it doesn't look like there is anything after the host parts.
Ok is the STRING is a valid URI, in any format that URI accepts, and the URI has the fragment FRAGMENT.
* add methods: uri_canonical_ok, uri_query_string_ok
This source is part of a SourceForge project which always has the latest sources in CVS, as well as all of the previous releases.
http://sourceforge.net/projects/brian-d-foy/
If, for some reason, I disappear from the world, one of the other members of the project can shepherd this module appropriately.
brian d foy, <bdfoy@cpan.org>
<bdfoy@cpan.org>
Copyright (c) 2004-2007 brian d foy. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Test::URI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::URI
CPAN shell
perl -MCPAN -e shell install Test::URI
For more information on module installation, please visit the detailed CPAN module installation guide.