SysParams/RolesFor/Schema.pm

filter: Statementstmt 64.2% 9 / 14 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 2 / 4 Podpod 100% 1 / 1 totaltotal 63.1% 12 / 19 CC 1 SCAR 4.1
CC
1
Cov
64%
_build_sys_params
2.0
setup_sysparams
2.0
BEGIN
1.0
CRAP 1.5
« SysParams/Schema/ResultSet/SysInfo.pm ↑ Summary SysParams.pm »
1 package OpusVL::SysParams::RolesFor::Schema;
2  
3 1 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use OpusVL::SysParams;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 requires 'load_namespaces';
7  
8  
9 1 has sys_params => (isa => 'OpusVL::SysParams', is => 'rw', lazy_build => 1);
10  
11 sub _build_sys_params
12 {
13 0 ▶ my $self = shift;
Subroutine _build_sys_params: not called CC=1 SCAR=6.9
14 0 return OpusVL::SysParams->new({ schema => $self });
15 }
16  
17  
18 # FIXME: point it to our schema stuff.
19 sub setup_sysparams
20 {
21 0 ▶ my $class = shift;
Subroutine setup_sysparams: not called CC=1 SCAR=6.9
Pod documented
22 0 my $package = shift;
23 0 $package->load_namespaces(
24 result_namespace => '+OpusVL::SysParams::Schema::Result',
25 resultset_namespace => '+OpusVL::SysParams::Schema::ResultSet',
26 );
27 }
28  
29  
30 1 1;
31  
32 __END__
33  
34 =pod
35  
36 =encoding UTF-8
37  
38 =head1 NAME
39  
40 OpusVL::SysParams::RolesFor::Schema
41  
42 =head1 VERSION
43  
44 version 0.18
45  
46 =head1 SYNOPSIS
47  
48 This allows for our logging to be inserted into an existing schema and make use of the existing
49 connection details. The class actually injects our schema objects into the existing schema and
50 adds a 'sys_params' object to the schema.
51  
52 # in your schema class.
53 with 'OpusVL::SysParams::RolesFor::Schema';
54 OpusVL::SysParams::RolesFor::Schema->setup_sysparams(__PACKAGE__);
55  
56 # now anywhere that has access to the schema can access the
57 # sys_params object.
58 $schema->sys_params->get('param.name');
59  
60 =head1 METHODS
61  
62 =head2 sys_params
63  
64 The OpusVL::SysParams object connected via your schema.
65  
66 =head2 setup_sysparams
67  
68 This method injects the result/resultset objects needed by the SysParams object into a the schema
69 this role has been applied to. If this isn't called as suggested in the synopsis you will need to
70 have these results already loaded in your schema somehow.
71  
72 =head1 AUTHOR
73  
74 OpusVL - www.opusvl.com
75  
76 =head1 COPYRIGHT AND LICENSE
77  
78 This software is copyright (c) 2011 - 2016 by OpusVL - www.opusvl.com.
79  
80 This is free software; you can redistribute it and/or modify it under
81 the same terms as the Perl 5 programming language system itself.
82  
83 =cut
« SysParams/Schema/ResultSet/SysInfo.pm ↑ Summary SysParams.pm »