line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Car::Factory; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
27675
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
78
|
|
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
853
|
use Class::Interface; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
162
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
&extends('Car::AbstractFactory'); |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
736
|
use Car::Fiat; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
8
|
|
10
|
2
|
|
|
2
|
|
726
|
use Car::Ford; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
9
|
|
11
|
2
|
|
|
2
|
|
810
|
use Car::Mercedes; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
10
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# not using Car::BMW - it requires Class::AccessorMaker which you may |
14
|
|
|
|
|
|
|
# not have. |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
17
|
1
|
|
33
|
1
|
0
|
709
|
return bless( {}, ref( $_[0] ) || $_[0] ); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub createCar { |
21
|
1
|
|
|
1
|
0
|
1683
|
my ( $self, $car ) = @_; |
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
|
|
1
|
my $created; |
24
|
1
|
50
|
|
|
|
7
|
if ( lc($car) eq "fiat" ) { |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
25
|
0
|
|
|
|
|
0
|
$created = Car::Fiat->new(); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
} elsif ( lc($car) eq "ford" ) { |
28
|
1
|
|
|
|
|
6
|
$created = Car::Ford->new(); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
} elsif ( lc($car) eq "mercedes" ) { |
31
|
0
|
|
|
|
|
0
|
$created = Car::Mercedes->new(); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
} elsif ( lc($car) eq "bmw" ) { |
34
|
0
|
|
|
|
|
0
|
eval qq{ use Car::BMW }; |
35
|
0
|
0
|
|
|
|
0
|
$created = Car::BMW->new() unless $@; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
} else { |
38
|
0
|
|
|
|
|
0
|
die "Cannot build cars of type $car (yet)"; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
|
|
8
|
$self->rememberCreatedCar($car); |
42
|
|
|
|
|
|
|
|
43
|
1
|
|
|
|
|
4
|
return $created; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |