Data::FormValidator::URI - URI constraint/filter for Data::FormValidator
use Data::FormValidator; use Data::FormValidator::URI; my $res = Data::FormValidator->check( { website => 'http://www.example.com/path/to/some/resource.html', }, { required => [qw( website )], field_filters => { website => FV_uri_filter(default => 'http'), }, constraint_methods => { website => FV_uri( schemes => [qw( http https )], hostcheck => 1, allow_userinfo => 0, ), }, }, );
This module provides a filter and a constraint method for use with Data::FormValidator, to help make it easier to valid URIs.
Data::FormValidator
Filter method which cleans up the given value as best it can and returns something that looks like a URI.
The filtered URI will be canonicalized, and common typos will be corrected.
Supported options:
Default URI scheme to use, if none was provided in the URI
Constraint method, which ensures that we have a valid URI.
list-ref of valid schemes
host exists in URI and resolves as a valid host? (default off)
allow user info in URI (default off)
Graham TerMarsch <cpan@howlingfrog.com>
Copyright (C) 2013, Graham TerMarsch. All Rights Reserved.
This is free software; you can redistribute it and/or modify it under the terms of the Artistic 2.0 license.
To install Data::FormValidator::URI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::FormValidator::URI
CPAN shell
perl -MCPAN -e shell install Data::FormValidator::URI
For more information on module installation, please visit the detailed CPAN module installation guide.