OK, so an update here. I have removed the fork() stuff. The problem is that when I create an object in my webapp, it goes out of scope immediately as the webapp is presented with plackup. Here's a much trimmed down repro example:
# Scope.pm in webapp root dir package Scope; sub new { return bless {}, shift } sub DESTROY { print "going out of scope...\n"; } # webapp package MyApp; use lib '.'; use Scope; use Dancer2; use Dancer2::Plugin::Database; our $VERSION = '0.1'; my $obj = Scope->new;
Now run it:
plackup -R lib,bin bin/app.pl
Here's what happens when I run it:
Watching lib bin bin/lib bin/app.pl for file updates. going out of scope HTTP::Server::PSGI: Accepting connections at http://0:5000/
I've also asked for guidance on the #dancer IRC channel. I'm hoping someone with experience with Dancer2 (or perhaps web frameworks in general) can help me get a grasp on getting around this issue (as I pour through resources I'm finding online elsewhere).
In reply to Re: Async timed events with Dancer2
by stevieb
in thread [SOLVED]: Async timed events with Dancer2
by stevieb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |