line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyrights 2003-2015 by [Mark Overmeer]. |
2
|
|
|
|
|
|
|
# For other contributors see ChangeLog. |
3
|
|
|
|
|
|
|
# See the manual pages for details on the licensing terms. |
4
|
|
|
|
|
|
|
# Pod stripped from pm file by OODoc 2.01. |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package OODoc::Manifest; |
7
|
2
|
|
|
2
|
|
10
|
use vars '$VERSION'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
92
|
|
8
|
|
|
|
|
|
|
$VERSION = '2.01'; |
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
9
|
use base 'OODoc::Object'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
122
|
|
11
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
39
|
|
13
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
54
|
|
14
|
|
|
|
|
|
|
|
15
|
2
|
|
|
2
|
|
9
|
use IO::File; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
350
|
|
16
|
2
|
|
|
2
|
|
12
|
use File::Basename 'dirname'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
143
|
|
17
|
2
|
|
|
2
|
|
11
|
use Log::Report 'oodoc'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
13
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
2
|
|
|
2
|
|
530
|
use overload '@{}' => sub { [ shift->files ] }; |
|
2
|
|
|
0
|
|
4
|
|
|
2
|
|
|
|
|
18
|
|
|
0
|
|
|
|
|
0
|
|
21
|
2
|
|
|
2
|
|
176
|
use overload bool => sub {1}; |
|
2
|
|
|
0
|
|
4
|
|
|
2
|
|
|
|
|
11
|
|
|
0
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#------------------------------------------- |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub init($) |
27
|
0
|
|
|
0
|
0
|
|
{ my ($self, $args) = @_; |
28
|
0
|
0
|
|
|
|
|
$self->SUPER::init($args) or return; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
my $filename = $self->{OM_filename} = delete $args->{filename}; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
$self->{O_files} = {}; |
33
|
0
|
0
|
0
|
|
|
|
$self->read if defined $filename && -e $filename; |
34
|
0
|
|
|
|
|
|
$self->modified(0); |
35
|
0
|
|
|
|
|
|
$self; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
#------------------------------------------- |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
0
|
1
|
|
sub filename() {shift->{OM_filename}} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
#------------------------------------------- |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
0
|
1
|
|
sub files() { keys %{shift->{O_files}} } |
|
0
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
#------------------------------------------- |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub add($) |
52
|
0
|
|
|
0
|
1
|
|
{ my $self = shift; |
53
|
0
|
|
|
|
|
|
while(@_) |
54
|
0
|
|
|
|
|
|
{ my $add = $self->relative(shift); |
55
|
0
|
0
|
|
|
|
|
$self->modified(1) unless exists $self->{O_file}{$add}; |
56
|
0
|
|
|
|
|
|
$self->{O_files}{$add}++; |
57
|
|
|
|
|
|
|
} |
58
|
0
|
|
|
|
|
|
$self; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
#------------------------------------------- |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub read() |
65
|
0
|
|
|
0
|
1
|
|
{ my $self = shift; |
66
|
0
|
|
|
|
|
|
my $filename = $self->filename; |
67
|
0
|
0
|
|
|
|
|
my $file = IO::File->new($filename, "r") |
68
|
|
|
|
|
|
|
or fault __x"cannot read manifest file {file}", file => $filename; |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
my @dist = $file->getlines; |
71
|
0
|
|
|
|
|
|
$file->close; |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
s/\s+.*\n?$// for @dist; |
74
|
0
|
|
|
|
|
|
$self->{O_files}{$_}++ foreach @dist; |
75
|
0
|
|
|
|
|
|
$self; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
#------------------------------------------- |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub modified(;$) |
82
|
0
|
|
|
0
|
1
|
|
{ my $self = shift; |
83
|
0
|
0
|
|
|
|
|
@_ ? $self->{OM_modified} = @_ : $self->{OM_modified}; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
#------------------------------------------- |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub write() |
90
|
0
|
|
|
0
|
1
|
|
{ my $self = shift; |
91
|
0
|
0
|
|
|
|
|
return unless $self->modified; |
92
|
0
|
|
0
|
|
|
|
my $filename = $self->filename || return $self; |
93
|
|
|
|
|
|
|
|
94
|
0
|
0
|
|
|
|
|
my $file = IO::File->new($filename, "w") |
95
|
|
|
|
|
|
|
or fault __x"cannot write manifest {file}", file => $filename; |
96
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
$file->print($_, "\n") foreach sort $self->files; |
98
|
0
|
|
|
|
|
|
$file->close; |
99
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
$self->modified(0); |
101
|
0
|
|
|
|
|
|
$self; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
0
|
|
|
0
|
|
|
sub DESTROY() { shift->write } |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
#------------------------------------------- |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub relative($) |
110
|
0
|
|
|
0
|
1
|
|
{ my ($self, $filename) = @_; |
111
|
|
|
|
|
|
|
|
112
|
0
|
|
|
|
|
|
my $dir = dirname $self->filename; |
113
|
0
|
0
|
|
|
|
|
return $filename if $dir eq '.'; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
# normalize path for windows |
116
|
0
|
|
|
|
|
|
s!\\!/!g for $filename, $dir; |
117
|
|
|
|
|
|
|
|
118
|
0
|
0
|
|
|
|
|
if(substr($filename, 0, length($dir)+1) eq "$dir/") |
119
|
0
|
|
|
|
|
|
{ substr $filename, 0, length($dir)+1, ''; |
120
|
0
|
|
|
|
|
|
return $filename; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
|
warn "WARNING: MANIFEST file ".$self->filename |
124
|
|
|
|
|
|
|
. " lists filename outside (sub)directory: $filename\n"; |
125
|
|
|
|
|
|
|
|
126
|
0
|
|
|
|
|
|
$filename; |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
#------------------------------------------- |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
1; |