line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBomb::Generator; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
DBomb::Generator - Provides routines any generator might need. |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=cut |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
12
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
13
|
|
|
|
|
|
|
our $VERSION = '$Revision: 1.4 $'; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
8
|
use Carp::Assert; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
16
|
1
|
|
|
1
|
|
118
|
use base qw(Exporter); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
253
|
|
17
|
|
|
|
|
|
|
use Class::MethodMaker |
18
|
1
|
|
|
1
|
|
6
|
'new_with_init' => 'new'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
13
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our @EXPORT_OK = qw(gen_accessor); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
## subroutine -- not a method! |
24
|
|
|
|
|
|
|
## gen_accessor($pkg, $sub_name) |
25
|
|
|
|
|
|
|
## gen_accessor($pkg, $sub_name, $attr_name) |
26
|
|
|
|
|
|
|
sub gen_accessor |
27
|
|
|
|
|
|
|
{ |
28
|
0
|
|
|
0
|
0
|
|
my ($pkg, $sub_name, $attr_name) = @_; |
29
|
0
|
|
0
|
|
|
|
assert(2 <= @_ && @_ <= 3 && defined($pkg) && defined($sub_name), 'valid parameters'); |
30
|
0
|
0
|
|
|
|
|
$attr_name = $sub_name if not defined $attr_name; |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
1
|
|
7528
|
no strict 'refs'; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
143
|
|
33
|
0
|
|
|
|
|
|
*{$pkg . "::" . $sub_name} = sub { |
34
|
0
|
0
|
|
0
|
|
|
$_[0]->{$attr_name} = $_[1] if @_ > 1; |
35
|
0
|
|
|
|
|
|
$_[0]->{$attr_name} |
36
|
0
|
|
|
|
|
|
}; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
__END__ |