Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision f1b07855

Von Sven Schöling vor etwa 12 Jahren hinzugefügt

  • ID f1b0785501f46f6204ae46cdc9b9ef257b5a216b
  • Vorgänger c7ad671d
  • Nachfolger 88bd305a

kleine Weiterentwicklung

Unterschiede anzeigen:

SL/MenuItem.pm
1 1
package SL::MenuItem;
2 2

  
3
use strict;
4

  
3 5
sub new {
4
  my ($class, %values) = @_;
6
  my ($class, %params) = @_;
5 7

  
6 8
  my $obj = bless {}, $class;
7
  $obj->{ACCESS} = delete $values{ACCESS};
8
  $obj->{module} = delete $values{module} || die 'menuitem - need module';
9
  $obj->{action} = delete $values{action} || die 'menuitem - need action';
10

  
11
  $obj->{params} = \%values;
12
}
9
  $obj->{fullname} = $params{name};
10
  my $values       = $params{item};
13 11

  
14
sub access {
12
  $obj->{ACCESS} = delete $values->{ACCESS};
13
  $obj->{module} = delete $values->{module} || die 'menuitem - need module';
14
  $obj->{action} = delete $values->{action} || die 'menuitem - need action';
15 15

  
16
  $obj->{params} = $values;
16 17
}
17 18

  
18 19
sub ACCESS { $_[0]{ACCESS} }
......
20 21
sub module { $_[0]{module} }
21 22
sub params { $_[0]{params} }
22 23

  
23
sub
24
sub name { $_[0]{name} ||= $_[0]->_init_name }
25
sub _init_name { my $name = $_[0]{fullname}; $name =~ s/.*--//; $name }
26
sub path { @{ $_[0]{path} ||= [ $_[0]->_init_path ] } }
27
sub _init_path { my $name = $_[0]{fullname}; split /--/, $name }
28

  
29
sub children { }
30
sub siblings {}
31
sub parent {}
32

  
33

  
34
###### internal stuff #######
35

  
24 36

  
25 37

  
26 38
1;

Auch abrufbar als: Unified diff