YamlTime/Conf.pm untested

filter: Statementstmt 0.0% 0 / 24 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 33 CC 3 SCAR 19.5
CC
3
Cov
0%
BUILD
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 7.0
1 ##
2 # name: YamlTime::Conf
3 # abstract: YamlTime Configuration Object Class
4 # author: Ingy döt Net <ingy@cpan.org>
5 # license: perl
6 # copyright: 2011
7 # see:
8 # - YamlTime
9  
10 #-----------------------------------------------------------------------------#
11 package YamlTime::Conf;
12 use Mouse;
13 use YAML::XS;
14 use DateTime;
15 # use XXX;
16  
17 sub BUILD {
18 my ($self) = @_;
19 my $base = $self->base;
20 die "YamlTime is not configured in '$base'\n"
21 unless -e "conf/yt.yaml";
22 my $hash = YAML::XS::LoadFile('conf/yt.yaml');
23 $self->{$_} = $hash->{$_} for keys %$hash;
24 die <<"..." if $self->unconfigured;
25 It appears you have not configured YamlTime yet.
26 Edit conf/yt.yaml and remove the 'unconfigured' key.
27 Edit the file correctly, and edit the other conf files too.
28 Then retry your command.
29 ...
30 for (qw[cust proj rate refs tags]) {
31 $self->{$_} = YAML::XS::LoadFile("conf/$_.yaml");
32 }
33 }
34  
35 has base => ( is => 'ro', required => 1 );
36 has timezone => ( is => 'ro' );
37 has unconfigured => ( is => 'ro' );
38 has be_serious => ( is => 'ro' );
39  
40 has now => (
41 is => 'ro',
42 lazy => 1,
43 builder => sub {
44 my ($self) = @_;
45 return DateTime->now->set_time_zone($self->timezone);
46 },
47 );
48  
49 1;