Permalink
Browse files

fixed operators priorities

  • Loading branch information...
1 parent e2d0d0d commit 2bac3c737f02d2f1c78c648f51c75ecd0bfa978f @dams committed Feb 6, 2011
Showing with 5 additions and 4 deletions.
  1. +1 −0 Changes
  2. +4 −4 lib/Dancer/Plugin/FlashMessage.pm
View
@@ -1,4 +1,5 @@
{{$NEXT}}
+ . fixed operators priorities
0.312 2011-02-06 13:09:54 Europe/Paris
. depends on Dancer 1.3001
@@ -11,9 +11,9 @@ use Dancer::Plugin;
our $AUTHORITY = 'DAMS';
my $conf = plugin_setting;
-
my $token_name = $conf->{token_name} || 'flash';
my $session_hash_key = $conf->{session_hash_key} || '_flash';
+
my $session_engine;
register flash => sub ($;$) {
@@ -22,7 +22,7 @@ register flash => sub ($;$) {
$session_engine ||= engine 'session'
or croak __PACKAGE__ . " error2 : there is no session engine configured in the configuration. You need a session engine to be able to use this plugin";
- my $flash = session $session_hash_key || {};
+ my $flash = session($session_hash_key) || {};
@_ == 2 and $flash->{$key} = $value;
@_ == 1 and $value = delete $flash->{$key};
session $session_hash_key, $flash;
@@ -32,12 +32,12 @@ register flash => sub ($;$) {
before_template sub {
shift->{$token_name} = { map { my $key = $_; my $value;
( $key, sub { defined $value and return $value;
- my $flash = session $session_hash_key || {};
+ my $flash = session($session_hash_key) || {};
$value = delete $flash->{$key};
session $session_hash_key, $flash;
return $value;
} );
- } ( keys %{session $session_hash_key or {} })
+ } ( keys %{session($session_hash_key) || {} })
};
};

0 comments on commit 2bac3c7

Please sign in to comment.