line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JavascriptProfiler; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
############################################################################### |
4
|
|
|
|
|
|
|
# Nigel Hamilton |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Copyright Nigel Hamilton 2004 |
7
|
|
|
|
|
|
|
# All Rights Reserved |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# Author: Nigel Hamilton |
10
|
|
|
|
|
|
|
# Filename: JavascriptProfiler.pm |
11
|
|
|
|
|
|
|
# Description: Create a synopsis of a program / module / script |
12
|
|
|
|
|
|
|
# |
13
|
|
|
|
|
|
|
# Date Change |
14
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
15
|
|
|
|
|
|
|
# 01/11/2004 Auto generated file |
16
|
|
|
|
|
|
|
# 01/11/2004 Needed to work with the Goo |
17
|
|
|
|
|
|
|
# 16/02/2005 Need to find out a range of lines for things |
18
|
|
|
|
|
|
|
# 12/08/2005 Added method: getOption |
19
|
|
|
|
|
|
|
# 12/08/2005 Added method: testingNow |
20
|
|
|
|
|
|
|
# 24/08/2005 Added method: showHeader |
21
|
|
|
|
|
|
|
# |
22
|
|
|
|
|
|
|
############################################################################### |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
3471
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
1
|
|
364
|
use List; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
use Object; |
28
|
|
|
|
|
|
|
use Profile; |
29
|
|
|
|
|
|
|
use Prompter; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
use base qw(Object); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
############################################################################### |
35
|
|
|
|
|
|
|
# |
36
|
|
|
|
|
|
|
# run - return a table of methods |
37
|
|
|
|
|
|
|
# |
38
|
|
|
|
|
|
|
############################################################################### |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub run { |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my ($this, $thing) = @_; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my $profile = Profile->new($thing); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
while (1) { |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
$profile->clear(); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
$profile->set_location($thing->get_location()); |
51
|
|
|
|
|
|
|
$profile->set_filename($thing->get_filename()); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
my @functions = $thing->get_file() =~ m/^function\s+(\w+)\(/msg; |
54
|
|
|
|
|
|
|
my @variables = $thing->get_file() =~ m/var\s+(\w+)/msg; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
#Prompter::notify("found --- " . @functions); |
57
|
|
|
|
|
|
|
#Prompter::notify("found --- " . @variables); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# add the function list |
60
|
|
|
|
|
|
|
$profile->add_options_table("Functions", 4, "JSFunctionProfileOption", |
61
|
|
|
|
|
|
|
List::get_unique(@functions)); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# add the variable list |
64
|
|
|
|
|
|
|
$profile->add_options_table("Variables", 4, "JumpProfileOption", |
65
|
|
|
|
|
|
|
grep { length($_) > 1 } List::get_unique(@variables)); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# add a list of Things found in this Thing |
68
|
|
|
|
|
|
|
$profile->add_things_table(); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# show the profile and all the rendered tables |
71
|
|
|
|
|
|
|
$profile->display(); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# prompt the user for the next command |
74
|
|
|
|
|
|
|
$profile->get_command(); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
__END__ |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 NAME |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
JavascriptProfiler - Create a synopsis of a program / module / script |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 SYNOPSIS |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
use JavascriptProfiler; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 DESCRIPTION |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 METHODS |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=over |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=item run |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
return a table of methods |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=back |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 AUTHOR |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Nigel Hamilton <nigel@turbo10.com> |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 SEE ALSO |
114
|
|
|
|
|
|
|
|