line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package mqs::header; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
10447
|
use 5.006; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
38
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Exporter; |
8
|
|
|
|
|
|
|
require DynaLoader; |
9
|
1
|
|
|
1
|
|
1431
|
use AutoLoader qw(AUTOLOAD); |
|
1
|
|
|
|
|
2164
|
|
|
1
|
|
|
|
|
8
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ISA = qw(Exporter DynaLoader); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
14
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
15
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# This allows declaration use mqs::header ':all'; |
18
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK |
19
|
|
|
|
|
|
|
# will save memory. |
20
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
) ] ); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our @EXPORT = qw( |
27
|
|
|
|
|
|
|
read_header |
28
|
|
|
|
|
|
|
add_header |
29
|
|
|
|
|
|
|
read_content |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
bootstrap mqs::header $VERSION; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# Preloaded methods go here. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# Autoload methods go after =cut, and are processed by the autosplit program. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub read_header |
42
|
|
|
|
|
|
|
{ |
43
|
7
|
|
|
7
|
0
|
40
|
my $content = $_[0]; |
44
|
7
|
|
|
|
|
30
|
my @content = split(/\n/,$content); |
45
|
7
|
|
|
|
|
9
|
my $i; |
46
|
7
|
|
|
|
|
8
|
my $cond = 1; |
47
|
7
|
|
|
|
|
7
|
my %header; |
48
|
|
|
|
|
|
|
my @tmp; |
49
|
7
|
|
|
|
|
12
|
$header{'mqs-header'} = "no"; |
50
|
7
|
|
100
|
|
|
38
|
for($i = 0; $cond == 1 && $i < $#content; $i++) |
51
|
|
|
|
|
|
|
{ |
52
|
17
|
100
|
|
|
|
30
|
if($content[$i] eq "") |
53
|
|
|
|
|
|
|
{ |
54
|
4
|
|
|
|
|
4
|
$cond = -1; |
55
|
|
|
|
|
|
|
} |
56
|
17
|
100
|
|
|
|
37
|
if($cond != -1) |
57
|
|
|
|
|
|
|
{ |
58
|
13
|
|
|
|
|
32
|
@tmp = split(/\:\ /,$content[$i]); |
59
|
13
|
|
|
|
|
64
|
$header{$tmp[0]} = $tmp[1]; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
} |
62
|
7
|
|
|
|
|
42
|
return %header; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub add_header |
66
|
|
|
|
|
|
|
{ |
67
|
2
|
|
|
2
|
0
|
30
|
my $content = $_[0]; |
68
|
2
|
|
|
|
|
3
|
my $key = $_[1]; |
69
|
2
|
|
|
|
|
3
|
my $value = $_[2]; |
70
|
2
|
|
|
|
|
7
|
my %header = read_header($content); |
71
|
2
|
100
|
|
|
|
6
|
if($header{'mqs-header'} eq "no") |
72
|
|
|
|
|
|
|
{ |
73
|
1
|
|
|
|
|
2
|
$content = "mqs-header: yes\n\n".$content; |
74
|
|
|
|
|
|
|
} |
75
|
2
|
|
|
|
|
5
|
$content = $key.": ".$value."\n".$content; |
76
|
2
|
|
|
|
|
5
|
return $content; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub read_content |
80
|
|
|
|
|
|
|
{ |
81
|
2
|
|
|
2
|
0
|
205
|
my $content = $_[0]; |
82
|
2
|
|
|
|
|
6
|
my %header = read_header($content); |
83
|
2
|
100
|
|
|
|
8
|
if($header{'mqs-header'} eq "no") |
84
|
|
|
|
|
|
|
{ |
85
|
1
|
|
|
|
|
4
|
return $content; |
86
|
|
|
|
|
|
|
} |
87
|
1
|
|
|
|
|
6
|
my @content = split(/\n/,$content); |
88
|
1
|
|
|
|
|
2
|
my $return = ""; |
89
|
1
|
|
|
|
|
1
|
my $cond = -1; |
90
|
1
|
|
|
|
|
2
|
my $i; |
91
|
1
|
|
|
|
|
6
|
for($i = 0; $i <= $#content; $i++) |
92
|
|
|
|
|
|
|
{ |
93
|
6
|
100
|
|
|
|
44
|
if($content[$i] eq "") |
94
|
|
|
|
|
|
|
{ |
95
|
1
|
|
|
|
|
2
|
$cond = 1; |
96
|
|
|
|
|
|
|
} |
97
|
6
|
100
|
100
|
|
|
23
|
if($cond == 1 && $content[$i] ne "") |
98
|
|
|
|
|
|
|
{ |
99
|
2
|
|
|
|
|
6
|
$return = $return.$content[$i]."\n"; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
} |
102
|
1
|
|
|
|
|
5
|
return $return; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
1; |
108
|
|
|
|
|
|
|
__END__ |