line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Config::Yak::LazyConfig; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$Config::Yak::LazyConfig::VERSION = '0.23'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
BEGIN { |
6
|
1
|
|
|
1
|
|
23978
|
$Config::Yak::LazyConfig::AUTHORITY = 'cpan:TEX'; |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
# ABSTRACT: a role to provide a lazy initialized config attribute |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
29
|
use 5.010_000; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
36
|
|
11
|
1
|
|
|
1
|
|
17243
|
use mro 'c3'; |
|
1
|
|
|
|
|
806
|
|
|
1
|
|
|
|
|
6
|
|
12
|
1
|
|
|
1
|
|
44
|
use feature ':5.10'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
107
|
|
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
529
|
use Moose::Role; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use namespace::autoclean; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# use IO::Handle; |
18
|
|
|
|
|
|
|
# use autodie; |
19
|
|
|
|
|
|
|
# use MooseX::Params::Validate; |
20
|
|
|
|
|
|
|
# use Carp; |
21
|
|
|
|
|
|
|
# use English qw( -no_match_vars ); |
22
|
|
|
|
|
|
|
# use Try::Tiny; |
23
|
|
|
|
|
|
|
use Config::Yak; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# extends ... |
26
|
|
|
|
|
|
|
# has ... |
27
|
|
|
|
|
|
|
has 'config' => ( |
28
|
|
|
|
|
|
|
'is' => 'rw', |
29
|
|
|
|
|
|
|
'isa' => 'Config::Yak', |
30
|
|
|
|
|
|
|
'lazy' => 1, |
31
|
|
|
|
|
|
|
'builder' => '_init_config', |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# with ... |
35
|
|
|
|
|
|
|
# initializers ... |
36
|
|
|
|
|
|
|
sub _init_config { |
37
|
|
|
|
|
|
|
my $self = shift; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $Config = Config::Yak::->new( { 'locations' => $self->_config_locations(), } ); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
return $Config; |
42
|
|
|
|
|
|
|
} ## end sub _init_config |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# requires ... |
45
|
|
|
|
|
|
|
requires '_config_locations'; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# your code here ... |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
no Moose::Role; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__END__ |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=pod |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=encoding utf-8 |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 NAME |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Config::Yak::LazyConfig - a role to provide a lazy initialized config attribute |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 SYNOPSIS |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
use Moose; |
66
|
|
|
|
|
|
|
with 'Config::Yak::LazyConfig'; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 DESCRIPTION |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
This Moose role provides an config attribute giving access to an |
71
|
|
|
|
|
|
|
lazyly constructed Config::Yak instance. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 NAME |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Config::Yak::LazyConfig - This role provides an lazy config attribute. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 AUTHOR |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Dominik Schulz <dominik.schulz@gauner.org> |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
This software is copyright (c) 2012 by Dominik Schulz. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
86
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=cut |