Permalink
Browse files

Fixed memory leak when setting a helpers_arg

  • Loading branch information...
1 parent 6f33625 commit a62368d824ffddfc252c9d2bfc4c53fceaddb378 @vti committed Feb 3, 2010
Showing with 11 additions and 3 deletions.
  1. +11 −3 lib/Text/Haml.pm
View
@@ -118,13 +118,21 @@ sub escape_html {
sub code { @_ > 1 ? $_[0]->{code} = $_[1] : $_[0]->{code} }
sub compiled { @_ > 1 ? $_[0]->{compiled} = $_[1] : $_[0]->{compiled} }
sub helpers { @_ > 1 ? $_[0]->{helpers} = $_[1] : $_[0]->{helpers} }
-sub helpers_arg { @_ > 1 ? $_[0]->{helpers_arg} = $_[1] :
- $_[0]->{helpers_arg} }
sub filters { @_ > 1 ? $_[0]->{filters} = $_[1] : $_[0]->{filters} }
sub prepend { @_ > 1 ? $_[0]->{prepend} = $_[1] : $_[0]->{prepend} }
sub append { @_ > 1 ? $_[0]->{append} = $_[1] : $_[0]->{append} }
sub escape { @_ > 1 ? $_[0]->{escape} = $_[1] : $_[0]->{escape} }
-sub vars { @_ > 1 ? $_[0]->{vars} = $_[1] : $_[0]->{vars} }
+sub vars { @_ > 1 ? $_[0]->{vars} = $_[1] : $_[0]->{vars} }
+
+sub helpers_arg {
+ if (@_ > 1) {
+ $_[0]->{helpers_arg} = $_[1];
+ weaken $_[0]->{helpers_arg};
+ }
+ else {
+ return $_[0]->{helpers_arg};
+ }
+}
sub namespace {
@_ > 1

0 comments on commit a62368d

Please sign in to comment.