line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package TL1ng; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
22556
|
use 5.008000; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
41
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
6
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
27
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
13
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
303
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.08'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
0
|
|
|
0
|
1
|
|
my ($class, $params) = @_; |
16
|
|
|
|
|
|
|
|
17
|
0
|
0
|
0
|
|
|
|
croak "Parameter list must be an anonymous hash!\n" |
18
|
|
|
|
|
|
|
if $params && ref $params ne "HASH"; |
19
|
0
|
0
|
|
|
|
|
$params = {} if ! $params; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Since this class is just an abstract factory (kinda), |
23
|
|
|
|
|
|
|
# determine the conrete TL1ng class to instantiate... |
24
|
|
|
|
|
|
|
# Use TL1ng::Base as a default if none is provided. |
25
|
0
|
0
|
|
|
|
|
my $inst_class = defined $params->{Type} |
26
|
|
|
|
|
|
|
? "${class}::" . $params->{Type} : "${class}::Base"; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Clean up parameters we've used here - anything left over will |
30
|
|
|
|
|
|
|
# be passed to the class we're instantiating. |
31
|
0
|
0
|
|
|
|
|
$params->{Type} and delete $params->{Type}; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# Instantiate the apropriate TL1 object |
35
|
0
|
0
|
|
|
|
|
eval "require $inst_class" || croak "Couldn't load $inst_class!"; |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
0
|
|
|
|
my $tl1_obj = $inst_class->new($params) |
38
|
|
|
|
|
|
|
|| return; #croak "Couldn't instantiate $inst_class!\n"; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
return $tl1_obj; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
__END__ |