| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package CGI::FormBuilder::Source::Perl; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
914
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
41
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
51
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
1024
|
use File::Slurp; |
|
|
1
|
|
|
|
|
15195
|
|
|
|
1
|
|
|
|
|
252
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
CGI::FormBuilder::Source::Perl - read FormBuilder config from Perl syntax files |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $form = CGI::FormBuilder->new( |
|
17
|
|
|
|
|
|
|
source => { |
|
18
|
|
|
|
|
|
|
type => 'Perl', |
|
19
|
|
|
|
|
|
|
source => '/path/to/form_config.pl', |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
This module allows you to specify the config for a L object |
|
26
|
|
|
|
|
|
|
using Perl syntax. The contents of the config file will be Ced and the |
|
27
|
|
|
|
|
|
|
hash ref returned will be used as the config for the object. |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=cut |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub new { |
|
32
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
33
|
0
|
|
0
|
|
|
|
my $class = ref($self) || $self; |
|
34
|
0
|
|
|
|
|
|
my %opt = @_; |
|
35
|
0
|
|
|
|
|
|
return bless \%opt, $class; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub parse { |
|
39
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
40
|
0
|
|
0
|
|
|
|
my $file = shift || $self->{source}; |
|
41
|
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
my $content = read_file($file); |
|
43
|
0
|
|
|
|
|
|
my $config = eval $content; |
|
44
|
0
|
0
|
|
|
|
|
die "ERROR in C:FB:Source::Perl config file '$file': $@" if $@; |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# FIXME - add caching and smarter checking |
|
47
|
|
|
|
|
|
|
|
|
48
|
0
|
0
|
|
|
|
|
return wantarray ? %$config : $config; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
L, L, |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 AUTHOR |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Copyright (c) 2008 Edmund von der Burg . All Rights |
|
58
|
|
|
|
|
|
|
Reserved. |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Based on the module L |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
This module is free software; you may copy this under the terms of |
|
63
|
|
|
|
|
|
|
the GNU General Public License, or the Artistic License, copies of |
|
64
|
|
|
|
|
|
|
which should have accompanied your Perl kit. |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |