/usr/share/perl5/Carton/Index.pm is in carton 1.0.12-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 | package Carton::Index;
use Moo;
use warnings NONFATAL => 'all';
has _packages => (is => 'rw', default => sub { +{} });
sub add_package {
my($self, $package) = @_;
$self->_packages->{$package->name} = $package; # XXX ||=
}
sub count {
my $self = shift;
scalar keys %{$self->_packages};
}
sub packages {
my $self = shift;
sort { $a->name cmp $b->name } values %{$self->_packages};
}
sub write {
my($self, $fh) = @_;
print $fh <<EOF;
File: 02packages.details.txt
URL: http://www.perl.com/CPAN/modules/02packages.details.txt
Description: Package names found in cpanfile.snapshot
Columns: package name, version, path
Intended-For: Automated fetch routines, namespace documentation.
Written-By: Carton $Carton::VERSION
Line-Count: @{[ $self->count ]}
Last-Updated: @{[ scalar localtime ]}
EOF
for my $p ($self->packages) {
print $fh sprintf "%s %s %s\n", pad($p->name, 32), pad($p->version || 'undef', 10, 1), $p->pathname;
}
}
sub pad {
my($str, $len, $left) = @_;
my $howmany = $len - length($str);
return $str if $howmany <= 0;
my $pad = " " x $howmany;
return $left ? "$pad$str" : "$str$pad";
}
1;
|