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