blib/lib/MooseX/ScopedConfig.pm

filter: Statementstmt 100% 19 / 19 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 96.3% 26 / 27 CC 2 SCAR 2.9
CC
2
Cov
95%
get_config_from_file
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
↑ Summary
1 package MooseX::ScopedConfig;
2  
3 3 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use Config::Scoped;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 with 'MooseX::ConfigFromFile';
7  
8 =head1 NAME
9  
10 MooseX::ScopedConfig - Moose eXtension to use Config::Scoped
11  
12 =head1 VERSION
13  
14 Version 0.03
15  
16 =cut
17  
18 3 our $VERSION = '0.03';
19  
20  
21 =head1 SYNOPSIS
22  
23 MooseX::ScopedConfig is to Config::Scoped as MooseX::SimpleConfig is to Config::Any
24  
25 package My::AwesomePackage;
26 use Moose;
27 with 'MooseX::ScopedConfig';
28  
29 # optional, default config file name
30 sub configfile { '/tmp/application.cfg' }
31  
32 # a script useing your awesome (configurable) package
33
34 use My::AwesomePackage;
35 my $ap = My::AwesomePackage->new_with_config(configfile => '/tmp/app.cfg');
36 ...
37  
38 =head1 SUBROUTINES/METHODS
39  
40 =head2 get_config_from_file
41  
42 get_config_from_file does the real work tying Config::Scoped to MooseX::ConfigFromFile
43  
44 =cut
45  
46 1 ▶sub get_config_from_file {
Subroutine get_config_from_file: called CC=2 SCAR=7.0
Pod documented
47 1 my ($self, $file) = @_;
48 1 ▶ $file = $file->() if (ref($file) eq 'CODE');
Branch: 1 branch
BranchTrueFalseTotal
if ref $file eq "CODE" 0 1 1
49 1 my $cs = Config::Scoped->new(file => $file, warnings => { parameters => 'off' });
50 1 my $cfg = $cs->parse();
51 1 return $cfg;
52 }
53  
54 =head1 AUTHOR
55  
56 brad barden, C<< <iamb at mifflinet.net> >>
57  
58 =head1 BUGS
59  
60 Please report any bugs or feature requests to C<bug-moosex-scopedconfig at rt.cpan.org>, or through
61 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MooseX-ScopedConfig>. I will be notified, and then you'll
62 automatically be notified of progress on your bug as I make changes.
63  
64  
65  
66  
67 =head1 SUPPORT
68  
69 You can find documentation for this module with the perldoc command.
70  
71 perldoc MooseX::ScopedConfig
72  
73  
74 You can also look for information at:
75  
76 =over 4
77  
78 =item * RT: CPAN's request tracker (report bugs here)
79  
80 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=MooseX-ScopedConfig>
81  
82 =item * AnnoCPAN: Annotated CPAN documentation
83  
84 L<http://annocpan.org/dist/MooseX-ScopedConfig>
85  
86 =item * CPAN Ratings
87  
88 L<http://cpanratings.perl.org/d/MooseX-ScopedConfig>
89  
90 =item * Search CPAN
91  
92 L<http://search.cpan.org/dist/MooseX-ScopedConfig/>
93  
94 =back
95  
96  
97 =head1 ACKNOWLEDGEMENTS
98  
99  
100 =head1 LICENSE AND COPYRIGHT
101  
102 Copyright 2012 brad barden.
103  
104 This program is free software; you can redistribute it and/or modify it
105 under the terms of either: the GNU General Public License as published
106 by the Free Software Foundation; or the Artistic License.
107  
108 See http://dev.perl.org/licenses/ for more information.
109  
110  
111 =cut
112  
113 3 ▶no Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
114  
115 3 1; # End of MooseX::ScopedConfig
↑ Summary