This file is indexed.

/usr/share/perl5/MooseX/Types/Util.pm is in libmoosex-types-perl 0.45-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
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
174
175
176
177
178
use warnings;
use strict;
package MooseX::Types::Util;
# ABSTRACT: Common utility functions for the distribution
$MooseX::Types::Util::VERSION = '0.45';
use Scalar::Util 'blessed';
use base 'Exporter';
use namespace::autoclean;

#pod =head1 DESCRIPTION
#pod
#pod This package the exportable functions that many parts in
#pod L<MooseX::Types> might need.
#pod
#pod =cut

our @EXPORT_OK = qw( filter_tags has_available_type_export );

#pod =head1 FUNCTIONS
#pod
#pod =head2 filter_tags
#pod
#pod Takes a list and returns two references. The first is a hash reference
#pod containing the tags as keys and the number of their appearance as values.
#pod The second is an array reference containing all other elements.
#pod
#pod =cut

sub filter_tags {
    my (@list) = @_;
    my (%tags, @other);
    for (@list) {
        if (/^:(.*)$/) {
            $tags{ $1 }++;
            next;
        }
        push @other, $_;
    }
    return \%tags, \@other;
}

#pod =head2 has_available_type_export
#pod
#pod   TypeConstraint | Undef = has_available_type_export($package, $name);
#pod
#pod This function allows you to introspect if a given type export is available
#pod I<at this point in time>. This means that the C<$package> must have imported
#pod a type constraint with the name C<$name>, and it must be still in its symbol
#pod table.
#pod
#pod Two arguments are expected:
#pod
#pod =over 4
#pod
#pod =item $package
#pod
#pod The name of the package to introspect.
#pod
#pod =item $name
#pod
#pod The name of the type export to introspect.
#pod
#pod =back
#pod
#pod B<Note> that the C<$name> is the I<exported> name of the type, not the declared
#pod one. This means that if you use L<Sub::Exporter>s functionality to rename an import
#pod like this:
#pod
#pod   use MyTypes Str => { -as => 'MyStr' };
#pod
#pod you would have to introspect this type like this:
#pod
#pod   has_available_type_export $package, 'MyStr';
#pod
#pod The return value will be either the type constraint that belongs to the export
#pod or an undefined value.
#pod
#pod =cut

sub has_available_type_export {
    my ($package, $name) = @_;

    my $sub = $package->can($name)
        or return undef;

    return undef
        unless blessed $sub && $sub->isa('MooseX::Types::EXPORTED_TYPE_CONSTRAINT');

    return $sub->();
}

#pod =head1 SEE ALSO
#pod
#pod L<MooseX::Types::Moose>, L<Exporter>
#pod
#pod =cut

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

MooseX::Types::Util - Common utility functions for the distribution

=head1 VERSION

version 0.45

=head1 DESCRIPTION

This package the exportable functions that many parts in
L<MooseX::Types> might need.

=head1 FUNCTIONS

=head2 filter_tags

Takes a list and returns two references. The first is a hash reference
containing the tags as keys and the number of their appearance as values.
The second is an array reference containing all other elements.

=head2 has_available_type_export

  TypeConstraint | Undef = has_available_type_export($package, $name);

This function allows you to introspect if a given type export is available
I<at this point in time>. This means that the C<$package> must have imported
a type constraint with the name C<$name>, and it must be still in its symbol
table.

Two arguments are expected:

=over 4

=item $package

The name of the package to introspect.

=item $name

The name of the type export to introspect.

=back

B<Note> that the C<$name> is the I<exported> name of the type, not the declared
one. This means that if you use L<Sub::Exporter>s functionality to rename an import
like this:

  use MyTypes Str => { -as => 'MyStr' };

you would have to introspect this type like this:

  has_available_type_export $package, 'MyStr';

The return value will be either the type constraint that belongs to the export
or an undefined value.

=head1 SEE ALSO

L<MooseX::Types::Moose>, L<Exporter>

=head1 AUTHOR

Robert "phaylon" Sedlacek <rs@474.at>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2007 by Robert "phaylon" Sedlacek.

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