/usr/share/perl5/Types/Namespace.pm is in liburi-namespacemap-perl 0.30-1.
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 | package Types::Namespace;
use strict;
use warnings;
use Type::Library -base, -declare => qw( Uri Iri Namespace NamespaceMap );
use Types::Standard qw( HashRef InstanceOf );
use Types::URI qw();
our $VERSION = '0.30';
=head1 NAME
Types::Namespace - type constraints for dealing with namespaces
=head1 SYNOPSIS
package Namespace::Counter {
use Moo; # or Moose
use Types::Namespace qw( Namespace );
has ns => (
is => "ro",
isa => Namespace,
required => 1,
);
sub count_uses_in_document { ... }
}
=head1 DESCRIPTION
L<Types::URI> is a type constraint library suitable for use with
L<Moo>/L<Moose> attributes, L<Kavorka> sub signatures, and so forth.
=head1 TYPES
=over
=item C<< Namespace >>
A class type for L<URI::Namespace>.
Can coerce from L<URI>, L<IRI>, L<Path::Tiny>, and strings.
=item C<< NamespaceMap >>
A class type for L<URI::NamespaceMap>.
Can coerce from a hashref of C<< prefix => URI >> pairs.
=item C<< Uri >>, C<< Iri >>
These namespaces are re-exported from L<Types::URI>, but with an
additional coercion from the C<< Namespace >> type.
=back
=head1 FURTHER DETAILS
See L<URI::NamespaceMap> for further details about authors, license, etc.
=cut
__PACKAGE__->add_type(
name => Uri,
parent => Types::URI::Uri,
coercion => [
@{ Types::URI::Uri->coercion->type_coercion_map },
InstanceOf['URI::Namespace'] ,=> q{ $_->uri() },
],
);
__PACKAGE__->add_type(
name => Iri,
parent => Types::URI::Iri,
coercion => [
@{ Types::URI::Iri->coercion->type_coercion_map },
InstanceOf['URI::Namespace'] ,=> q{ $_->iri() },
],
);
__PACKAGE__->add_type(
name => Namespace,
parent => InstanceOf['URI::Namespace'],
coercion => [
Iri->coercibles ,=> q{ "URI::Namespace"->new($_) },
],
);
__PACKAGE__->add_type(
name => NamespaceMap,
parent => InstanceOf['URI::NamespaceMap'],
coercion => [
HashRef ,=> q{ "URI::NamespaceMap"->new(namespace_map => $_) }
],
);
require URI::Namespace;
require URI::NamespaceMap;
1;
|