line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Hub::Parse::FileParser; |
2
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
36
|
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use Hub qw/:lib/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
push our @ISA, qw/Hub::Parse::StandardParser/; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '4.00043'; |
9
|
|
|
|
|
|
|
our @EXPORT = qw//; |
10
|
|
|
|
|
|
|
our @EXPORT_OK = qw//; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------ |
13
|
|
|
|
|
|
|
# new - Construct (or retrieve) an instance of this class. |
14
|
|
|
|
|
|
|
# new $filespec |
15
|
|
|
|
|
|
|
# |
16
|
|
|
|
|
|
|
# This is a singleton per physical file. |
17
|
|
|
|
|
|
|
# $filespec is an absolute path or a relative runtime path. |
18
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------ |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
21
|
0
|
|
|
0
|
1
|
|
my ($opts,$self,$spec) = Hub::opts( \@_ ); |
22
|
0
|
|
0
|
|
|
|
my $class = ref( $self ) || $self; |
23
|
0
|
0
|
|
|
|
|
croak 'File spec required' unless $spec; |
24
|
0
|
0
|
|
|
|
|
my $fn = Hub::srcpath( $spec ) or croak "$!: $spec"; |
25
|
0
|
|
|
|
|
|
my $obj = Hub::fhandler( $fn, $class ); |
26
|
0
|
0
|
|
|
|
|
unless( $obj ) { |
27
|
0
|
|
|
|
|
|
$obj = $self->SUPER::new( -opts => $opts ); |
28
|
0
|
|
|
|
|
|
Hub::fattach( $fn, $obj ); |
29
|
|
|
|
|
|
|
} |
30
|
0
|
|
|
|
|
|
return $obj; |
31
|
|
|
|
|
|
|
}#new |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------ |
34
|
|
|
|
|
|
|
# reload - Callback from L |
35
|
|
|
|
|
|
|
# Called when instantiating the first instance or the file has changed on disk. |
36
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------ |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub reload { |
39
|
0
|
|
|
0
|
1
|
|
my ($self,$opts,$file) = Hub::objopts(\@_); |
40
|
0
|
|
|
|
|
|
$self->{'template'} = \$file->{'contents'}; |
41
|
|
|
|
|
|
|
}#reload |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |