-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdraw.graph.pl
More file actions
executable file
·57 lines (48 loc) · 1.12 KB
/
draw.graph.pl
File metadata and controls
executable file
·57 lines (48 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/perl -I ./thirds -w
# author: lilong'en(lilongen@163.com)
# date: 04/05/2010
#
use strict;
use English;
use Data::Dumper;
use ccvGraph;
use CGI;
use Assistor;
use Cwd;
use JSON;
sub main();
sub parseParams();
my $pms = {};
parseParams();
exit main();
sub main() {
my $ccvGraph = new ccvGraph($pms->{G_PATH});
if (!$pms->{fromCgi}) {
$ccvGraph->drawUserLOC();
$ccvGraph->drawUserAverLOC();
$ccvGraph->drawUserDateLOC();
$ccvGraph->drawUserDateAccuLOC();
$ccvGraph->drawModuleDateLOC();
$ccvGraph->drawModuleDateAccuLOC();
} else {
my $ret = {};
$ccvGraph->constructUserDateLOCs4Graph($pms->{users});
$ret->{userDateLOCImage} = $ccvGraph->drawUserDateLOC();
$ret->{userDateAccuLOCImage} = $ccvGraph->drawUserDateAccuLOC();
my $json = new JSON;
print $json->pretty->encode($ret);
}
return 0;
}
sub parseParams() {
if (defined($ARGV[0])) {
$pms->{fromCgi} = 0;
$pms->{G_PATH} = $ARGV[0];
} else {
$pms->{fromCgi} = 1;
my $q = new CGI;
print "Content-type: application/json\n\n";
$pms->{G_PATH} = $q->param("G_PATH");
$pms->{users} = $q->param("users");
}
}