NAME
Uniform::HTMX::PAGI - Explicit asynchronous htmx driver adapter for the PAGI gateway ecosystem
SYNOPSIS
use Future::AsyncAwait;
use Uniform::HTMX::PAGI;
async sub handle_pagi_stream ($scope, $receive, $send) {
# Explicit instantiation with zero implicit guessing overhead
my $hx = Uniform::HTMX::PAGI->new($scope);
my @response_headers = (['content-type', 'text/html']);
if ($hx->is_htmx) {
$hx->res_retarget('#realtime-status-container')
->res_trigger('asyncProcessingStarted')
->apply; # Stashes parameters securely inside $scope
# Append stashed array fields directly to your response stream packet
push @response_headers, @{ $scope->{'htmx.outbound'} || [] };
}
await $send->({
type => 'http.response.start',
status => 200,
headers => \@response_headers,
});
await $send->({
type => 'http.response.body',
body => '<p>Live async fragment stream payload updated natively!</p>',
more => 0,
});
}
DESCRIPTION
Uniform::HTMX::PAGI provides a non-blocking integration bridge linking the Uniform::HTMX base layer directly into the event-driven PAGI stream pipeline specification.
METHODS
new( $scope )
Validates and instantiates the asynchronous client context driver. Requires an active PAGI HTTP connection scope hash reference. Automatically flattens and normalizes inbound header arrays.
apply()
Flushes and commits your accumulated state modifications down into the target scope data payload. Stashes compiled headers inside an isolated array reference token located at $scope->{'htmx.outbound'}.
Returns $self to support method chaining
SEE ALSO
AUTHOR
Joshua S. Day <HAX@cpan.org>
LICENSE
Licensed under the same terms as Uniform::HTMX.