Tools/CLI/Context.pm untested

filter: Statementstmt 0.0% 0 / 30 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 38 CC 1 SCAR 6.9
CC
1
Cov
0%
find_homedir
2.0
create_yamlcache
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/bin/perl
2  
3 package Mail::Summary::Tools::CLI::Context;
4 use Moose;
5  
6 use File::Save::Home ();
7 use Path::Class;
8  
9 has homedir => (
10 isa => "Path::Class::Dir",
11 is => "rw",
12 lazy => 1,
13 default => sub { Path::Class::dir($_[0]->find_homedir) },
14 );
15  
16 has cache => (
17 isa => "Object",
18 is => "rw",
19 lazy => 1,
20 default => sub {
21 my $self = shift;
22 $self->create_yamlcache($self->cache_storage);
23 },
24 );
25  
26 has cache_storage => (
27 isa => "Path::Class::File",
28 is => "rw",
29 lazy => 1,
30 default => sub { $_[0]->homedir->file("cache") },
31 );
32  
33 has nntp_overviews => (
34 isa => "Object",
35 is => "rw",
36 lazy => 1,
37 default => sub {
38 my $self = shift;
39 warn "loading " . $self->nntp_overview_storage;
40 $self->create_yamlcache($self->nntp_overview_storage);
41 },
42 );
43  
44 has nntp_overview_storage=> (
45 isa => "Path::Class::File",
46 is => "rw",
47 lazy => 1,
48 default => sub { $_[0]->homedir->file("nntp_overviews") },
49 );
50  
51 sub find_homedir {
52 my $self = shift;
53  
54 return File::Save::Home::make_subhome_directory(
55 File::Save::Home::get_subhome_directory_status(".mailsum"),
56 );
57 }
58  
59 sub create_yamlcache {
60 my ( $self, $path ) = @_;
61  
62 require Mail::Summary::Tools::YAMLCache;
63 return Mail::Summary::Tools::YAMLCache->new( file => $path );
64 }
65  
66 __PACKAGE__;
67  
68 __END__