File Coverage

blib/lib/AxKit2/Config/Global.pm
Criterion Covered Total %
statement 9 36 25.0
branch 0 16 0.0
condition 0 2 0.0
subroutine 3 11 27.2
pod 0 9 0.0
total 12 74 16.2


line stmt bran cond sub pod time code
1             # Copyright 2001-2006 The Apache Software Foundation
2             #
3             # Licensed under the Apache License, Version 2.0 (the "License");
4             # you may not use this file except in compliance with the License.
5             # You may obtain a copy of the License at
6             #
7             # http://www.apache.org/licenses/LICENSE-2.0
8             #
9             # Unless required by applicable law or agreed to in writing, software
10             # distributed under the License is distributed on an "AS IS" BASIS,
11             # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12             # See the License for the specific language governing permissions and
13             # limitations under the License.
14             #
15              
16             package AxKit2::Config::Global;
17              
18             # Global configuration
19              
20 9     9   51 use strict;
  9         16  
  9         282  
21 9     9   43 use warnings;
  9         17  
  9         3969  
22              
23             sub new {
24 9     9 0 24 my $class = shift;
25            
26 9         43 my %defaults = (
27             Plugins => [],
28             Notes => {},
29             );
30              
31 9         76 return bless { %defaults, @_ }, $class;
32             }
33              
34             sub docroot {
35 0     0 0   my $self = shift;
36 0 0         @_ and $self->{DocumentRoot} = shift;
37 0           $self->{DocumentRoot};
38             }
39              
40             sub console_port {
41 0     0 0   my $self = shift;
42 0 0         @_ and $self->{ConsolePort} = shift;
43 0           $self->{ConsolePort};
44             }
45              
46             sub console_addr {
47 0     0 0   my $self = shift;
48 0 0         @_ and $self->{ConsoleAddr} = shift;
49 0           $self->{ConsoleAddr};
50             }
51              
52             sub add_plugin {
53 0     0 0   my $self = shift;
54 0           push @{$self->{Plugins}}, shift;
  0            
55             }
56              
57             sub plugins {
58 0     0 0   my $self = shift;
59 0           @{$self->{Plugins}};
  0            
60             }
61              
62             sub plugin_dir {
63 0     0 0   my $self = shift;
64 0 0         @_ and $self->{PluginDir} = shift;
65 0           $self->{PluginDir};
66             }
67              
68             sub cached_hooks {
69 0     0 0   my $self = shift;
70             # never cache at the global level
71 0           return;
72             }
73              
74             sub notes {
75 0     0 0   my $self = shift;
76 0   0       my $key = shift || die "notes() requires a key";
77            
78 0 0         @_ and $self->{Notes}{$key} = [ @_ ];
79 0 0         return @{ $self->{Notes}{$key} || [] } if wantarray;
  0 0          
80 0 0         ${ $self->{Notes}{$key} || [] }[0];
  0            
81             }
82              
83             1;