File Coverage

blib/lib/DBIx/NoSQL/Stash.pm
Criterion Covered Total %
statement 25 25 100.0
branch 3 4 75.0
condition n/a
subroutine 6 6 100.0
pod 0 1 0.0
total 34 36 94.4


line stmt bran cond sub pod time code
1             package DBIx::NoSQL::Stash;
2             our $AUTHORITY = 'cpan:YANICK';
3             $DBIx::NoSQL::Stash::VERSION = '0.0021';
4 8     8   38 use strict;
  8         16  
  8         288  
5 8     8   38 use warnings;
  8         12  
  8         278  
6              
7 8     8   37 use Moose;
  8         11  
  8         74  
8 8     8   43483 use Carp qw/ cluck /;
  8         16  
  8         1880  
9              
10             has store => qw/ is ro required 1 weak_ref 1 /;
11              
12             has model => qw/ is ro lazy_build 1 /;
13             sub _build_model {
14 9     9   19 my $self = shift;
15 9         221 my $model = $self->store->model( '__NoSQL_Stash__' );
16 9         5767 $model->searchable( 0 );
17 9         218 return $model;
18             }
19              
20             sub value {
21 19     19 0 45 my $self = shift;
22 19         38 my $key = shift;
23 19 100       73 if ( @_ ) {
24 15         31 my $value = shift;
25 15         382 $self->model->set( $key, { value => $value } );
26 15         147 return;
27             }
28 4         117 my $value = $self->model->get( $key );
29 4 50       85 return unless $value;
30 4         32 return $value->{ value };
31             }
32              
33              
34             1;
35              
36             __END__
37              
38             =pod
39              
40             =encoding UTF-8
41              
42             =head1 NAME
43              
44             DBIx::NoSQL::Stash
45              
46             =head1 VERSION
47              
48             version 0.0021
49              
50             =head1 AUTHORS
51              
52             =over 4
53              
54             =item *
55              
56             Robert Krimen <robertkrimen@gmail.com>
57              
58             =item *
59              
60             Yanick Champoux <yanick@cpan.org>
61              
62             =back
63              
64             =head1 COPYRIGHT AND LICENSE
65              
66             This software is copyright (c) 2017 by Robert Krimen.
67              
68             This is free software; you can redistribute it and/or modify it under
69             the same terms as the Perl 5 programming language system itself.
70              
71             =cut