File Coverage

blib/lib/Path/Resolver/Types.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1             package Path::Resolver::Types 3.100455;
2             # ABSTRACT: types for use with Path::Resolver
3 1     1   6 use MooseX::Types -declare => [ qw(AbsFilePath) ];
  1         2  
  1         7  
4 1     1   3749 use MooseX::Types::Moose qw(Str);
  1         2  
  1         6  
5              
6 1     1   4016 use namespace::autoclean;
  1         2  
  1         6  
7              
8 1     1   56 use Path::Class::File;
  1         2  
  1         140  
9              
10             #pod =head1 OVERVIEW
11             #pod
12             #pod This library will contain any new types needed for use with Path::Resolver.
13             #pod
14             #pod =head1 TYPES
15             #pod
16             #pod =head2 AbsFilePath
17             #pod
18             #pod This type validates Path::Class::File objects that are absolute paths and
19             #pod readable. They can be coerced from strings by creating a new Path::Class::File
20             #pod from the string.
21             #pod
22             #pod =cut
23              
24             subtype AbsFilePath,
25             as class_type('Path::Class::File'),
26             where { $_->is_absolute and -r "$_" };
27              
28             coerce AbsFilePath, from Str, via { Path::Class::File->new($_) };
29              
30             1;
31              
32             __END__
33              
34             =pod
35              
36             =encoding UTF-8
37              
38             =head1 NAME
39              
40             Path::Resolver::Types - types for use with Path::Resolver
41              
42             =head1 VERSION
43              
44             version 3.100455
45              
46             =head1 OVERVIEW
47              
48             This library will contain any new types needed for use with Path::Resolver.
49              
50             =head1 PERL VERSION
51              
52             This library should run on perls released even a long time ago. It should work
53             on any version of perl released in the last five years.
54              
55             Although it may work on older versions of perl, no guarantee is made that the
56             minimum required version will not be increased. The version may be increased
57             for any reason, and there is no promise that patches will be accepted to lower
58             the minimum required perl.
59              
60             =head1 TYPES
61              
62             =head2 AbsFilePath
63              
64             This type validates Path::Class::File objects that are absolute paths and
65             readable. They can be coerced from strings by creating a new Path::Class::File
66             from the string.
67              
68             =head1 AUTHOR
69              
70             Ricardo Signes <cpan@semiotic.systems>
71              
72             =head1 COPYRIGHT AND LICENSE
73              
74             This software is copyright (c) 2022 by Ricardo Signes.
75              
76             This is free software; you can redistribute it and/or modify it under
77             the same terms as the Perl 5 programming language system itself.
78              
79             =cut