in reply to Adding simple HTTP controls to existing code
For example, the two web frameworks Mojolicious and Dancer (or Dancer2), or maybe even the raw Plack interface allow you to do that, and they each come with a built-in web server as well.
Your program could look like the following, adapted from the Mojolicious::Lite synopsis:
# Automatically enables "strict", "warnings", "utf8" and Perl 5.16 f +eatures use Mojolicious::Lite -signatures; # Route with placeholder get '/' => sub ($c) { my $foo = $c->param('foo'); $c->render(text => "Hello from $foo."); run_main_program(); }; # Start the Mojolicious command system app->start;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Adding simple HTTP controls to existing code
by brachism (Novice) on Jul 05, 2021 at 12:55 UTC | |
by holli (Abbot) on Jul 05, 2021 at 21:57 UTC |