Mo::utils::URI - Mo utilities for URI.
use Mo::utils::URI qw(check_location check_uri check_url); check_location($self, $key); check_uri($self, $key); check_url($self, $key); check_urn($self, $key);
Mo utilities for URI checking of data objects.
check_location
check_location($self, $key);
Check parameter defined by $key which is valid location. Could be URL or absolute or relative path.
$key
Put error if check isn't ok.
Returns undef.
check_uri
check_uri($self, $key);
Check parameter defined by $key which is valid URI.
check_url
check_url($self, $key);
Check parameter defined by $key which is valid URL.
check_urn
check_urn($self, $key);
Check parameter defined by $key which is valid URN.
check_location(): Parameter '%s' doesn't contain valid location. Value: %s check_uri(): Parameter '%s' doesn't contain valid URI. Value: %s check_url(): Parameter '%s' doesn't contain valid URL. Value: %s check_urn(): Parameter '%s' doesn't contain valid URN. Value: %s
use strict; use warnings; use Mo::utils::URI qw(check_location); my $self = { 'key' => 'https://skim.cz', }; check_location($self, 'key'); # Print out. print "ok\n"; # Output: # ok
use strict; use warnings; use Error::Pure; use Mo::utils::URI qw(check_location); $Error::Pure::TYPE = 'Error'; my $self = { 'key' => 'urn:isbn:9788072044948', }; check_location($self, 'key'); # Print out. print "ok\n"; # Output like: # #Error [..utils.pm:?] Parameter 'key' doesn't contain valid location.
use strict; use warnings; use Mo::utils::URI qw(check_uri); my $self = { 'key' => 'https://skim.cz', }; check_uri($self, 'key'); # Print out. print "ok\n"; # Output: # ok
use strict; use warnings; use Error::Pure; use Mo::utils::URI qw(check_uri); $Error::Pure::TYPE = 'Error'; my $self = { 'key' => 'bad_uri', }; check_uri($self, 'key'); # Print out. print "ok\n"; # Output like: # #Error [..utils.pm:?] Parameter 'key' doesn't contain valid URI.
use strict; use warnings; use Mo::utils::URI qw(check_url); my $self = { 'key' => 'https://skim.cz', }; check_url($self, 'key'); # Print out. print "ok\n"; # Output: # ok
use strict; use warnings; use Error::Pure; use Mo::utils::URI qw(check_url); $Error::Pure::TYPE = 'Error'; my $self = { 'key' => 'bad_uri', }; check_uri($self, 'key'); # Print out. print "ok\n"; # Output like: # #Error [..utils.pm:?] Parameter 'key' doesn't contain valid URL.
use strict; use warnings; use Mo::utils::URI qw(check_urn); my $self = { 'key' => 'urn:isbn:0451450523', }; check_urn($self, 'key'); # Print out. print "ok\n"; # Output: # ok
use strict; use warnings; use Error::Pure; use Mo::utils::URI qw(check_urn); $Error::Pure::TYPE = 'Error'; my $self = { 'key' => 'bad_urn', }; check_urn($self, 'key'); # Print out. print "ok\n"; # Output like: # #Error [..utils.pm:?] Parameter 'key' doesn't contain valid URN.
Data::Validate::URI, Error::Pure, Exporter, Readonly, URI.
Micro Objects. Mo is less.
Mo CSS utilities.
Mo date utilities.
Mo language utilities.
Mo utilities for email.
Wikibase datatype utilities.
https://github.com/michal-josef-spacek/Mo-utils-URI
Michal Josef Špaček mailto:skim@cpan.org
http://skim.cz
© 2024 Michal Josef Špaček
BSD 2-Clause License
0.02
To install Mo::utils::URI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mo::utils::URI
CPAN shell
perl -MCPAN -e shell install Mo::utils::URI
For more information on module installation, please visit the detailed CPAN module installation guide.