NAME

PAGI::App::Loader - Load PAGI app from file

SYNOPSIS

use PAGI::App::Loader;

my $app = PAGI::App::Loader->new(
    file => 'app.pl',
)->to_app;

DESCRIPTION

Loads a PAGI app from a .pl file. Supports optional auto-reload for development.

OPTIONS

  • file - Path to the .pl file containing the PAGI app

  • reload - Auto-reload when file changes (default: 0)

APP FILE FORMAT

The file should return a coderef:

# app.pl
use Future::AsyncAwait;

async sub ($scope, $receive, $send) {
    await $send->({ type => 'http.response.start', status => 200, headers => [] });
    await $send->({ type => 'http.response.body', body => 'Hello', more => 0 });
};