line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# vim: set ts=2 sts=2 sw=2 expandtab smarttab: |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# This file is part of Dist-Metadata |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# This software is copyright (c) 2011 by Randy Stauner. |
6
|
|
|
|
|
|
|
# |
7
|
|
|
|
|
|
|
# This is free software; you can redistribute it and/or modify it under |
8
|
|
|
|
|
|
|
# the same terms as the Perl 5 programming language system itself. |
9
|
|
|
|
|
|
|
# |
10
|
5
|
|
|
5
|
|
3482
|
use strict; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
224
|
|
11
|
5
|
|
|
5
|
|
32
|
use warnings; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
365
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Dist::Metadata::Archive; |
14
|
|
|
|
|
|
|
{ |
15
|
|
|
|
|
|
|
$Dist::Metadata::Archive::VERSION = '0.925'; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
BEGIN { |
18
|
5
|
|
|
5
|
|
112
|
$Dist::Metadata::Archive::AUTHORITY = 'cpan:RWSTAUNER'; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
# ABSTRACT: Base class for Dist::Metadata archive files |
21
|
|
|
|
|
|
|
|
22
|
5
|
|
|
5
|
|
29
|
use Carp (); # core |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
91
|
|
23
|
5
|
|
|
5
|
|
879
|
use parent 'Dist::Metadata::Dist'; |
|
5
|
|
|
|
|
314
|
|
|
5
|
|
|
|
|
66
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
push(@Dist::Metadata::CARP_NOT, __PACKAGE__); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub new { |
29
|
30
|
|
|
30
|
1
|
15001
|
my $class = shift; |
30
|
30
|
|
|
|
|
242
|
my $self = $class->SUPER::new(@_); |
31
|
|
|
|
|
|
|
|
32
|
27
|
100
|
|
|
|
109
|
if( $class eq __PACKAGE__ ){ |
33
|
21
|
100
|
|
|
|
143
|
my $subclass = 'Dist::Metadata::' . |
34
|
|
|
|
|
|
|
( $self->{file} =~ /\.zip$/ ? 'Zip' : 'Tar' ); |
35
|
|
|
|
|
|
|
|
36
|
21
|
50
|
|
|
|
1679
|
eval "require $subclass" |
37
|
|
|
|
|
|
|
or Carp::croak $@; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# rebless into format specific subclass |
40
|
21
|
|
|
|
|
124
|
bless $self, $subclass; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
27
|
|
|
|
|
126
|
return $self; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
33
|
|
|
33
|
1
|
104
|
sub required_attribute { 'file' } |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub archive { |
50
|
73
|
|
|
73
|
1
|
3852
|
my ($self) = @_; |
51
|
73
|
|
100
|
|
|
526
|
return $self->{archive} ||= do { |
52
|
24
|
|
|
|
|
151
|
my $file = $self->file; |
53
|
|
|
|
|
|
|
|
54
|
24
|
100
|
|
|
|
1321
|
Carp::croak "File '$file' does not exist" |
55
|
|
|
|
|
|
|
unless -e $file; |
56
|
|
|
|
|
|
|
|
57
|
21
|
|
|
|
|
98
|
$self->read_archive($file); # return |
58
|
|
|
|
|
|
|
}; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
21
|
|
|
21
|
1
|
117
|
sub default_file_spec { 'Unix' } |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub determine_name_and_version { |
66
|
22
|
|
|
22
|
1
|
59
|
my ($self) = @_; |
67
|
22
|
|
|
|
|
70
|
$self->set_name_and_version( $self->parse_name_and_version( $self->file ) ); |
68
|
22
|
|
|
|
|
191
|
return $self->SUPER::determine_name_and_version(@_); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub file { |
73
|
48
|
|
|
48
|
1
|
288
|
return $_[0]->{file}; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub read_archive { |
78
|
0
|
|
|
0
|
1
|
|
Carp::croak q[Method 'read_archive' not defined]; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
__END__ |