line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more |
2
|
|
|
|
|
|
|
# contributor license agreements. See the NOTICE file distributed with |
3
|
|
|
|
|
|
|
# this work for additional information regarding copyright ownership. |
4
|
|
|
|
|
|
|
# The ASF licenses this file to You under the Apache License, Version 2.0 |
5
|
|
|
|
|
|
|
# (the "License"); you may not use this file except in compliance with |
6
|
|
|
|
|
|
|
# the License. You may obtain a copy of the License at |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0 |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
# Unless required by applicable law or agreed to in writing, software |
11
|
|
|
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, |
12
|
|
|
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13
|
|
|
|
|
|
|
# See the License for the specific language governing permissions and |
14
|
|
|
|
|
|
|
# limitations under the License. |
15
|
|
|
|
|
|
|
|
16
|
27
|
|
|
27
|
|
120377
|
use strict; |
|
27
|
|
|
|
|
31
|
|
|
27
|
|
|
|
|
623
|
|
17
|
27
|
|
|
27
|
|
80
|
use warnings; |
|
27
|
|
|
|
|
32
|
|
|
27
|
|
|
|
|
633
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
package Clownfish; |
20
|
|
|
|
|
|
|
|
21
|
27
|
|
|
27
|
|
470
|
use 5.008003; |
|
27
|
|
|
|
|
54
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = '0.006000_002'; |
24
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
25
|
|
|
|
|
|
|
our $MAJOR_VERSION = 0.006000; |
26
|
|
|
|
|
|
|
|
27
|
27
|
|
|
27
|
|
88
|
use Exporter 'import'; |
|
27
|
|
|
|
|
27
|
|
|
27
|
|
|
|
|
1018
|
|
28
|
|
|
|
|
|
|
BEGIN { |
29
|
27
|
|
|
27
|
|
1378
|
our @EXPORT_OK = qw( to_clownfish ); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# On most UNIX variants, this flag makes DynaLoader pass RTLD_GLOBAL to |
33
|
|
|
|
|
|
|
# dl_open, so extensions can resolve the needed symbols without explicitly |
34
|
|
|
|
|
|
|
# linking against the DSO. |
35
|
27
|
|
|
27
|
1
|
28659
|
sub dl_load_flags { 1 } |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
BEGIN { |
38
|
27
|
|
|
27
|
|
94
|
require DynaLoader; |
39
|
27
|
|
|
|
|
174
|
our @ISA = qw( DynaLoader ); |
40
|
|
|
|
|
|
|
# This loads a large number of disparate subs. |
41
|
27
|
|
|
|
|
2256
|
bootstrap Clownfish '0.6.0_2'; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
0
|
0
|
0
|
sub error {$Clownfish::Err::error} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
{ |
47
|
|
|
|
|
|
|
package Clownfish::Obj; |
48
|
|
|
|
|
|
|
our $VERSION = '0.006000_002'; |
49
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
50
|
27
|
|
|
27
|
|
125
|
use Carp qw( confess ); |
|
27
|
|
|
|
|
28
|
|
|
27
|
|
|
|
|
4441
|
|
51
|
|
|
|
|
|
|
# Clownfish objects are not thread-safe. |
52
|
0
|
|
|
0
|
|
0
|
sub CLONE_SKIP { 1; } |
53
|
|
|
|
|
|
|
sub STORABLE_freeze { |
54
|
1
|
|
|
1
|
0
|
282
|
my $class_name = ref(shift); |
55
|
1
|
|
|
|
|
150
|
confess("Storable serialization not implemented for $class_name"); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
sub STORABLE_thaw { |
58
|
1
|
|
|
1
|
0
|
641
|
my $class_name = ref(shift); |
59
|
1
|
|
|
|
|
85
|
confess("Storable serialization not implemented for $class_name"); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
{ |
64
|
|
|
|
|
|
|
package Clownfish::Class; |
65
|
|
|
|
|
|
|
our $VERSION = '0.006000_002'; |
66
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub _find_parent_class { |
69
|
8
|
|
|
8
|
|
2627
|
my $package = shift; |
70
|
27
|
|
|
27
|
|
135
|
no strict 'refs'; |
|
27
|
|
|
|
|
36
|
|
|
27
|
|
|
|
|
2043
|
|
71
|
8
|
|
|
|
|
10
|
for my $parent ( @{"$package\::ISA"} ) { |
|
8
|
|
|
|
|
39
|
|
72
|
8
|
50
|
|
|
|
106
|
return $parent if $parent->isa('Clownfish::Obj'); |
73
|
|
|
|
|
|
|
} |
74
|
0
|
|
|
|
|
0
|
return; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub _fresh_host_methods { |
78
|
10
|
|
|
10
|
|
1147
|
my $package = shift; |
79
|
27
|
|
|
27
|
|
99
|
no strict 'refs'; |
|
27
|
|
|
|
|
31
|
|
|
27
|
|
|
|
|
3182
|
|
80
|
10
|
|
|
|
|
10
|
my $stash = \%{"$package\::"}; |
|
10
|
|
|
|
|
35
|
|
81
|
10
|
|
|
|
|
85
|
my $methods |
82
|
|
|
|
|
|
|
= Clownfish::Vector->new( capacity => scalar keys %$stash ); |
83
|
10
|
|
|
|
|
47
|
while ( my ( $symbol, $glob ) = each %$stash ) { |
84
|
42
|
50
|
|
|
|
58
|
next if ref $glob; |
85
|
42
|
100
|
|
|
|
139
|
next unless *$glob{CODE}; |
86
|
6
|
|
|
|
|
72
|
$methods->push( Clownfish::String->new($symbol) ); |
87
|
|
|
|
|
|
|
} |
88
|
10
|
|
|
|
|
155
|
return $methods; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub _register { |
92
|
9
|
|
|
9
|
|
13
|
my ( $singleton, $parent ) = @_; |
93
|
9
|
|
|
|
|
40
|
my $singleton_class = $singleton->get_name; |
94
|
9
|
|
|
|
|
22
|
my $parent_class = $parent->get_name; |
95
|
9
|
100
|
|
|
|
91
|
if ( !$singleton_class->isa($parent_class) ) { |
96
|
27
|
|
|
27
|
|
201
|
no strict 'refs'; |
|
27
|
|
|
|
|
83
|
|
|
27
|
|
|
|
|
1315
|
|
97
|
2
|
|
|
|
|
3
|
push @{"$singleton_class\::ISA"}, $parent_class; |
|
2
|
|
|
|
|
118
|
|
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
27
|
|
|
27
|
|
85
|
no warnings 'redefine'; |
|
27
|
|
|
|
|
25
|
|
|
27
|
|
|
|
|
1766
|
|
102
|
0
|
|
|
0
|
|
0
|
sub CLONE_SKIP { 0; } |
103
|
|
|
|
0
|
|
|
sub DESTROY { } # leak all |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
{ |
107
|
|
|
|
|
|
|
package Clownfish::Method; |
108
|
|
|
|
|
|
|
our $VERSION = '0.006000_002'; |
109
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
110
|
27
|
|
|
27
|
|
95
|
no warnings 'redefine'; |
|
27
|
|
|
|
|
21
|
|
|
27
|
|
|
|
|
2062
|
|
111
|
0
|
|
|
0
|
|
0
|
sub CLONE_SKIP { 0; } |
112
|
|
|
|
0
|
|
|
sub DESTROY { } # leak all |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
{ |
116
|
|
|
|
|
|
|
package Clownfish::Err; |
117
|
|
|
|
|
|
|
our $VERSION = '0.006000_002'; |
118
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
119
|
66
|
|
|
66
|
0
|
163088
|
sub do_to_string { shift->to_string } |
120
|
27
|
|
|
27
|
|
111
|
use Scalar::Util qw( blessed ); |
|
27
|
|
|
|
|
37
|
|
|
27
|
|
|
|
|
2015
|
|
121
|
27
|
|
|
27
|
|
93
|
use Carp qw( confess longmess ); |
|
27
|
|
|
|
|
28
|
|
|
27
|
|
|
|
|
1328
|
|
122
|
|
|
|
|
|
|
use overload |
123
|
27
|
|
|
|
|
133
|
'""' => \&do_to_string, |
124
|
27
|
|
|
27
|
|
24279
|
fallback => 1; |
|
27
|
|
|
|
|
19237
|
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub new { |
127
|
7
|
|
|
7
|
1
|
420
|
my ( $either, $message ) = @_; |
128
|
7
|
|
|
|
|
14
|
my ( undef, $file, $line ) = caller; |
129
|
7
|
|
|
|
|
14
|
$message .= ", $file line $line\n"; |
130
|
7
|
|
|
|
|
132
|
return $either->_new( mess => Clownfish::String->new($message) ); |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub do_throw { |
134
|
59
|
|
|
59
|
0
|
10858
|
my $err = shift; |
135
|
59
|
|
|
|
|
3742
|
my $longmess = longmess(); |
136
|
59
|
|
|
|
|
4116
|
$longmess =~ s/^\s*/\t/; |
137
|
59
|
|
|
|
|
295
|
$err->cat_mess($longmess); |
138
|
59
|
|
|
|
|
535
|
die $err; |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
our $error; |
142
|
|
|
|
|
|
|
sub set_error { |
143
|
0
|
|
|
0
|
0
|
|
my $val = $_[1]; |
144
|
0
|
0
|
|
|
|
|
if ( defined $val ) { |
145
|
0
|
0
|
0
|
|
|
|
confess("Not a Clownfish::Err") |
146
|
|
|
|
|
|
|
unless ( blessed($val) |
147
|
|
|
|
|
|
|
&& $val->isa("Clownfish::Err") ); |
148
|
|
|
|
|
|
|
} |
149
|
0
|
|
|
|
|
|
$error = $val; |
150
|
|
|
|
|
|
|
} |
151
|
0
|
|
|
0
|
0
|
|
sub get_error {$error} |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
{ |
155
|
|
|
|
|
|
|
package Clownfish::Boolean; |
156
|
|
|
|
|
|
|
our $VERSION = '0.006000_002'; |
157
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
158
|
27
|
|
|
27
|
|
6276
|
use Exporter 'import'; |
|
27
|
|
|
|
|
33
|
|
|
27
|
|
|
|
|
1760
|
|
159
|
|
|
|
|
|
|
our @EXPORT_OK = qw( $true_singleton $false_singleton ); |
160
|
|
|
|
|
|
|
our $true_singleton = Clownfish::Boolean->singleton(1); |
161
|
|
|
|
|
|
|
our $false_singleton = Clownfish::Boolean->singleton(0); |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
1; |
165
|
|
|
|
|
|
|
|