line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Socialtext::WikiObject::TableConfig; |
2
|
1
|
|
|
1
|
|
39504
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
5
|
use base 'Socialtext::WikiObject'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
423
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Socialtext::WikiObject::TableConfig - Extract a table into a hash |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=cut |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 METHODS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head2 table |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Return a hashref to the parsed table. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub table { |
23
|
1
|
|
|
1
|
1
|
4
|
my $self = shift; |
24
|
|
|
|
|
|
|
|
25
|
1
|
50
|
|
|
|
4
|
my $table = $self->{table} or die "Can't find a table on the page!\n"; |
26
|
1
|
50
|
|
|
|
6
|
if ($table->[0][0] =~ m/^\*.+\*$/) { |
27
|
1
|
|
|
|
|
2
|
shift @$table; # remove the table header |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
1
|
my %results; |
31
|
1
|
|
|
|
|
2
|
for my $r (@$table) { |
32
|
2
|
|
|
|
|
6
|
$results{$r->[0]} = $r->[1]; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
1
|
|
|
|
|
3
|
return \%results; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 AUTHOR |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Luke Closs, C<< >> |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 BUGS |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
45
|
|
|
|
|
|
|
L. |
46
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
47
|
|
|
|
|
|
|
your bug as I make changes. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Copyright 2007 Luke Closs, all rights reserved. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
54
|
|
|
|
|
|
|
under the same terms as Perl itself. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |