From 66d79db1f31814685e69add0078dd2f8c7f9a871 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Wed, 26 Mar 2014 07:56:54 +0200 Subject: [PATCH] Pass env to mangle in Generic --- lib/Gruntmaster/Page/Generic.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Gruntmaster/Page/Generic.pm b/lib/Gruntmaster/Page/Generic.pm index eefa908..e0eb290 100644 --- a/lib/Gruntmaster/Page/Generic.pm +++ b/lib/Gruntmaster/Page/Generic.pm @@ -48,7 +48,7 @@ sub list { exists $thing{columns} ? (columns => $thing{columns}) : (), }); my @thing = map +{rs => $_, $_->get_columns}, $rs->all; - @thing = map { $thing{mangle}->(); $_ } @thing if exists $thing{mangle}; + @thing = map { $thing{mangle}->($env); $_ } @thing if exists $thing{mangle}; @thing = grep { $thing{choose}->() } @thing if exists $thing{choose}; @thing = sort { $thing{sortby}->() } @thing if exists $thing{sortby}; $thing{group} //= sub { $thing{id} }; @@ -65,7 +65,8 @@ sub entry { my %thing = %$thing; debug $env => "Rsname is $thing{rsname} and id is $id"; my %params = map {+ rs => $_, $_->get_columns } db($env)->resultset($thing{rsname})->find($id); - $thing{mangle}->(local $_ = \%params) if exists $thing{mangle}; + local $_ = \%params; + $thing{mangle}->($env) if exists $thing{mangle}; wantarray ? %params : \%params } -- 2.39.2