Skip to content

Commit

Permalink
Fix memory cyles causing leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
rafl authored and gshank committed May 13, 2011
1 parent 0b69b55 commit 2aa7393
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
13 changes: 4 additions & 9 deletions lib/HTML/FormHandler.pm
Original file line number Diff line number Diff line change
Expand Up @@ -678,21 +678,16 @@ form name.
=cut

# for consistency in api with field nodes
sub form { shift }
sub has_form { 1 }

# Moose attributes
has 'name' => (
isa => 'Str',
is => 'rw',
default => sub { return 'form' . int( rand 1000 ) }
);
# for consistency in api with field nodes
has 'form' => (
isa => 'HTML::FormHandler',
is => 'rw',
weak_ref => 1,
predicate => 'has_form',
lazy => 1,
default => sub { shift }
);
has 'parent' => ( is => 'rw' );
has 'result' => (
isa => 'HTML::FormHandler::Result',
Expand Down
2 changes: 1 addition & 1 deletion lib/HTML/FormHandler/Field.pm
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ errors with C<< $field->add_error >>.

has 'name' => ( isa => 'Str', is => 'rw', required => 1 );
has 'type' => ( isa => 'Str', is => 'rw', default => sub { ref shift } );
has 'parent' => ( is => 'rw', predicate => 'has_parent' );
has 'parent' => ( is => 'rw', predicate => 'has_parent', weak_ref => 1 );
sub has_fields { }
has 'input_without_param' => (
is => 'rw',
Expand Down

0 comments on commit 2aa7393

Please sign in to comment.