line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Path::Resolver::Resolver::AnyDist 3.100455; |
2
|
|
|
|
|
|
|
# ABSTRACT: find content in any installed CPAN distribution's "ShareDir" |
3
|
1
|
|
|
1
|
|
833
|
use Moose; |
|
1
|
|
|
|
|
391625
|
|
|
1
|
|
|
|
|
7
|
|
4
|
|
|
|
|
|
|
with 'Path::Resolver::Role::FileResolver'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6941
|
use namespace::autoclean; |
|
1
|
|
|
|
|
6692
|
|
|
1
|
|
|
|
|
3
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
492
|
use File::ShareDir (); |
|
1
|
|
|
|
|
18620
|
|
|
1
|
|
|
|
|
25
|
|
9
|
1
|
|
|
1
|
|
7
|
use File::Spec; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
10
|
1
|
|
|
1
|
|
488
|
use Path::Class::File; |
|
1
|
|
|
|
|
32098
|
|
|
1
|
|
|
|
|
164
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
#pod =head1 SYNOPSIS |
13
|
|
|
|
|
|
|
#pod |
14
|
|
|
|
|
|
|
#pod my $resolver = Path::Resolver::Resolver::AnyDist->new; |
15
|
|
|
|
|
|
|
#pod |
16
|
|
|
|
|
|
|
#pod my $simple_entity = $resolver->entity_at('/MyApp-Config/foo/bar.txt'); |
17
|
|
|
|
|
|
|
#pod |
18
|
|
|
|
|
|
|
#pod This resolver looks for files on disk in the shared resource directory of the |
19
|
|
|
|
|
|
|
#pod distribution named by the first part of the path. For more information on |
20
|
|
|
|
|
|
|
#pod sharedirs, see L<File::ShareDir|File::ShareDir>. |
21
|
|
|
|
|
|
|
#pod |
22
|
|
|
|
|
|
|
#pod This resolver does the |
23
|
|
|
|
|
|
|
#pod L<Path::Resolver::Role::FileResolver|Path::Resolver::Role::FileResolver> role, |
24
|
|
|
|
|
|
|
#pod meaning its native type is Path::Resolver::Types::AbsFilePath and it has a |
25
|
|
|
|
|
|
|
#pod default converter to convert to Path::Resolver::SimpleEntity. |
26
|
|
|
|
|
|
|
#pod |
27
|
|
|
|
|
|
|
#pod =cut |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub entity_at { |
30
|
|
|
|
|
|
|
my ($self, $path) = @_; |
31
|
|
|
|
|
|
|
my $dist_name = shift @$path; |
32
|
|
|
|
|
|
|
my $dir = File::ShareDir::dist_dir($dist_name); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Carp::confess("invalid path: empty after dist specifier") unless @$path; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $abs_path = File::Spec->catfile( |
37
|
|
|
|
|
|
|
$dir, |
38
|
|
|
|
|
|
|
File::Spec->catfile(@$path), |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
return Path::Class::File->new($abs_path); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=pod |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=encoding UTF-8 |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 NAME |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Path::Resolver::Resolver::AnyDist - find content in any installed CPAN distribution's "ShareDir" |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 VERSION |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
version 3.100455 |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 SYNOPSIS |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
my $resolver = Path::Resolver::Resolver::AnyDist->new; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
my $simple_entity = $resolver->entity_at('/MyApp-Config/foo/bar.txt'); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This resolver looks for files on disk in the shared resource directory of the |
67
|
|
|
|
|
|
|
distribution named by the first part of the path. For more information on |
68
|
|
|
|
|
|
|
sharedirs, see L<File::ShareDir|File::ShareDir>. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
This resolver does the |
71
|
|
|
|
|
|
|
L<Path::Resolver::Role::FileResolver|Path::Resolver::Role::FileResolver> role, |
72
|
|
|
|
|
|
|
meaning its native type is Path::Resolver::Types::AbsFilePath and it has a |
73
|
|
|
|
|
|
|
default converter to convert to Path::Resolver::SimpleEntity. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 PERL VERSION |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
This library should run on perls released even a long time ago. It should work |
78
|
|
|
|
|
|
|
on any version of perl released in the last five years. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Although it may work on older versions of perl, no guarantee is made that the |
81
|
|
|
|
|
|
|
minimum required version will not be increased. The version may be increased |
82
|
|
|
|
|
|
|
for any reason, and there is no promise that patches will be accepted to lower |
83
|
|
|
|
|
|
|
the minimum required perl. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 AUTHOR |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Ricardo Signes <cpan@semiotic.systems> |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This software is copyright (c) 2022 by Ricardo Signes. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
94
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |