| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# misc util functions |
|
2
|
|
|
|
|
|
|
# |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Perlbal::Util; |
|
5
|
22
|
|
|
22
|
|
133
|
use strict; |
|
|
22
|
|
|
|
|
47
|
|
|
|
22
|
|
|
|
|
746
|
|
|
6
|
22
|
|
|
22
|
|
120
|
use warnings; |
|
|
22
|
|
|
|
|
50
|
|
|
|
22
|
|
|
|
|
751
|
|
|
7
|
22
|
|
|
22
|
|
627
|
no warnings qw(deprecated); |
|
|
22
|
|
|
|
|
46
|
|
|
|
22
|
|
|
|
|
7220
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub durl { |
|
10
|
46
|
|
|
46
|
0
|
94
|
my ($txt) = @_; |
|
11
|
46
|
|
|
|
|
437
|
$txt =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; |
|
|
0
|
|
|
|
|
0
|
|
|
12
|
46
|
|
|
|
|
148
|
return $txt; |
|
13
|
|
|
|
|
|
|
} |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head2 C< rebless > |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Safely re-bless a locked (use fields) hash into another package. Note |
|
18
|
|
|
|
|
|
|
that for our convenience elsewhere the set of allowable keys for the |
|
19
|
|
|
|
|
|
|
re-blessed hash will be the union of the keys allowed by its old package |
|
20
|
|
|
|
|
|
|
and those allowed for the package into which it is blessed. |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
BEGIN { |
|
25
|
22
|
50
|
|
22
|
|
213
|
if ($] >= 5.010) { |
|
26
|
22
|
|
|
22
|
|
1767
|
eval q{ |
|
|
22
|
|
|
|
|
26463
|
|
|
|
22
|
|
|
|
|
118070
|
|
|
|
22
|
|
|
|
|
184
|
|
|
27
|
|
|
|
|
|
|
use Hash::Util qw(legal_ref_keys unlock_ref_keys lock_ref_keys) |
|
28
|
|
|
|
|
|
|
}; |
|
29
|
|
|
|
|
|
|
*rebless = sub { |
|
30
|
150
|
|
|
150
|
|
701
|
my ($obj, $pkg) = @_; |
|
31
|
150
|
|
|
|
|
7505
|
my @keys = legal_ref_keys($obj); |
|
32
|
150
|
|
|
|
|
1552
|
unlock_ref_keys($obj); |
|
33
|
150
|
|
|
|
|
2467
|
bless $obj, $pkg; |
|
34
|
150
|
|
|
|
|
697
|
lock_ref_keys($obj, @keys, |
|
35
|
|
|
|
|
|
|
legal_ref_keys(fields::new($pkg))); |
|
36
|
150
|
|
|
|
|
326215
|
return $obj; |
|
37
|
22
|
|
|
|
|
2903
|
}; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
else { |
|
40
|
|
|
|
|
|
|
*rebless = sub { |
|
41
|
0
|
|
|
|
|
0
|
my ($obj, $pkg) = @_; |
|
42
|
0
|
|
|
|
|
0
|
return bless $obj, $pkg; |
|
43
|
0
|
|
|
|
|
0
|
}; |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# Local Variables: |
|
50
|
|
|
|
|
|
|
# mode: perl |
|
51
|
|
|
|
|
|
|
# c-basic-indent: 4 |
|
52
|
|
|
|
|
|
|
# indent-tabs-mode: nil |
|
53
|
|
|
|
|
|
|
# End: |