line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBomb::Util; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
DBomb::Util - Miscellany with no place else to go. |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=cut |
10
|
|
|
|
|
|
|
|
11
|
12
|
|
|
12
|
|
82
|
use strict; |
|
12
|
|
|
|
|
24
|
|
|
12
|
|
|
|
|
470
|
|
12
|
12
|
|
|
12
|
|
61
|
use warnings; |
|
12
|
|
|
|
|
24
|
|
|
12
|
|
|
|
|
708
|
|
13
|
|
|
|
|
|
|
our $VERSION = '$Revision: 1.4 $'; |
14
|
|
|
|
|
|
|
|
15
|
12
|
|
|
12
|
|
63
|
use base qw(Exporter); |
|
12
|
|
|
|
|
22
|
|
|
12
|
|
|
|
|
3931
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( all => [qw{ |
18
|
|
|
|
|
|
|
ctx_0 is_same_value |
19
|
|
|
|
|
|
|
}]); |
20
|
|
|
|
|
|
|
Exporter::export_ok_tags('all'); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
## returns @args if caller's caller is in list context, or $args[0] otherwise |
23
|
|
|
|
|
|
|
## ctx_0(@args) |
24
|
|
|
|
|
|
|
sub ctx_0 |
25
|
|
|
|
|
|
|
{ |
26
|
0
|
0
|
|
0
|
0
|
|
(caller(1))[5] ? @_ : $_[0]; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
## like cmp but allows undef |
30
|
|
|
|
|
|
|
sub is_same_value |
31
|
|
|
|
|
|
|
{ |
32
|
0
|
|
|
0
|
0
|
|
my ($a,$b) = @_; |
33
|
|
|
|
|
|
|
## True if they are equal or if both undef |
34
|
0
|
|
0
|
|
|
|
return ((defined($a) && defined($b) && $a eq $b) |
35
|
|
|
|
|
|
|
|| (!defined($a) && !defined($b))); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
__END__ |