line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Orze::Modules; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Orze::Modules - Dynamically load Orze modules |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Orze::Modules; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
$toto = loadSource('Toto'); |
12
|
|
|
|
|
|
|
# $toto equals Orze::Sources::Toto |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
$tata = loadDrivers('Tata'); |
15
|
|
|
|
|
|
|
# $tata equals Orze::Drivers::Tata |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
1
|
|
10
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
20
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
34
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head2 EXPORTS |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
loadSource and loadDriver |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=cut |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
BEGIN { |
29
|
1
|
|
|
1
|
|
5
|
use Exporter (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
109
|
|
30
|
1
|
|
|
1
|
|
2
|
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); |
31
|
1
|
|
|
|
|
2
|
$VERSION = 1.00; |
32
|
1
|
|
|
|
|
18
|
@ISA = qw(Exporter); |
33
|
1
|
|
|
|
|
221
|
@EXPORT = qw(loadSource loadDriver); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
our @EXPORT; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 METHODS |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 loadSource |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Load a source module. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub loadSource { |
46
|
0
|
|
|
0
|
1
|
|
my $name = shift; |
47
|
0
|
|
|
|
|
|
return load("Sources", $name); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 loadDriver |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Load a driver module. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub loadDriver { |
57
|
0
|
|
|
0
|
1
|
|
my $name = shift; |
58
|
0
|
|
|
|
|
|
return load("Drivers", $name); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 load |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
C load the module Orze::Foo::Bar. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub load { |
68
|
0
|
|
|
0
|
1
|
|
my $module = join("::", "Orze", @_); |
69
|
0
|
|
|
|
|
|
my $module_path = $module . ".pm"; |
70
|
0
|
|
|
|
|
|
$module_path =~ s!::!/!g; |
71
|
0
|
|
|
|
|
|
require $module_path; |
72
|
0
|
|
|
|
|
|
return $module; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|