<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package Plack::Middleware::XFramework;
use strict;
use warnings;
use parent qw/Plack::Middleware/;

use Plack::Util;
use Plack::Util::Accessor qw( framework );

sub call {
    my $self = shift;

    my $res = $self-&gt;app-&gt;( @_ );
    $self-&gt;response_cb($res, sub {
        my $res = shift;
        if ($self-&gt;framework) {
            Plack::Util::header_set $res-&gt;[1], 'X-Framework' =&gt; $self-&gt;framework;
        }
    });
}

1;

__END__

=head1 NAME

Plack::Middleware::XFramework - Sample middleware to add X-Framework

=head1 SYNOPSIS

  enable "Plack::Middleware::XFramework", framework =&gt; "Catalyst";

=head1 DESCRIPTION

This middleware adds C&lt;X-Framework&gt; header to the HTTP response.

=head1 CONFIGURATION

=over 4

=item framework

Sets the string value of C&lt;X-Framework&gt; header. If not set, the header is not set to the response.

=back

=head1 SEE ALSO

L&lt;Plack::Middleware&gt;

=cut

</pre></body></html>