Uniform::HTMX::PAGI

CPAN version License: MIT

Framework-agnostic htmx adapter for the PAGI asynchronous web application environment.

Uniform::HTMX::PAGI inherits directly from Uniform::HTMX[cite: 5] to bridge incoming PAGI environment headers with outbound htmx response triggers and headers in asynchronous execution pipelines[cite: 5].

Installation

Install using cpanm or your preferred CPAN client:

cpanm Uniform::HTMX::PAGI

Synopsis

use strict;
use warnings;
use Uniform::HTMX::PAGI;

my $app = sub {
    my $env  = shift;
    my $htmx = Uniform::HTMX::PAGI->new($env);

    if ($htmx->is_htmx) {
        my $target = $htmx->target;

        # Accumulate outbound htmx headers via native base methods
        $htmx->res_trigger('itemSaved', { id => 42 })
             ->res_reswap('innerHTML');
    }

    my $res = [ 200, [ 'Content-Type' => 'text/html' ], [ '<div>Saved via PAGI!</div>' ] ];

    # Inject accumulated headers into response structure
    return $htmx->apply($res);
};

Key Features

Local Development & Testing

Run the test suite using prove:

prove -Ilib t/

This software is Copyright (c) 2026 by Joshua S. Day <HAX@cpan.org>[cite: 6, 7].

This is free software, licensed under:

The MIT (X11) License