File Coverage

blib/lib/Autocache/Request.pm
Criterion Covered Total %
statement 13 13 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 17 17 100.0


line stmt bran cond sub pod time code
1             package Autocache::Request;
2              
3 5     5   19 use Any::Moose;
  5         6  
  5         30  
4              
5 5     5   2533 use Autocache::Logger qw(get_logger);
  5         6  
  5         739  
6              
7             has 'name' => (
8             is => 'ro',
9             isa => 'Str',
10             required => 1,
11             );
12              
13             has 'normaliser' => (
14             is => 'ro',
15             required => 1,
16             );
17              
18             has 'generator' => (
19             is => 'ro',
20             required => 1,
21             );
22              
23             has 'args' => (
24             is => 'ro',
25             isa => 'ArrayRef',
26             required => 1,
27             );
28              
29             has 'context' => (
30             is => 'ro',
31             isa => 'Str',
32             required => 1,
33             );
34              
35             has 'key' => (
36             is => 'ro',
37             isa => 'Str',
38             lazy_build => 1,
39             );
40              
41             sub _build_key
42             {
43 257     257   190 my ($self) = @_;
44 257         309 get_logger()->debug( "_build_key" );
45             return sprintf 'AC-%s-%s-%s',
46             $self->context,
47             $self->name,
48 257         408 $self->normaliser->( @{$self->args} );
  257         572  
49             }
50              
51 5     5   23 no Any::Moose;
  5         5  
  5         20  
52             __PACKAGE__->meta->make_immutable;
53              
54             1;