line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Hints::Base; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1079
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
4
|
1
|
|
|
1
|
|
509
|
use Hints; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
22
|
|
5
|
1
|
|
|
1
|
|
6
|
use IO::Handle; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
6
|
1
|
|
|
1
|
|
4
|
use vars qw/$VERSION @ISA/; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
135
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
$VERSION = '0.02'; |
9
|
|
|
|
|
|
|
@ISA = qw/Hints/; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Hints::Base - Perl extension for hints program storage databases |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use Hints::Base; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $hints = new Hints::Base 'program'; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
print $hints->random(); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Specialized version of Hints(3) extension. This variant can be used for |
26
|
|
|
|
|
|
|
internal program storage database of hints. Descendant contents databases, |
27
|
|
|
|
|
|
|
this module implement loading of databases from internal data storage. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 THE HINTS::BASE CLASS |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head2 init |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Loading data storage between __DATA__ and __END__ or EOF tags. Using |
34
|
|
|
|
|
|
|
default separator. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub init { |
39
|
3
|
|
|
3
|
1
|
7
|
my $obj = shift; |
40
|
3
|
|
|
|
|
6
|
my $next = shift; |
41
|
3
|
100
|
|
|
|
9
|
if ($next) { |
42
|
1
|
|
|
|
|
4
|
my $nextname = "Hints::Base::$next"; |
43
|
1
|
|
|
|
|
94
|
eval "package Hints::Base::_safe; require $nextname;"; |
44
|
1
|
50
|
|
|
|
8
|
unless ($@) { # database |
45
|
1
|
|
|
|
|
9
|
$nextname->import(); |
46
|
1
|
|
|
|
|
14
|
return $nextname->new(@_); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
2
|
|
|
|
|
5
|
my @data = (); |
50
|
2
|
|
|
|
|
5
|
my $sourcepkg = ref $obj; |
51
|
1
|
|
|
1
|
|
5
|
no strict 'refs'; |
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
36
|
|
52
|
2
|
|
|
|
|
3
|
my $fh = \*{"${sourcepkg}::DATA"}; |
|
2
|
|
|
|
|
10
|
|
53
|
1
|
|
|
1
|
|
5
|
use strict 'refs'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
92
|
|
54
|
2
|
|
|
|
|
14
|
while (<$fh>) { |
55
|
40
|
100
|
|
|
|
76
|
last if /^__END__$/; |
56
|
38
|
|
|
|
|
275
|
push @data,$_; |
57
|
|
|
|
|
|
|
} |
58
|
2
|
|
|
|
|
16
|
$obj->load_from_file(\@data); |
59
|
2
|
|
|
|
|
21
|
$obj; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
__DATA__ |