/usr/share/perl5/MetaCPAN/Client/File.pm is in libmetacpan-client-perl 2.023000-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 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | use strict;
use warnings;
package MetaCPAN::Client::File;
# ABSTRACT: A File data object
$MetaCPAN::Client::File::VERSION = '2.023000';
use Moo;
use Carp;
with 'MetaCPAN::Client::Role::Entity';
my %known_fields = (
scalar => [qw<
abstract
author
authorized
binary
date
deprecated
description
directory
distribution
documentation
download_url
id
indexed
level
maturity
mime
name
path
release
sloc
slop
status
version
version_numified
>],
arrayref => [qw< module pod_lines >],
hashref => [qw< stat >],
);
my @known_fields =
map { @{ $known_fields{$_} } } qw< scalar arrayref hashref >;
foreach my $field (@known_fields) {
has $field => (
is => 'ro',
lazy => 1,
default => sub {
my $self = shift;
return $self->data->{$field};
},
);
}
sub _known_fields { return \%known_fields }
sub pod {
my $self = shift;
my $ctype = shift || "plain";
$ctype = lc($ctype);
grep { $ctype eq $_ } qw<html plain x-pod x-markdown>
or croak "wrong content-type for POD requested";
my $name = $self->module->[0]{name};
return unless $name;
require MetaCPAN::Client::Request;
return
MetaCPAN::Client::Request->new->fetch(
"pod/${name}?content-type=text/${ctype}"
);
}
sub source {
my $self = shift;
my $author = $self->author;
my $release = $self->release;
my $path = $self->path;
require MetaCPAN::Client::Request;
return
MetaCPAN::Client::Request->new->fetch(
"source/${author}/${release}/${path}"
);
}
sub metacpan_url {
my $self = shift;
sprintf("https://metacpan.org/source/%s/%s/%s",
$self->author, $self->release, $self->path );
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
MetaCPAN::Client::File - A File data object
=head1 VERSION
version 2.023000
=head1 DESCRIPTION
A MetaCPAN file entity object.
=head1 ATTRIBUTES
=head2 status
Returns a release status like C<backpan>, C<cpan>, or C<latest>.
=head2 date
An ISO8601 datetime string like C<2016-11-19T12:41:46> indicating when the
file was uploaded.
=head2 author
The author's PAUSE id.
=head2 maturity
This will be either C<release> or C<developer>.
=head2 directory
A boolean indicating whether or not the path represents a directory.
=head2 indexed
A boolean indicating whether or not the content is indexed.
=head2 documentation
The name of the module for which this file contains docs. This may be C<undef>
=head2 id
The file's internal MetaCPAN id.
=head2 authorized
A boolean indicating whether or not this file was part of an authorized
upload.
=head2 version
The distribution version that contains this file.
=head2 version_numified
The numified version of the distribution that contains the file.
=head2 release
The release that contains this file, which will be something like
C<Moose-2.2004>.
=head2 binary
A boolean indicating whether or not this file contains binary content.
=head2 name
The File's name, without any directory path included.
=head2 path
The file's path I<within the distribution archive>, relative to the root of
the archive.
=head2 abstract
If the file contains POD with a C<NAME> section, then this attribute will
include the abstract portion of the name.
=head2 deprecated
The deprecated field value for this file.
=head2 description
If the file contains POD with a C<DESCRIPTION> section, then this attribute
will contain that description.
=head2 distribution
The name of the distribution that contains the file.
=head2 level
A 0-indexed indication of how many directories deep this file is, relative to
the archive root.
=head2 sloc
If the file contains code, this will contain the number of lines of code in
the file.
=head2 slop
If the file contains POD, this will contain the number of lines of POD in
the file.
=head2 mime
The file's mime type.
=head2 module
If the file contains module indexed by PAUSE, then this attribute contains an
arrayref of hashrefs, one for each module. The hashrefs have the following
keys:
=over 4
=item * name
The module name.
=item * indexed
Whether or not the file is indexed by MetaCPAN.
=item * authorized
Whether or not the module is part of an authorized upload.
=item * version
The version of the module that this file contains.
=item * version_numified
The numified version of the module that this file contains.
=item * associated_pod
A path you can use with the C<< MetaCPAN::Client->file >> method to get the
file that contains POD for this module. In most cases, that will be the same
file as that one that contains this C<module> data.
=back
=head2 pod_lines
An arrayref.
=head2 stat
A hashref containing C<stat()> all information about the file. The keys are:
=over 4
=item * mtime
The Unix epoch of the file's last modified time.
=item * mode
The file's mode (as an integer, not an octal representation).
=item * size
The file's size in bytes.
=back
=head2 download_url
A URL for the distribution archive that contains this file.
=head1 METHODS
=head2 pod
my $pod = $module->pod(); # default = plain
my $pod = $module->pod($type);
Returns the POD content for the module/file.
Takes a type as argument.
Supported types: B<plain>, B<html>, B<x-pod>, B<x-markdown>.
=head2 source
my $source = $module->source();
Returns the source code for the file.
=head2 metacpan_url
Returns a link to the file source page on MetaCPAN.
=head1 AUTHORS
=over 4
=item *
Sawyer X <xsawyerx@cpan.org>
=item *
Mickey Nasriachi <mickey@cpan.org>
=back
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2016 by Sawyer X.
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
|