blib/lib/PAGI/Nano/Context/WebSocket.pm

filter: Statementstmt 100% 22 / 22 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 100% 30 / 30 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/PAGI/Nano/Context/SSE.pm ↑ Summary examples/custom-middleware/app.pl »
1 package PAGI::Nano::Context::WebSocket;
2 11 $PAGI::Nano::Context::WebSocket::VERSION = '0.001001';
3 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 11 ▶use parent -norequire, 'PAGI::Context::WebSocket', 'PAGI::Nano::Context';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 11 ▶use PAGI::Context; # base declares @ISA but does not load it
Subroutine BEGIN: called CC=1 SCAR=0.0
7 11 ▶use PAGI::Context::WebSocket;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 11 ▶use PAGI::Nano::Context; # the shared mixin (uri_for)
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 # The WebSocket context Nano vends: a genuine PAGI::Context::WebSocket (so
11 # $c->websocket and the rest of the WS API work) plus the shared Nano behavior,
12 # notably $c->uri_for for building links from WS handlers. Blessed directly so
13 # the base factory's scope-type resolution does not down-cast us.
14  
15 7 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
16 7 my ($class, $scope, $receive, $send) = @_;
17 7 return bless {
18 scope => $scope,
19 receive => $receive,
20 send => $send,
21 }, $class;
22 }
23  
24 11 1;
25  
26 =encoding utf8
27  
28 =head1 NAME
29  
30 PAGI::Nano::Context::WebSocket - The WebSocket context vended by PAGI::Nano
31  
32 =head1 DESCRIPTION
33  
34 A subclass of L<PAGI::Context::WebSocket> (so C<< $c->websocket >> and the full
35 WebSocket API are available) that also mixes in L<PAGI::Nano::Context>, giving
36 WebSocket handlers C<< $c->uri_for >> for link generation.
37  
38 =head1 SEE ALSO
39  
40 L<PAGI::Nano>, L<PAGI::Nano::Context>, L<PAGI::Context::WebSocket>.
41  
42 =head1 AUTHOR
43  
44 John Napiorkowski C<< <jjnapiork@cpan.org> >>
45  
46 =head1 COPYRIGHT & LICENSE
47  
48 Copyright 2026, John Napiorkowski. This library is free software; you can
49 redistribute it and/or modify it under the same terms as Perl itself.
50  
51 =cut
« blib/lib/PAGI/Nano/Context/SSE.pm ↑ Summary examples/custom-middleware/app.pl »