line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::Application::Plugin::Menu; |
2
|
1
|
|
|
1
|
|
24964
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
3
|
1
|
|
|
1
|
|
794
|
use LEOCHARRE::DEBUG; |
|
1
|
|
|
|
|
1688
|
|
|
1
|
|
|
|
|
7
|
|
4
|
1
|
|
|
1
|
|
80
|
use warnings; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
29
|
|
5
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
96
|
|
6
|
1
|
|
|
1
|
|
5
|
use Exporter; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
7
|
1
|
|
|
1
|
|
437
|
use HTML::Template::Menu; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
8
|
1
|
|
|
1
|
|
5
|
use vars qw(@ISA @EXPORT $VERSION); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
330
|
|
9
|
|
|
|
|
|
|
@ISA = qw/ Exporter /; |
10
|
|
|
|
|
|
|
@EXPORT = qw(menu ___menus_ ___menus_order menus menus_count menu_delete); |
11
|
|
|
|
|
|
|
$VERSION = sprintf "%d.%02d", q$Revision: 1.6 $ =~ /(\d+)/g; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub menu { |
14
|
2
|
|
|
2
|
1
|
510
|
my ($self,$label) = @_; |
15
|
2
|
|
100
|
|
|
12
|
$label ||= 'main'; |
16
|
|
|
|
|
|
|
|
17
|
2
|
50
|
|
|
|
8
|
unless ( exists $self->___menus_->{$label} ) { |
18
|
2
|
|
|
|
|
16
|
$self->___menus_->{$label} = |
19
|
|
|
|
|
|
|
# new CGI::Application::Plugin::MenuObject; |
20
|
|
|
|
|
|
|
new HTML::Template::Menu; |
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
|
|
6
|
$self->___menus_->{$label}->name_set($label); |
23
|
2
|
|
|
|
|
3
|
push @{$self->___menus_order},$label; |
|
2
|
|
|
|
|
7
|
|
24
|
|
|
|
|
|
|
} |
25
|
2
|
|
|
|
|
7
|
return $self->___menus_->{$label}; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
*menus = \&___menus_order; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub ___menus_ { |
31
|
9
|
|
100
|
9
|
|
31
|
$_[0]->{'__CGI::Application::Plugin::Menu::Objects'} ||={}; |
32
|
9
|
|
|
|
|
45
|
$_[0]->{'__CGI::Application::Plugin::Menu::Objects'}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub ___menus_order { |
36
|
6
|
|
100
|
6
|
|
21
|
$_[0]->{'__CGI::Application::Plugin::Menu::ObjectsOrder'} ||=[]; |
37
|
6
|
|
|
|
|
26
|
$_[0]->{'__CGI::Application::Plugin::Menu::ObjectsOrder'}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
3
|
|
|
3
|
0
|
1167
|
sub menus_count { scalar @{$_[0]->menus} } |
|
3
|
|
|
|
|
11
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub menu_delete { |
43
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
44
|
1
|
|
|
|
|
2
|
my $label = shift; |
45
|
1
|
|
|
|
|
4
|
delete $self->___menus_->{$label}; |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
3
|
my @order; |
48
|
1
|
|
|
|
|
2
|
for my $menu_label ( @{$self->___menus_order} ){ |
|
1
|
|
|
|
|
3
|
|
49
|
2
|
100
|
|
|
|
9
|
$menu_label eq $label and next; |
50
|
1
|
|
|
|
|
2
|
push @order, $menu_label; |
51
|
|
|
|
|
|
|
} |
52
|
1
|
|
|
|
|
3
|
$self->{'__CGI::Application::Plugin::Menu::ObjectsOrder'} = \@order; |
53
|
|
|
|
|
|
|
|
54
|
1
|
|
|
|
|
5
|
1; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |