| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#============================================================= -*-Perl-*- |
|
2
|
|
|
|
|
|
|
# |
|
3
|
|
|
|
|
|
|
# Template::Plugin::Config::General |
|
4
|
|
|
|
|
|
|
# |
|
5
|
|
|
|
|
|
|
# DESCRIPTION |
|
6
|
|
|
|
|
|
|
# Wrapper around Config::General module |
|
7
|
|
|
|
|
|
|
# |
|
8
|
|
|
|
|
|
|
# AUTHOR |
|
9
|
|
|
|
|
|
|
# Igor Lobanov |
|
10
|
|
|
|
|
|
|
# http://www.template-toolkit.ru/ |
|
11
|
|
|
|
|
|
|
# |
|
12
|
|
|
|
|
|
|
# COPYRIGHT |
|
13
|
|
|
|
|
|
|
# Copyright (C) 2005 Igor Lobanov. All Rights Reserved. |
|
14
|
|
|
|
|
|
|
# |
|
15
|
|
|
|
|
|
|
# This module is free software; you can redistribute it and/or |
|
16
|
|
|
|
|
|
|
# modify it under the same terms as Perl itself. |
|
17
|
|
|
|
|
|
|
# |
|
18
|
|
|
|
|
|
|
#============================================================================ |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
package Template::Plugin::Config::General; |
|
21
|
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
24945
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
36
|
|
|
23
|
1
|
|
|
1
|
|
4
|
use vars qw( $VERSION ); |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
58
|
|
|
24
|
1
|
|
|
1
|
|
827
|
use Template::Plugin; |
|
|
1
|
|
|
|
|
7055
|
|
|
|
1
|
|
|
|
|
29
|
|
|
25
|
1
|
|
|
1
|
|
9
|
use base qw( Template::Plugin ); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
70
|
|
|
26
|
1
|
|
|
1
|
|
824
|
use Template::Exception; |
|
|
1
|
|
|
|
|
3563
|
|
|
|
1
|
|
|
|
|
29
|
|
|
27
|
1
|
|
|
1
|
|
1125
|
use Config::General; |
|
|
1
|
|
|
|
|
45301
|
|
|
|
1
|
|
|
|
|
349
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
$VERSION = sprintf("%d.%02d", q$Revision: 0.01 $ =~ /(\d+)\.(\d+)/); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $EXCEPTION_TYPE = 'ConfigGeneral'; |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub new { |
|
34
|
0
|
|
|
0
|
1
|
|
my ( $class, $context, $options ) = @_; |
|
35
|
0
|
|
0
|
|
|
|
$options ||= {}; |
|
36
|
|
|
|
|
|
|
# in template we use parameters without leading - |
|
37
|
0
|
0
|
|
|
|
|
map { $options->{'-' . $_} = $options->{$_} unless ( /^-/ ); } keys %$options; |
|
|
0
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my $obj; |
|
39
|
0
|
|
|
|
|
|
eval '$obj = new Config::General( %$options )'; |
|
40
|
0
|
0
|
|
|
|
|
$@ and die ( Template::Exception->new( $EXCEPTION_TYPE, $@ ) ); |
|
41
|
0
|
|
|
|
|
|
bless { |
|
42
|
|
|
|
|
|
|
_CONTEXT => $context, |
|
43
|
|
|
|
|
|
|
_OBJ => $obj, |
|
44
|
|
|
|
|
|
|
_OPTIONS => $options, |
|
45
|
|
|
|
|
|
|
}, $class; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub getall { |
|
49
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
50
|
0
|
|
|
|
|
|
my %hash = $self->{_OBJ}->getall(); |
|
51
|
0
|
|
|
|
|
|
return \%hash; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__END__ |