| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package MCP::Server::Session; |
|
2
|
4
|
|
|
4
|
|
22
|
use Mojo::Base -base, -signatures; |
|
|
4
|
|
|
|
|
9
|
|
|
|
4
|
|
|
|
|
23
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
has [qw(id stream)]; |
|
5
|
|
|
|
|
|
|
has last_used => sub {time}; |
|
6
|
|
|
|
|
|
|
|
|
7
|
24
|
|
|
24
|
1
|
64
|
sub touch ($self) { |
|
|
24
|
|
|
|
|
31
|
|
|
|
24
|
|
|
|
|
30
|
|
|
8
|
24
|
|
|
|
|
90
|
$self->last_used(time); |
|
9
|
24
|
|
|
|
|
118
|
return $self; |
|
10
|
|
|
|
|
|
|
} |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
1; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=encoding utf8 |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
MCP::Server::Session - Session container |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
use MCP::Server::Session; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $session = MCP::Server::Session->new(id => '12345'); |
|
25
|
|
|
|
|
|
|
$session->touch; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
L is a container for per-session state. |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
L implements the following attributes. |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 id |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my $id = $session->id; |
|
38
|
|
|
|
|
|
|
$session = $session->id('12345'); |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
The session identifier. |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 last_used |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my $time = $session->last_used; |
|
45
|
|
|
|
|
|
|
$session = $session->last_used(time); |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Epoch seconds of the last activity on this session, defaults to the time the session was created. Updated by |
|
48
|
|
|
|
|
|
|
L"touch">. |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 stream |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
my $stream = $session->stream; |
|
53
|
|
|
|
|
|
|
$session = $session->stream(Mojolicious::Controller->new); |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
The L currently serving the server-to-client SSE stream for this session, or C if |
|
56
|
|
|
|
|
|
|
no stream is open. |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 METHODS |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
L inherits all methods from L and implements the following new ones. |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 touch |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
$session = $session->touch; |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Set L"last_used"> to the current time. |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
L, L, L. |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |