Revision aa7f51db
Von Sven Schöling vor fast 13 Jahren hinzugefügt
SL/Helper/Flash.pm | ||
---|---|---|
7 | 7 |
our @EXPORT = qw(flash flash_later); |
8 | 8 |
our @EXPORT_OK = qw(render_flash); |
9 | 9 |
|
10 |
my %valid_categories = ( |
|
11 |
map({$_ => 'info'} qw(information message)), |
|
12 |
map({$_ => $_} qw(info error warning)), |
|
13 |
); |
|
14 |
|
|
10 | 15 |
# |
11 | 16 |
# public functions |
12 | 17 |
# |
... | ... | |
29 | 34 |
|
30 | 35 |
sub _store_flash { |
31 | 36 |
my $store = shift || { }; |
32 |
my $category = shift; |
|
33 |
$category = 'info' if $category eq 'information'; |
|
37 |
my $category = _check_category(+shift); |
|
34 | 38 |
|
35 | 39 |
$store ||= { }; |
36 | 40 |
$store->{ $category } ||= [ ]; |
... | ... | |
39 | 43 |
return $store; |
40 | 44 |
} |
41 | 45 |
|
46 |
sub _check_category { |
|
47 |
my ($c) = @_; |
|
48 |
return $valid_categories{$c} |
|
49 |
|| die 'invalid category for flash'; |
|
50 |
} |
|
51 |
|
|
42 | 52 |
1; |
43 | 53 |
|
44 | 54 |
__END__ |
Auch abrufbar als: Unified diff
Kategorie bei Flash prüfen.