/usr/share/perl5/MooseX/Types/URI.pm is in libmoosex-types-uri-perl 0.08-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | use strict;
use warnings;
package MooseX::Types::URI; # git description: v0.07-13-g73c0cd8
# ABSTRACT: URI related types and coercions for Moose
# KEYWORDS: moose types constraints coercions uri path web
our $VERSION = '0.08';
use Scalar::Util qw(blessed);
use URI;
use URI::QueryParam;
use URI::WithBase;
use MooseX::Types::Moose qw{Str ScalarRef HashRef};
use MooseX::Types::Path::Class qw{File Dir};
use MooseX::Types 0.40 -declare => [qw(Uri _UriWithBase _Uri FileUri DataUri)];
use if MooseX::Types->VERSION >= 0.42, 'namespace::autoclean';
my $uri = Moose::Meta::TypeConstraint->new(
name => Uri,
parent => Moose::Meta::TypeConstraint::Union->new(
name => join("|", _Uri, _UriWithBase),
type_constraints => [
class_type( _Uri, { class => "URI" } ),
class_type( _UriWithBase, { class => "URI::WithBase" } ),
],
),
($Moose::VERSION >= 2.0100
? (inline_as => sub { 'local $@; blessed('.$_[1].') && ( '.$_[1].'->isa("URI") || '.$_[1].'->isa("URI::WithBase") )' })
: (optimized => sub { local $@; blessed($_[0]) && ( $_[0]->isa("URI") || $_[0]->isa("URI::WithBase") ) })
),
);
register_type_constraint($uri);
coerce( Uri,
from Str , via { URI->new($_) },
from "Path::Class::File" , via { require URI::file; URI::file::->new($_) },
from "Path::Class::Dir" , via { require URI::file; URI::file::->new($_) },
from File , via { require URI::file; URI::file::->new($_) },
from Dir , via { require URI::file; URI::file::->new($_) },
from ScalarRef , via { my $u = URI->new("data:"); $u->data($$_); $u },
from HashRef , via { require URI::FromHash; URI::FromHash::uri_object(%$_) },
);
class_type FileUri, { class => "URI::file", parent => $uri };
coerce( FileUri,
from Str , via { require URI::file; URI::file::->new($_) },
from File , via { require URI::file; URI::file::->new($_) },
from Dir , via { require URI::file; URI::file::->new($_) },
from "Path::Class::File" , via { require URI::file; URI::file::->new($_) },
from "Path::Class::Dir" , via { require URI::file; URI::file::->new($_) },
);
class_type DataUri, { class => "URI::data" };
coerce( DataUri,
from Str , via { my $u = URI->new("data:"); $u->data($_); $u },
from ScalarRef , via { my $u = URI->new("data:"); $u->data($$_); $u },
);
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
MooseX::Types::URI - URI related types and coercions for Moose
=head1 VERSION
version 0.08
=head1 SYNOPSIS
use MooseX::Types::URI qw(Uri FileUri DataUri);
=head1 DESCRIPTION
This package provides Moose types for fun with L<URI>s.
=head1 TYPES
The types are with C<ucfirst> naming convention so that they don't mask the
L<URI> class.
=head2 C<Uri>
Either L<URI> or L<URI::WithBase>
Coerces from C<Str> via L<URI/new>.
Coerces from L<Path::Class::File> and L<Path::Class::Dir> via L<URI::file/new>.
Coerces from C<ScalarRef> via L<URI::data/new>.
Coerces from C<HashRef> using L<URI::FromHash>.
=head2 C<DataUri>
A URI whose scheme is C<data>.
Coerces from C<Str> and C<ScalarRef> via L<URI::data/new>.
=head2 C<FileUri>
A L<URI::file> class type.
Has coercions from C<Str>, L<Path::Class::File> and L<Path::Class::Dir> via L<URI::file/new>
=for stopwords DWIMier ducktyping
It has slightly DWIMier types than the L<URI> classes have due to
implementation details, so the types should be more forgiving when ducktyping
will work anyway (e.g. L<URI::WithBase> does not inherit L<URI>).
=for stopwords TODO
=head1 TODO
Think about L<Path::Resource> integration of some sort
=head1 AUTHOR
יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
=head1 CONTRIBUTORS
=for stopwords Karen Etheridge Florian Ragwitz Olivier Mengué Daniel Pittman MORIYA Masaki (gardejo) Shawn M Moore
=over 4
=item *
Karen Etheridge <ether@cpan.org>
=item *
Florian Ragwitz <rafl@debian.org>
=item *
Olivier Mengué <dolmen@cpan.org>
=item *
Daniel Pittman <daniel@rimspace.net>
=item *
MORIYA Masaki (gardejo) <moriya@ermitejo.com>
=item *
Shawn M Moore <sartak@gmail.com>
=back
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2008 by יובל קוג'מן (Yuval Kogman).
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
|