line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package NG; |
2
|
1
|
|
|
1
|
|
25216
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
55
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.001'; |
6
|
1
|
|
|
1
|
|
7
|
use File::Basename qw(dirname); |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
106
|
|
7
|
1
|
|
|
1
|
|
915
|
use lib dirname(__FILE__) . '/NG'; |
|
1
|
|
|
|
|
801
|
|
|
1
|
|
|
|
|
75
|
|
8
|
1
|
|
|
1
|
|
680
|
use Object; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
35
|
|
9
|
1
|
|
|
1
|
|
479
|
use Array; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
25
|
|
10
|
1
|
|
|
1
|
|
466
|
use Hashtable; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
26
|
|
11
|
1
|
|
|
1
|
|
495
|
use SHashtable; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
30
|
|
12
|
1
|
|
|
1
|
|
1262
|
use DB; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
13
|
1
|
|
|
1
|
|
508
|
use Excel; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
30
|
|
14
|
1
|
|
|
1
|
|
6
|
use Excel::Cell; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
15
|
1
|
|
|
1
|
|
5
|
use Excel::Sheet; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
19
|
|
16
|
1
|
|
|
1
|
|
1810
|
use Spreadsheet::ParseExcel; |
|
1
|
|
|
|
|
105081
|
|
|
1
|
|
|
|
|
36
|
|
17
|
1
|
|
|
1
|
|
933
|
use HTTP::Client; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
36
|
|
18
|
1
|
|
|
1
|
|
569
|
use EMail; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
use File; |
20
|
|
|
|
|
|
|
use Log; |
21
|
|
|
|
|
|
|
use System; |
22
|
|
|
|
|
|
|
use Time; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
use base 'Exporter'; |
25
|
|
|
|
|
|
|
our @EXPORT = qw( |
26
|
|
|
|
|
|
|
local_run |
27
|
|
|
|
|
|
|
remote_run |
28
|
|
|
|
|
|
|
taskset |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
web_get |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
mail_send |
33
|
|
|
|
|
|
|
mail_get |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
from_json |
36
|
|
|
|
|
|
|
from_yaml |
37
|
|
|
|
|
|
|
mkdir_p |
38
|
|
|
|
|
|
|
rm_r |
39
|
|
|
|
|
|
|
cp_r |
40
|
|
|
|
|
|
|
read_file |
41
|
|
|
|
|
|
|
read_dir |
42
|
|
|
|
|
|
|
file_stat |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
process_log |
45
|
|
|
|
|
|
|
geo_ip |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
db |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
parse_excel |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub local_run { System::local_run(@_) } |
53
|
|
|
|
|
|
|
sub remote_run { System::remote_run(@_) } |
54
|
|
|
|
|
|
|
sub taskset { System::taskset(@_) } |
55
|
|
|
|
|
|
|
sub web_get { HTTP::Client::web_get(@_) } |
56
|
|
|
|
|
|
|
sub mail_send { EMail::send(@_) } |
57
|
|
|
|
|
|
|
sub mail_get { EMail::get(@_) } |
58
|
|
|
|
|
|
|
sub from_json { File::from_json(@_) } |
59
|
|
|
|
|
|
|
sub from_yaml { File::from_yaml(@_) } |
60
|
|
|
|
|
|
|
sub mkdir_p { File::mkdir_p(@_) } |
61
|
|
|
|
|
|
|
sub rm_r { File::rm_r(@_) } |
62
|
|
|
|
|
|
|
sub cp_r { File::cp_r(@_) } |
63
|
|
|
|
|
|
|
sub read_file { File::read_file(@_) } |
64
|
|
|
|
|
|
|
sub read_dir { File::read_dir(@_) } |
65
|
|
|
|
|
|
|
sub file_stat { File::fstat(@_) } |
66
|
|
|
|
|
|
|
sub process_log { Log::process_log(@_) } |
67
|
|
|
|
|
|
|
sub geo_ip { Log::geo_ip(@_) } |
68
|
|
|
|
|
|
|
sub db { DB->new(@_) } |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub parse_excel { |
71
|
|
|
|
|
|
|
my ( $filepath, $cb ) = @_; |
72
|
|
|
|
|
|
|
my $parser = Spreadsheet::ParseExcel->new(); |
73
|
|
|
|
|
|
|
my $workbook = $parser->parse($filepath); |
74
|
|
|
|
|
|
|
if ( !defined $workbook ) { |
75
|
|
|
|
|
|
|
die $parser->error() . "\n"; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
my $ng_sheet_arr = Array->new; |
78
|
|
|
|
|
|
|
for my $sheet ( $workbook->worksheets() ) { |
79
|
|
|
|
|
|
|
my ( $row_min, $row_max ) = $sheet->row_range(); |
80
|
|
|
|
|
|
|
my ( $col_min, $col_max ) = $sheet->col_range(); |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
my $ng_sheet = Excel::Sheet->new( |
83
|
|
|
|
|
|
|
name => $sheet->get_name(), |
84
|
|
|
|
|
|
|
row_count => $row_max + 1, |
85
|
|
|
|
|
|
|
col_count => $col_max + 1, |
86
|
|
|
|
|
|
|
); |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
for my $row ( $row_min .. $row_max ) { |
89
|
|
|
|
|
|
|
for my $col ( $col_min .. $col_max ) { |
90
|
|
|
|
|
|
|
my $cell = $sheet->get_cell( $row, $col ); |
91
|
|
|
|
|
|
|
next unless $cell; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
my $ng_cell = Excel::Cell->new( value => $cell->value(), ); |
94
|
|
|
|
|
|
|
$ng_sheet->{cells}->[$row][$col] = $ng_cell; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
$ng_sheet_arr->push($ng_sheet); |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
my $ng_excel = Excel->new($ng_sheet_arr); |
101
|
|
|
|
|
|
|
if ( defined $cb ) { |
102
|
|
|
|
|
|
|
$cb->($ng_excel); |
103
|
|
|
|
|
|
|
$ng_excel->save($filepath); |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
else { |
106
|
|
|
|
|
|
|
return $ng_excel; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub import { |
112
|
|
|
|
|
|
|
my $class = shift; |
113
|
|
|
|
|
|
|
strict->import; |
114
|
|
|
|
|
|
|
warnings->import; |
115
|
|
|
|
|
|
|
utf8->import; |
116
|
|
|
|
|
|
|
feature->import(':5.10'); |
117
|
|
|
|
|
|
|
$class->export_to_level(1, $class, @EXPORT); |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
1; |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
__END__ |