blib/lib/Catalyst/TraitFor/Request/Plack/Session.pm

filter: Statementstmt 94.1% 16 / 17 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod n/a totaltotal 90.9% 20 / 22 CC 1 SCAR 1.8
CC
1
Cov
94%
_build_plack_session
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
↑ Summary
1 #
2 # This file is part of Catalyst-TraitFor-Request-Plack-Session
3 #
4 # This software is Copyright (c) 2012 by Chris Weyl.
5 #
6 # This is free software, licensed under:
7 #
8 # The GNU Lesser General Public License, Version 2.1, February 1999
9 #
10 package Catalyst::TraitFor::Request::Plack::Session;
11 {
12 1 $Catalyst::TraitFor::Request::Plack::Session::VERSION = '0.001';
13 }
14  
15 # ABSTRACT: Easily access the current request's Plack session
16  
17 1 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use MooseX::AttributeShortcuts;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 1 ▶use Plack::Session;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23  
24 1 has plack_session => (
25 is => 'lazy',
26 isa => 'Plack::Session',
27 );
28  
29 0 ▶sub _build_plack_session { Plack::Session->new(shift->env) }
Subroutine _build_plack_session: not called CC=1 SCAR=6.9
30  
31 1 !!42;
32  
33  
34 =pod
35  
36 =encoding utf-8
37  
38 =head1 NAME
39  
40 Catalyst::TraitFor::Request::Plack::Session - Easily access the current request's Plack session
41  
42 =head1 VERSION
43  
44 This document describes version 0.001 of Catalyst::TraitFor::Request::Plack::Session - released June 03, 2012 as part of Catalyst-TraitFor-Request-Plack-Session.
45  
46 =head1 SYNOPSIS
47  
48 # in your app class
49 use CatalystX::RoleApplicator;
50 __PACKAGE__->apply_request_class_roles(qw/
51 Catalyst::TraitFor::Request::Plack::Session
52 /);
53  
54 # then, off in an action/view/whatever somewhere...
55 my $ps = $ctx->req->plack_session;
56  
57 =head1 DESCRIPTION
58  
59 This is a tiny little L<Catalyst::Request> class trait that allows easy,
60 lazy access to the L<Plack> session, on demand.
61  
62 Note that for this to make any sense at all, you need to be using
63 L<Plack::Middleware::Session>.
64  
65 =head1 ATTRIBUTES
66  
67 =head2 plack_session
68  
69 A place to stash the session, if we've created it.
70  
71 =head1 METHODS
72  
73 =head2 plack_session
74  
75 Returns the L<Plack::Session> object for this request. If necessary the
76 session object will be constructed.
77  
78 =head1 SEE ALSO
79  
80 Please see those modules/websites for more information related to this module.
81  
82 =over 4
83  
84 =item *
85  
86 L<Plack::Middleware::Session>
87  
88 =back
89  
90 =head1 SOURCE
91  
92 The development version is on github at L<http://github.com/RsrchBoy/catalyst-traitfor-request-plack-session>
93 and may be cloned from L<git://github.com/RsrchBoy/catalyst-traitfor-request-plack-session.git>
94  
95 =head1 BUGS
96  
97 Please report any bugs or feature requests on the bugtracker website
98 https://github.com/RsrchBoy/catalyst-traitfor-request-plack-session/issues
99  
100 When submitting a bug or request, please include a test-file or a
101 patch to an existing test-file that illustrates the bug or desired
102 feature.
103  
104 =head1 AUTHOR
105  
106 Chris Weyl <cweyl@alumni.drew.edu>
107  
108 =head1 COPYRIGHT AND LICENSE
109  
110 This software is Copyright (c) 2012 by Chris Weyl.
111  
112 This is free software, licensed under:
113  
114 The GNU Lesser General Public License, Version 2.1, February 1999
115  
116 =cut
117  
118  
119 __END__
↑ Summary