File Coverage

blib/lib/Games/Lacuna/Task/Role/Client.pm
Criterion Covered Total %
statement 4 6 66.6
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 6 8 75.0


line stmt bran cond sub pod time code
1             package Games::Lacuna::Task::Role::Client;
2              
3 1     1   1728 use 5.010;
  1         5  
  1         55  
4             our $VERSION = $Games::Lacuna::Task::VERSION;
5              
6 1     1   434 use Moose::Role;
  0            
  0            
7              
8             use Games::Lacuna::Task::Client;
9              
10             our $DEFAULT_DIRECTORY = Path::Class::Dir->new($ENV{HOME}.'/.lacuna');
11              
12             has 'configdir' => (
13             is => 'rw',
14             isa => 'Path::Class::Dir',
15             coerce => 1,
16             documentation => 'Path to the lacuna directory [Default '.$DEFAULT_DIRECTORY.']',
17             default => sub { return $DEFAULT_DIRECTORY },
18             );
19              
20             has 'client' => (
21             is => 'ro',
22             isa => 'Games::Lacuna::Task::Client',
23             traits => ['NoGetopt'],
24             lazy_build => 1,
25             handles => [qw(get_cache set_cache clear_cache request paged_request empire_name build_object storage_prepare storage_do get_stash has_stash stash)]
26             );
27              
28             sub _build_client {
29             my ($self) = @_;
30            
31             # Build new client
32             my $client = Games::Lacuna::Task::Client->new(
33             loglevel => $self->loglevel,
34             configdir => $self->configdir,
35             debug => $self->debug,
36             );
37            
38             return $client;
39             }
40              
41             no Moose::Role;
42             1;
43              
44             =encoding utf8
45              
46             =head1 NAME
47              
48             Games::Lacuna::Role::Client - Client glue code
49              
50             =head1 METHODS
51              
52             =head2 configdir
53              
54             Path to the config directory.
55              
56             =head2 client
57              
58             L<Games::Lacuna::Task::Client> object. Most public methods in this class
59             are available via method delegation.
60              
61             =cut