line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package VIM::Packager::Record; |
2
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
37
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
30
|
|
4
|
1
|
|
|
1
|
|
4
|
use File::Spec; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
48
|
|
5
|
1
|
|
|
1
|
|
5
|
use File::Path; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
49
|
|
6
|
1
|
|
|
1
|
|
15
|
use YAML; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
308
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head2 get_record_dir |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=cut |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub get_record_dir { |
13
|
0
|
0
|
|
0
|
1
|
|
$ENV{VIMPKG_RECORDDIR} || File::Spec->join($ENV{HOME},'.vim','record') |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
0
|
0
|
|
sub get_record_file { File::Spec->join( get_record_dir() , $_[0] ) } |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head2 find [package name] |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub find { |
24
|
0
|
|
|
0
|
1
|
|
my $path = get_record_file $_[0]; |
25
|
0
|
0
|
|
|
|
|
return $path if -e $path; |
26
|
0
|
|
|
|
|
|
return undef; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub read { |
31
|
0
|
|
|
0
|
0
|
|
my $path = shift; |
32
|
0
|
|
|
|
|
|
my $r = YAML::LoadFile( $path ); |
33
|
0
|
0
|
|
|
|
|
unless( $r ) { |
34
|
0
|
|
|
|
|
|
die "Error: Can not read record from file : $path\n"; |
35
|
|
|
|
|
|
|
} |
36
|
0
|
|
|
|
|
|
return $r; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub save { |
40
|
0
|
|
|
0
|
0
|
|
my ($pkgname , $meta , $files ) = @_; |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
my $record_dir = get_record_dir(); |
43
|
0
|
|
|
|
|
|
my $record_path = get_record_file( $pkgname ); |
44
|
|
|
|
|
|
|
|
45
|
0
|
0
|
|
|
|
|
mkdir $record_dir unless -e $record_dir; |
46
|
0
|
|
|
|
|
|
YAML::DumpFile( $record_path , { |
47
|
|
|
|
|
|
|
meta => $meta, |
48
|
|
|
|
|
|
|
files => $files |
49
|
|
|
|
|
|
|
} ); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |