our @EXPORT = qw(flash flash_later);
our @EXPORT_OK = qw(render_flash);
+my %valid_categories = (
+ map({$_ => 'info'} qw(information message)),
+ map({$_ => $_} qw(info error warning)),
+);
+
#
# public functions
#
sub _store_flash {
my $store = shift || { };
- my $category = shift;
- $category = 'info' if $category eq 'information';
+ my $category = _check_category(+shift);
$store ||= { };
$store->{ $category } ||= [ ];
return $store;
}
+sub _check_category {
+ my ($c) = @_;
+ return $valid_categories{$c}
+ || die 'invalid category for flash';
+}
+
1;
__END__