line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::Autouse::Parent; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# The package Class::Autouse::Parent can be inherited from to implement |
4
|
|
|
|
|
|
|
# a parent class. That is, a class who's primary job is to load a series |
5
|
|
|
|
|
|
|
# classes below it. |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
1084
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
40
|
|
8
|
1
|
|
|
1
|
|
27
|
use Class::Autouse (); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION; |
11
|
|
|
|
|
|
|
BEGIN { |
12
|
|
|
|
|
|
|
$VERSION = '1.99_04'; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Anti-loop protection. |
16
|
|
|
|
|
|
|
# Maintain flags for "is the class in the process of loading" |
17
|
|
|
|
|
|
|
my %LOADING = (); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub import { |
20
|
|
|
|
|
|
|
# If the parent value is ourselves, we were just |
21
|
|
|
|
|
|
|
# 'use'd, not 'base'd. |
22
|
|
|
|
|
|
|
my $parent = $_[0] ne __PACKAGE__ ? shift : return 1; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Don't load if already loading |
25
|
|
|
|
|
|
|
return 1 if $LOADING{$parent}; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Autoload in our children |
28
|
|
|
|
|
|
|
$LOADING{$parent} = 1; |
29
|
|
|
|
|
|
|
Class::Autouse->autouse_recursive($parent); |
30
|
|
|
|
|
|
|
delete $LOADING{$parent}; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
return 1; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |