| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Goo::Thing::pm::Perl6Profiler; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
############################################################################### |
|
4
|
|
|
|
|
|
|
# Nigel Hamilton |
|
5
|
|
|
|
|
|
|
# |
|
6
|
|
|
|
|
|
|
# Copyright Nigel Hamilton 2005 |
|
7
|
|
|
|
|
|
|
# All Rights Reserved |
|
8
|
|
|
|
|
|
|
# |
|
9
|
|
|
|
|
|
|
# Author: Nigel Hamilton |
|
10
|
|
|
|
|
|
|
# Filename: Perl6Profiler.pm |
|
11
|
|
|
|
|
|
|
# Description: Create a synopsis of a program / module / script |
|
12
|
|
|
|
|
|
|
# |
|
13
|
|
|
|
|
|
|
# Date Change |
|
14
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
|
15
|
|
|
|
|
|
|
# 12/11/2005 Alpha version using simple Regexes - just a proof of concept |
|
16
|
|
|
|
|
|
|
# |
|
17
|
|
|
|
|
|
|
############################################################################### |
|
18
|
|
|
|
|
|
|
|
|
19
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
27
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
5
|
use Goo::Object; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
16
|
|
|
22
|
1
|
|
|
1
|
|
5
|
use Goo::Profile; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
22
|
|
|
23
|
1
|
|
|
1
|
|
4
|
use Goo::Prompter; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
15
|
|
|
24
|
1
|
|
|
1
|
|
5
|
use Text::FormatTable; |
|
|
1
|
|
|
|
|
6
|
|
|
|
1
|
|
|
|
|
16
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
1
|
|
|
1
|
|
498
|
use Goo::Thing::pm::Perl6ModuleInspector; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
use base qw(Goo::Object); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
############################################################################### |
|
32
|
|
|
|
|
|
|
# |
|
33
|
|
|
|
|
|
|
# get_signatures_table - return a table of signatures |
|
34
|
|
|
|
|
|
|
# |
|
35
|
|
|
|
|
|
|
############################################################################### |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub get_signatures_table { |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my ($this, $profile, $inspector, $thing) = @_; |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my $table = Text::FormatTable->new('4l 9l 21l 40l 12l 12l'); |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
$table->head('', 'Type', 'Name', 'Parameters', 'Returns', 'Traits'); |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
$table->rule('-'); |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
foreach my $method ($inspector->get_signatures()) { |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my $index_key = $profile->get_next_index_key(); |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
$profile->add_option($index_key, $method->{name}, "Goo::Thing::pm::MethodProfileOption"); |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# print "addin conter === $counter \n"; |
|
54
|
|
|
|
|
|
|
$table->row("[$index_key]", $method->{type}, $method->{name}, |
|
55
|
|
|
|
|
|
|
$method->{parameters}, $method->{returns}, $method->{traits}); |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
return Goo::Prompter::highlight_options($table->render()); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
############################################################################### |
|
65
|
|
|
|
|
|
|
# |
|
66
|
|
|
|
|
|
|
# run - generate a profile of a program |
|
67
|
|
|
|
|
|
|
# |
|
68
|
|
|
|
|
|
|
############################################################################### |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub run { |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
my ($this, $thing) = @_; |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
my $profile = Goo::Profile->new($thing); |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
while (1) { |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
$profile->clear(); |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
$profile->show_header("Perl6 Profile", $thing->get_filename(), $thing->get_location()); |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
my $inspector = Goo::Thing::pm::Perl6ModuleInspector->new($thing->get_full_path()); |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
my @packages = $inspector->get_uses_list(); |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# add the module list |
|
87
|
|
|
|
|
|
|
$profile->add_options_table("Uses Packages", |
|
88
|
|
|
|
|
|
|
4, |
|
89
|
|
|
|
|
|
|
"Goo::Thing::pm::PackageProfileOption", |
|
90
|
|
|
|
|
|
|
$inspector->get_uses_list()); |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# render a table of method signatures and descriptions |
|
93
|
|
|
|
|
|
|
$profile->add_rendered_table($this->get_signatures_table($profile, $inspector, $thing)); |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# add a list of Things found in this Thing |
|
96
|
|
|
|
|
|
|
$profile->add_things_table(); |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
# show the profile and all the rendered tables |
|
99
|
|
|
|
|
|
|
$profile->display(); |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# prompt the user for the next command |
|
102
|
|
|
|
|
|
|
$profile->get_command(); |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
} |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
1; |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
__END__ |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 NAME |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Goo::Thing::pm::Perl6Profiler - Create a synopsis of a program / module / script |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
use Goo::Thing::pm::Perl6Profiler; |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 METHODS |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=over |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=item get_signatures_table |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
return a table of signatures |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=item run |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
generate a profile of a Perl6 program |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=back |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 AUTHOR |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Nigel Hamilton <nigel@trexy.com> |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
145
|
|
|
|
|
|
|
|