Web::S...loyment(3pm)

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

πŸ’– Web::Simple::Deployment πŸ’–

okay bestie, so this is Web::Simple::Deployment(3pm) β€” like, the manual page, and it's your whole guide to deploying a Web::Simple app. Get comfy. 🫢


✨ NAME ✨

Web::Simple::Deployment β€” various deployment options πŸ’…


🌸 DESCRIPTION 🌸

This file documents common deployment methods for Web::Simple. No cap, it's just the rundown of the ways you can get your app out into the world.

And if you're sitting there like "bestie… a method is missing??" β€” please ask in the IRC channel and we'll work with you to add it. Fr fr, they want to help. πŸŽ€


πŸ’Ύ CGI πŸ’Ύ

The most basic deployment option, the entry-level slay, is running your thing as a CGI script that loads and runs your Web::Simple-module:

#!/usr/bin/env perl

use Your::Web::Simple::App;
Your::Web::Simple::App->run_if_script;

Save that as script.cgi and your web server will handle it correctly. That's it. That's the whole vibe. ✨


πŸš€ Plack-Server πŸš€

okay so this one works with exactly the same code as CGI deployment β€” same file, same everything. The only glow-up is that instead of letting your web server load script.cgi, you run this on the command line:

plackup script.cgi

Iconic. πŸ‘‘

🧚 Self-contained CGI 🧚

Sometimes your app is so smol β€” like, you've got only one or two tiny classes β€” that you just want to run it as a CGI script and not make a whole thing of it. And Web::Simple offers a helpful mechanism to achieve that. Obsessed, honestly.

#!/usr/bin/env perl

use Web::Simple 'HelloWorld';   # enables strictures and warnings for the file
                                # additionally, HelloWorld is upgraded to a
                                # Web::Simple application
{
  package HelloWorld;

  sub dispatch_request {
    sub (GET) {
      [
        200,
        [ 'Content-type', 'text/plain' ],
        [ 'Hello world! It is a fine ' . HelloWorld::Helper->day ]
      ]
    },
    sub () {
      [ 405, [ 'Content-type', 'text/plain' ], [ 'Method not allowed' ] ]
    }
  }
}

{
  package HelloWorld::Helper;

  use DateTime;

  sub day {
    return DateTime->now->day_name;
  }
}

HelloWorld->run_if_script;

look at her. main character energy. πŸ¦‹


πŸ‘‘ AUTHORS πŸ‘‘

See Web::Simple for authors. (iykyk, all the credit lives over there πŸ’œ)


See Web::Simple for the copyright and license.


k that's the whole page bestie, go deploy something gorgeous πŸ’–βœ¨

mwah πŸ’‹ β€” this was perl v5.34.0, dated 2022-06-28, from the Web::S...loyment(3pm) era of the docs πŸŽ€

πŸ“¦ where this page comes from