RunApp(3pm)

πŸ“¦
version 0.13 Β· 2 versions
  • 0.13 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.13 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ RunApp β€” the manual page but make it a group chat ✨

okay bestie, gather round, because we're talking about RunApp from the Perl user-contributed docs (that's the 3pm manual, iykyk) πŸ’…

RunApp is a generic module to run web-applications. That's the whole vibe. It's the friend who handles all the boring setup so you can be the main character. 🫢


🌸 SYNOPSIS 🌸

here's what it actually looks like when you call it, no cap:

 use RunApp '-chdir';

 use RunApp;
 use RunApp::Apache;

 my $cmd = shift || 'development';
 my $config = { var => 'value', app_apache => { var_for_apache => 'value'} };
 RunApp->new (app_apache => RunApp::Apache->new
                    (root => catfile (cwd, $_),
                     httpd => '/path/to/httpd'),
              my_daemon => RunApp::Control::AppControl->new
                    (binary => '/path/to/daemon',
                     args => ['--daemon'],
                     pidfile => '/path/to/daemon.pid',
                    )
                 )->$cmd ($config);

yes the ->$cmd ($config) thing is real, it's giving method-name-in-a-variable energy and honestly? iconic. ✨


πŸ’– DESCRIPTION πŸ’–

so RunApp streamlines the whole process of configuring applications that need one or more web servers and/or other daemons β€” whether you're doing development or deployment. it just... takes that chaos and makes it cute.

it builds the config files the services need straight out of the $config hash, like apache's httpd.conf. πŸŽ€

literally it's the "i got you" of config generation.


πŸ¦‹ OPTIONS πŸ¦‹

 use RunApp '-chdir';
 use RunApp qw(-chdir ..);
  • -chdir β€” this makes your script chdir to the base directory. and bestie, if it's a symbolic link, it gets resolved, so you end up in the directory where the original script lives. the lib directory gets added into @INC too, so you can use the modules sitting in that path. periodt. πŸ’…
  • it also takes an optional relative path if you want the script to chdir somewhere else instead.
  • and the reason this is so slay? it makes it possible to symlink your runapp script into the system's rc.d startup directory. πŸ‘‘

πŸ‘‘ CONSTRUCTOR πŸ‘‘

new (@services)

okay so @services is actually a hash, even though it's named like an array β€” the keys are the name of the service, and the values are RunApp::Control objects. 🫢

⚠️ real talk: use an array instead of a hash here if you want to retain the order of dispatching. the order matters, bestie, don't let anyone tell you otherwise.

the names get used to pick config out of the hash, which gets flattened into the top level of the config hash when running build for each service. ✨


πŸ’… METHODS πŸ’…

$self->development ($conf)

runs build and start, and then just... waits. for SIGINT. to <stop> the servers. 😭

it's the "i'll be here when you need me" method.


🌈 AUTOLOAD 🌈

every other method gets dispatched to the RunApp::Control objects, in the order they were called in the CONSTRUCTOR. πŸŽ€

ngl, the way this works is: RunApp::Control dispatches to the dispatch method. iykyk. 🧚


⭐ SEE ALSO ⭐

  • RunApp::Apache
  • RunApp::Control::AppControl
  • App::Control

go read them, they're the supporting cast and they ate. πŸ”₯


πŸ’œ AUTHORS πŸ’œ

  • Chia-liang Kao <clkao@clkao.org>
  • Refactored from works by Leon Brocard <acme@astray.com> and Tom Insam <tinsam@fotango.com>.

Copyright (C) 2002-5, Fotango Ltd.

This module is free software; you can redistribute it or modify it under the same terms as Perl itself. 🌸


and that's the whole page, bestie β€” brought to you by perl v5.34.0, dated 2022-06-17, under the RunApp(3pm) name. now go forth and run your web-applications. slay. πŸ’–βœ¨πŸ‘‘

πŸ“¦ where this page comes from