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
|
|
117321
|
use strict; |
|
27
|
|
|
|
|
32
|
|
|
27
|
|
|
|
|
583
|
|
17
|
27
|
|
|
27
|
|
80
|
use warnings; |
|
27
|
|
|
|
|
22
|
|
|
27
|
|
|
|
|
620
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
package Clownfish; |
20
|
|
|
|
|
|
|
|
21
|
27
|
|
|
27
|
|
439
|
use 5.008003; |
|
27
|
|
|
|
|
57
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = '0.006000_001'; |
24
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
25
|
|
|
|
|
|
|
our $MAJOR_VERSION = 0.006000; |
26
|
|
|
|
|
|
|
|
27
|
27
|
|
|
27
|
|
91
|
use Exporter 'import'; |
|
27
|
|
|
|
|
28
|
|
|
27
|
|
|
|
|
1035
|
|
28
|
|
|
|
|
|
|
BEGIN { |
29
|
27
|
|
|
27
|
|
1302
|
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
|
27944
|
sub dl_load_flags { 1 } |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
BEGIN { |
38
|
27
|
|
|
27
|
|
95
|
require DynaLoader; |
39
|
27
|
|
|
|
|
184
|
our @ISA = qw( DynaLoader ); |
40
|
|
|
|
|
|
|
# This loads a large number of disparate subs. |
41
|
27
|
|
|
|
|
2269
|
bootstrap Clownfish '0.6.0_1'; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
0
|
0
|
0
|
sub error {$Clownfish::Err::error} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
{ |
47
|
|
|
|
|
|
|
package Clownfish::Obj; |
48
|
|
|
|
|
|
|
our $VERSION = '0.006000_001'; |
49
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
50
|
27
|
|
|
27
|
|
127
|
use Carp qw( confess ); |
|
27
|
|
|
|
|
28
|
|
|
27
|
|
|
|
|
4551
|
|
51
|
|
|
|
|
|
|
# Clownfish objects are not thread-safe. |
52
|
0
|
|
|
0
|
|
0
|
sub CLONE_SKIP { 1; } |
53
|
|
|
|
|
|
|
sub STORABLE_freeze { |
54
|
1
|
|
|
1
|
0
|
387
|
my $class_name = ref(shift); |
55
|
1
|
|
|
|
|
152
|
confess("Storable serialization not implemented for $class_name"); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
sub STORABLE_thaw { |
58
|
1
|
|
|
1
|
0
|
783
|
my $class_name = ref(shift); |
59
|
1
|
|
|
|
|
89
|
confess("Storable serialization not implemented for $class_name"); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
{ |
64
|
|
|
|
|
|
|
package Clownfish::Class; |
65
|
|
|
|
|
|
|
our $VERSION = '0.006000_001'; |
66
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub _find_parent_class { |
69
|
8
|
|
|
8
|
|
4335
|
my $package = shift; |
70
|
27
|
|
|
27
|
|
119
|
no strict 'refs'; |
|
27
|
|
|
|
|
37
|
|
|
27
|
|
|
|
|
1944
|
|
71
|
8
|
|
|
|
|
9
|
for my $parent ( @{"$package\::ISA"} ) { |
|
8
|
|
|
|
|
36
|
|
72
|
8
|
50
|
|
|
|
99
|
return $parent if $parent->isa('Clownfish::Obj'); |
73
|
|
|
|
|
|
|
} |
74
|
0
|
|
|
|
|
0
|
return; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub _fresh_host_methods { |
78
|
10
|
|
|
10
|
|
1659
|
my $package = shift; |
79
|
27
|
|
|
27
|
|
89
|
no strict 'refs'; |
|
27
|
|
|
|
|
34
|
|
|
27
|
|
|
|
|
3326
|
|
80
|
10
|
|
|
|
|
10
|
my $stash = \%{"$package\::"}; |
|
10
|
|
|
|
|
37
|
|
81
|
10
|
|
|
|
|
79
|
my $methods |
82
|
|
|
|
|
|
|
= Clownfish::Vector->new( capacity => scalar keys %$stash ); |
83
|
10
|
|
|
|
|
45
|
while ( my ( $symbol, $glob ) = each %$stash ) { |
84
|
42
|
50
|
|
|
|
54
|
next if ref $glob; |
85
|
42
|
100
|
|
|
|
135
|
next unless *$glob{CODE}; |
86
|
6
|
|
|
|
|
56
|
$methods->push( Clownfish::String->new($symbol) ); |
87
|
|
|
|
|
|
|
} |
88
|
10
|
|
|
|
|
149
|
return $methods; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub _register { |
92
|
9
|
|
|
9
|
|
12
|
my ( $singleton, $parent ) = @_; |
93
|
9
|
|
|
|
|
40
|
my $singleton_class = $singleton->get_name; |
94
|
9
|
|
|
|
|
21
|
my $parent_class = $parent->get_name; |
95
|
9
|
100
|
|
|
|
87
|
if ( !$singleton_class->isa($parent_class) ) { |
96
|
27
|
|
|
27
|
|
195
|
no strict 'refs'; |
|
27
|
|
|
|
|
81
|
|
|
27
|
|
|
|
|
1322
|
|
97
|
2
|
|
|
|
|
3
|
push @{"$singleton_class\::ISA"}, $parent_class; |
|
2
|
|
|
|
|
2355
|
|
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
27
|
|
|
27
|
|
87
|
no warnings 'redefine'; |
|
27
|
|
|
|
|
25
|
|
|
27
|
|
|
|
|
1864
|
|
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_001'; |
109
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
110
|
27
|
|
|
27
|
|
96
|
no warnings 'redefine'; |
|
27
|
|
|
|
|
25
|
|
|
27
|
|
|
|
|
2146
|
|
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_001'; |
118
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
119
|
66
|
|
|
66
|
0
|
187681
|
sub do_to_string { shift->to_string } |
120
|
27
|
|
|
27
|
|
108
|
use Scalar::Util qw( blessed ); |
|
27
|
|
|
|
|
35
|
|
|
27
|
|
|
|
|
2071
|
|
121
|
27
|
|
|
27
|
|
88
|
use Carp qw( confess longmess ); |
|
27
|
|
|
|
|
31
|
|
|
27
|
|
|
|
|
1326
|
|
122
|
|
|
|
|
|
|
use overload |
123
|
27
|
|
|
|
|
155
|
'""' => \&do_to_string, |
124
|
27
|
|
|
27
|
|
23897
|
fallback => 1; |
|
27
|
|
|
|
|
18723
|
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub new { |
127
|
7
|
|
|
7
|
1
|
660
|
my ( $either, $message ) = @_; |
128
|
7
|
|
|
|
|
19
|
my ( undef, $file, $line ) = caller; |
129
|
7
|
|
|
|
|
13
|
$message .= ", $file line $line\n"; |
130
|
7
|
|
|
|
|
140
|
return $either->_new( mess => Clownfish::String->new($message) ); |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub do_throw { |
134
|
59
|
|
|
59
|
0
|
15104
|
my $err = shift; |
135
|
59
|
|
|
|
|
3917
|
my $longmess = longmess(); |
136
|
59
|
|
|
|
|
4296
|
$longmess =~ s/^\s*/\t/; |
137
|
59
|
|
|
|
|
301
|
$err->cat_mess($longmess); |
138
|
59
|
|
|
|
|
559
|
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_001'; |
157
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
158
|
27
|
|
|
27
|
|
6351
|
use Exporter 'import'; |
|
27
|
|
|
|
|
29
|
|
|
27
|
|
|
|
|
1804
|
|
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
|
|
|
|
|
|
|
|