File Coverage

blib/lib/Dancer2/Session/YAML.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 21 21 100.0


line stmt bran cond sub pod time code
1             package Dancer2::Session::YAML;
2             $Dancer2::Session::YAML::VERSION = '2.0.1';
3             # ABSTRACT: YAML-file-based session backend for Dancer2
4              
5 5     5   410600 use Moo;
  5         19062  
  5         66  
6 5     5   6573 use Dancer2::Core::Types;
  5         17  
  5         55  
7 5     5   80277 use YAML;
  5         34409  
  5         1285  
8              
9             has _suffix => (
10             is => 'ro',
11             isa => Str,
12             default => sub {'.yml'},
13             );
14              
15             with 'Dancer2::Core::Role::SessionFactory::File';
16              
17             sub _freeze_to_handle {
18 21     21   66 my ( $self, $fh, $data ) = @_;
19 21         41 print {$fh} YAML::Dump($data);
  21         109  
20 21         81152 return;
21             }
22              
23             sub _thaw_from_handle {
24 16     16   67 my ( $self, $fh ) = @_;
25 16         68 local $YAML::LoadBlessed = 1;
26 16         92 return YAML::LoadFile($fh);
27             }
28              
29             1;
30              
31             __END__