Revision history for Web-Simple
+ - fixes a memory leak that occurs when calling
+ Web::Simple::Application::to_psgi_app
+
0.024 - 2014-07-03
- small documentation fixes
has dispatch_app => (
is => 'lazy', builder => sub { shift->dispatch_object->to_app }
);
-has dispatch_object => (is => 'ro', required => 0);
+has dispatch_object => (is => 'ro', required => 0, weak_ref => 1);
has parser_class => (
is => 'ro', default => quote_sub q{ 'Web::Dispatch::Parser' }
);
sub to_app { [ 999, [], ["ok"] ] }
}
- my $d = Web::Dispatch->new( dispatch_object => ObjectApp->new );
+ my $o = ObjectApp->new;
+ my $d = Web::Dispatch->new( dispatch_object => $o );
my $res = $d->call;
cmp_ok $res->[0], '==', 999, "Web::Dispatch can dispatch properly, given only an object with to_app method";
--- /dev/null
+use strictures;
+use Test::More eval { require Devel::Cycle } ? 'no_plan' : ( skip_all => 'No Devel::Cycle' );
+
+use Web::Simple;
+use Devel::Cycle;
+
+my $counter;
+my $on_cycle = sub { Devel::Cycle::_do_report( ++$counter, shift ) };
+{
+ local *STDOUT = *STDERR;
+ Devel::Cycle::find_cycle( main->new->to_psgi_app, $on_cycle );
+}
+ok !$counter, "no leak in to_psgi_app";
+
+done_testing;