| 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 | package Clownfish::Build::Binding; | ||
| 16 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 18 | |||
| 19 | 1 | our $VERSION = '0.008000'; | |
| 20 | 1 | $VERSION = eval $VERSION; | |
| 21 | |||
| 22 | 1 | ▶ | sub bind_all { |
|
Subroutine
bind_all: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 23 | 1 | my $class = shift; | |
| 24 | 1 | $class->bind_clownfish; | |
| 25 | 1 | $class->bind_test; | |
| 26 | 1 | $class->bind_test_host; | |
| 27 | 1 | $class->bind_blob; | |
| 28 | 1 | $class->bind_boolean; | |
| 29 | 1 | $class->bind_bytebuf; | |
| 30 | 1 | $class->bind_charbuf; | |
| 31 | 1 | $class->bind_string; | |
| 32 | 1 | $class->bind_stringiterator; | |
| 33 | 1 | $class->bind_err; | |
| 34 | 1 | $class->bind_hash; | |
| 35 | 1 | $class->bind_hashiterator; | |
| 36 | 1 | $class->bind_float; | |
| 37 | 1 | $class->bind_integer; | |
| 38 | 1 | $class->bind_obj; | |
| 39 | 1 | $class->bind_vector; | |
| 40 | 1 | $class->bind_class; | |
| 41 | } | ||
| 42 | |||
| 43 | 1 | ▶ | sub bind_clownfish { |
|
Subroutine
bind_clownfish: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 44 | 1 | my $xs_code = <<'END_XS_CODE'; | |
| 45 | MODULE = Clownfish PACKAGE = Clownfish | ||
| 46 | |||
| 47 | SV* | ||
| 48 | to_clownfish(sv) | ||
| 49 | SV *sv; | ||
| 50 | CODE: | ||
| 51 | { | ||
| 52 | cfish_Obj *obj = XSBind_perl_to_cfish_nullable(aTHX_ sv, CFISH_OBJ); | ||
| 53 | RETVAL = CFISH_OBJ_TO_SV_NOINC(obj); | ||
| 54 | } | ||
| 55 | OUTPUT: RETVAL | ||
| 56 | END_XS_CODE | ||
| 57 | |||
| 58 | 1 | my $binding = Clownfish::CFC::Binding::Perl::Class->new( | |
| 59 | parcel => "Clownfish", | ||
| 60 | class_name => "Clownfish", | ||
| 61 | ); | ||
| 62 | 1 | $binding->append_xs($xs_code); | |
| 63 | |||
| 64 | 1 | Clownfish::CFC::Binding::Perl::Class->register($binding); | |
| 65 | } | ||
| 66 | |||
| 67 | 1 | ▶ | sub bind_test { |
|
Subroutine
bind_test: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 68 | 1 | my $xs_code = <<'END_XS_CODE'; | |
| 69 | MODULE = Clownfish::Test PACKAGE = Clownfish::Test | ||
| 70 | |||
| 71 | SV* | ||
| 72 | create_test_suite() | ||
| 73 | CODE: | ||
| 74 | cfish_TestSuite *suite = testcfish_Test_create_test_suite(); | ||
| 75 | RETVAL = CFISH_OBJ_TO_SV_NOINC(suite); | ||
| 76 | OUTPUT: RETVAL | ||
| 77 | |||
| 78 | void | ||
| 79 | invoke_to_string(obj) | ||
| 80 | cfish_Obj *obj; | ||
| 81 | PPCODE: | ||
| 82 | cfish_String *str = CFISH_Obj_To_String(obj); | ||
| 83 | CFISH_DECREF(str); | ||
| 84 | |||
| 85 | U32 | ||
| 86 | refcount(sv) | ||
| 87 | SV *sv; | ||
| 88 | CODE: | ||
| 89 | RETVAL = SvREFCNT(SvROK(sv) ? SvRV(sv) : sv); | ||
| 90 | OUTPUT: RETVAL | ||
| 91 | END_XS_CODE | ||
| 92 | |||
| 93 | 1 | my $binding = Clownfish::CFC::Binding::Perl::Class->new( | |
| 94 | parcel => "TestClownfish", | ||
| 95 | class_name => "Clownfish::Test", | ||
| 96 | ); | ||
| 97 | 1 | $binding->append_xs($xs_code); | |
| 98 | |||
| 99 | 1 | Clownfish::CFC::Binding::Perl::Class->register($binding); | |
| 100 | } | ||
| 101 | |||
| 102 | 1 | ▶ | sub bind_test_host { |
|
Subroutine
bind_test_host: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 103 | 1 | my $binding = Clownfish::CFC::Binding::Perl::Class->new( | |
| 104 | class_name => "Clownfish::Test::TestHost", | ||
| 105 | ); | ||
| 106 | 1 | $binding->bind_method( | |
| 107 | alias => 'perl_alias', | ||
| 108 | method => 'Aliased', | ||
| 109 | ); | ||
| 110 | 1 | Clownfish::CFC::Binding::Perl::Class->register($binding); | |
| 111 | } | ||
| 112 | |||
| 113 | 1 | ▶ | sub bind_blob { |
|
Subroutine
bind_blob: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 114 | 1 | my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new; | |
| 115 | 1 | my $synopsis = <<'END_SYNOPSIS'; | |
| 116 | my $blob = Clownfish::Blob->new($byte_string); | ||
| 117 | my $byte_string = $blob->to_perl; | ||
| 118 | END_SYNOPSIS | ||
| 119 | 1 | my $constructor = <<'END_CONSTRUCTOR'; | |
| 120 | =head2 new | ||
| 121 | |||
| 122 | my $blob = Clownfish::Blob->new($byte_string); | ||
| 123 | |||
| 124 | Create a Blob containing the passed-in bytes. | ||
| 125 | END_CONSTRUCTOR | ||
| 126 | 1 | $pod_spec->set_synopsis($synopsis); | |
| 127 | 1 | $pod_spec->add_constructor( pod => $constructor ); | |
| 128 | |||
| 129 | 1 | my $xs_code = <<'END_XS_CODE'; | |
| 130 | MODULE = Clownfish PACKAGE = Clownfish::Blob | ||
| 131 | |||
| 132 | SV* | ||
| 133 | new(either_sv, sv) | ||
| 134 | SV *either_sv; | ||
| 135 | SV *sv; | ||
| 136 | CODE: | ||
| 137 | { | ||
| 138 | STRLEN size; | ||
| 139 | char *ptr = SvPV(sv, size); | ||
| 140 | cfish_Blob *self | ||
| 141 | = (cfish_Blob*)XSBind_new_blank_obj(aTHX_ either_sv); | ||
| 142 | cfish_Blob_init(self, ptr, size); | ||
| 143 | RETVAL = CFISH_OBJ_TO_SV_NOINC(self); | ||
| 144 | } | ||
| 145 | OUTPUT: RETVAL | ||
| 146 | END_XS_CODE | ||
| 147 | |||
| 148 | 1 | my $binding = Clownfish::CFC::Binding::Perl::Class->new( | |
| 149 | class_name => "Clownfish::Blob", | ||
| 150 | ); | ||
| 151 | 1 | $binding->set_pod_spec($pod_spec); | |
| 152 | 1 | $binding->append_xs($xs_code); | |
| 153 | 1 | $binding->exclude_constructor; | |
| 154 | |||
| 155 | 1 | Clownfish::CFC::Binding::Perl::Class->register($binding); | |
| 156 | } | ||
| 157 | |||
| 158 | 1 | ▶ | sub bind_boolean { |
|
Subroutine
bind_boolean: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 159 | 1 | my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new; | |
| 160 | 1 | my $synopsis = <<'END_SYNOPSIS'; | |
| 161 | use Clownfish::Boolean qw( $true_singleton $false_singleton ); | ||
| 162 | |||
| 163 | my $bool = Clownfish::Boolean->singleton($truth_value); | ||
| 164 | my $truth_value = $bool->get_value; | ||
| 165 | |||
| 166 | if ($bool->equals($true_singleton)) { | ||
| 167 | print "true\n"; | ||
| 168 | } | ||
| 169 | END_SYNOPSIS | ||
| 170 | 1 | my $description = <<'END_DESCRIPTION'; | |
| 171 | There are only two singleton instances of this class: C<$true_singleton> and | ||
| 172 | C<$false_singleton> which are exported on demand. | ||
| 173 | END_DESCRIPTION | ||
| 174 | 1 | my $constructor = <<'END_CONSTRUCTOR'; | |
| 175 | =head2 singleton | ||
| 176 | |||
| 177 | my $bool = Clownfish::Boolean->singleton($truth_value); | ||
| 178 | |||
| 179 | Return either C<$true_singleton> or C<$false_singleton> depending on the | ||
| 180 | supplied value. | ||
| 181 | END_CONSTRUCTOR | ||
| 182 | 1 | $pod_spec->set_synopsis($synopsis); | |
| 183 | 1 | $pod_spec->set_description($description); | |
| 184 | 1 | $pod_spec->add_constructor( pod => $constructor ); | |
| 185 | |||
| 186 | 1 | my $xs_code = <<'END_XS_CODE'; | |
| 187 | MODULE = Clownfish PACKAGE = Clownfish::Boolean | ||
| 188 | |||
| 189 | SV* | ||
| 190 | singleton(either_sv, value) | ||
| 191 | SV *either_sv; | ||
| 192 | bool value; | ||
| 193 | CODE: | ||
| 194 | { | ||
| 195 | CFISH_UNUSED_VAR(either_sv); | ||
| 196 | RETVAL = CFISH_OBJ_TO_SV_INC(cfish_Bool_singleton(value)); | ||
| 197 | } | ||
| 198 | OUTPUT: RETVAL | ||
| 199 | END_XS_CODE | ||
| 200 | |||
| 201 | 1 | my $binding = Clownfish::CFC::Binding::Perl::Class->new( | |
| 202 | class_name => "Clownfish::Boolean", | ||
| 203 | ); | ||
| 204 | 1 | $binding->set_pod_spec($pod_spec); | |
| 205 | 1 | $binding->append_xs($xs_code); | |
| 206 | |||
| 207 | 1 | Clownfish::CFC::Binding::Perl::Class->register($binding); | |
| 208 | } | ||
| 209 | |||
| 210 | 1 | ▶ | sub bind_bytebuf { |
|
Subroutine
bind_bytebuf: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 211 | 1 | my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new; | |
| 212 | 1 | my $synopsis = <<'END_SYNOPSIS'; | |
| 213 | my $buf = Clownfish::ByteBuf->new($byte_string); | ||
| 214 | my $byte_string = $buf->to_perl; | ||
| 215 | END_SYNOPSIS | ||
| 216 | 1 | my $constructor = <<'END_CONSTRUCTOR'; | |
| 217 | =head2 new | ||
| 218 | |||
| 219 | my $buf = Clownfish::ByteBuf->new($byte_string); | ||
| 220 | |||
| 221 | Create a ByteBuf containing the passed-in bytes. | ||
| 222 | END_CONSTRUCTOR | ||
| 223 | 1 | $pod_spec->set_synopsis($synopsis); | |
| 224 | 1 | $pod_spec->add_constructor( pod => $constructor ); | |
| 225 | |||
| 226 | 1 | my $xs_code = <<'END_XS_CODE'; | |
| 227 | MODULE = Clownfish PACKAGE = Clownfish::ByteBuf | ||
| 228 | |||
| 229 | SV* | ||
| 230 | new(either_sv, sv) | ||
| 231 | SV *either_sv; | ||
| 232 | SV *sv; | ||
| 233 | CODE: | ||
| 234 | { | ||
| 235 | STRLEN size; | ||
| 236 | char *ptr = SvPV(sv, size); | ||
| 237 | cfish_ByteBuf *self | ||
| 238 | = (cfish_ByteBuf*)XSBind_new_blank_obj(aTHX_ either_sv); | ||
| 239 | cfish_BB_init_bytes(self, ptr, size); | ||
| 240 | RETVAL = CFISH_OBJ_TO_SV_NOINC(self); | ||
| 241 | } | ||
| 242 | OUTPUT: RETVAL | ||
| 243 | END_XS_CODE | ||
| 244 | |||
| 245 | 1 | my $binding = Clownfish::CFC::Binding::Perl::Class->new( | |
| 246 | class_name => "Clownfish::ByteBuf", | ||
| 247 | ); | ||
| 248 | 1 | $binding->set_pod_spec($pod_spec); | |
| 249 | 1 | $binding->append_xs($xs_code); | |
| 250 | 1 | $binding->exclude_constructor; | |
| 251 | |||
| 252 | 1 | Clownfish::CFC::Binding::Perl::Class->register($binding); | |
| 253 | } | ||
| 254 | |||
| 255 | 1 | ▶ | sub bind_charbuf { |
|
Subroutine
bind_charbuf: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 256 | 1 | my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new; | |
| 257 | 1 | my $synopsis = <<'END_SYNOPSIS'; | |
| 258 | my $buf = Clownfish::CharBuf->new; | ||
| 259 | $buf->cat('abc'); | ||
| 260 | $buf->cat_char(ord("\n")); | ||
| 261 | print $buf->to_string; | ||
| 262 | END_SYNOPSIS | ||
| 263 | 1 | $pod_spec->set_synopsis($synopsis); | |
| 264 | 1 | $pod_spec->add_constructor(); | |
| 265 | |||
| 266 | 1 | my $binding = Clownfish::CFC::Binding::Perl::Class->new( | |
| 267 | class_name => "Clownfish::CharBuf", | ||
| 268 | ); | ||
| 269 | 1 | $binding->set_pod_spec($pod_spec); | |
| 270 | |||
| 271 | 1 | Clownfish::CFC::Binding::Perl::Class->register($binding); | |
| 272 | } | ||
| 273 | |||
| 274 | 1 | ▶ | sub bind_string { |
|
Subroutine
bind_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 275 | 1 | my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new; | |
| 276 | 1 | my $synopsis = <<'END_SYNOPSIS'; | |
| 277 | my $string = Clownfish::String->new('abc'); | ||
| 278 | print $string->to_perl, "\n"; | ||
| 279 | END_SYNOPSIS | ||
| 280 | 1 | my $constructor = <<'END_CONSTRUCTOR'; | |
| 281 | =head2 new | ||
| 282 | |||
| 283 | my $string = Clownfish::String->new($perl_string); | ||
| 284 | |||
| 285 | Return a String containing the passed-in Perl string. | ||
| 286 | END_CONSTRUCTOR | ||
| 287 | 1 | $pod_spec->set_synopsis($synopsis); | |
| 288 | 1 | $pod_spec->add_constructor( pod => $constructor ); | |
| 289 | |||
| 290 | 1 | my $xs_code = <<'END_XS_CODE'; | |
| 291 | MODULE = Clownfish PACKAGE = Clownfish::String | ||
| 292 | |||
| 293 | SV* | ||
| 294 | new(either_sv, sv) | ||
| 295 | SV *either_sv; | ||
| 296 | SV *sv; | ||
| 297 | CODE: | ||
| 298 | { | ||
| 299 | STRLEN size; | ||
| 300 | char *ptr = SvPVutf8(sv, size); | ||
| 301 | cfish_String *self = (cfish_String*)XSBind_new_blank_obj(aTHX_ either_sv); | ||
| 302 | cfish_Str_init_from_trusted_utf8(self, ptr, size); | ||
| 303 | RETVAL = CFISH_OBJ_TO_SV_NOINC(self); | ||
| 304 | } | ||
| 305 | OUTPUT: RETVAL | ||
| 306 | END_XS_CODE | ||
| 307 | |||
| 308 | 1 | my $binding = Clownfish::CFC::Binding::Perl::Class->new( | |
| 309 | class_name => "Clownfish::String", | ||
| 310 | ); | ||
| 311 | 1 | $binding->set_pod_spec($pod_spec); | |
| 312 | 1 | $binding->append_xs($xs_code); | |
| 313 | 1 | $binding->exclude_constructor; | |
| 314 | |||
| 315 | 1 | Clownfish::CFC::Binding::Perl::Class->register($binding); | |
| 316 | } | ||
| 317 | |||
| 318 | 1 | ▶ | sub bind_stringiterator { |
|
Subroutine
bind_stringiterator: called CC=2 SCAR=6.9
Pod
undocumented
| |||
| 319 | 1 | my @hand_rolled = qw( | |
| 320 | Next | ||
| 321 | Prev | ||
| 322 | ); | ||
| 323 | |||
| 324 | 1 | my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new; | |
| 325 | 1 | my $synopsis = <<'END_SYNOPSIS'; | |
| 326 | my $iter = $string->top; | ||
| 327 | while (my $code_point = $iter->next) { | ||
| 328 | ... | ||
| 329 | } | ||
| 330 | END_SYNOPSIS | ||
| 331 | 1 | my $next_pod = <<'END_POD'; | |
| 332 | =head2 next | ||
| 333 | |||
| 334 | my $code_point = $iter->next; | ||
| 335 | |||
| 336 | Return the code point after the current position and advance the | ||
| 337 | iterator. Returns undef at the end of the string. Returns zero | ||
| 338 | but true for U+0000. | ||
| 339 | END_POD | ||
| 340 | 1 | my $prev_pod = <<'END_POD'; | |
| 341 | =head2 prev | ||
| 342 | |||
| 343 | my $code_point = $iter->prev; | ||
| 344 | |||
| 345 | Return the code point before the current position and go one step back. | ||
| 346 | Returns undef at the start of the string. Returns zero but true for | ||
| 347 | U+0000. | ||
| 348 | END_POD | ||
| 349 | 1 | $pod_spec->set_synopsis($synopsis); | |
| 350 | 1 | $pod_spec->add_method( | |
| 351 | method => 'Next', | ||
| 352 | alias => 'next', | ||
| 353 | pod => $next_pod, | ||
| 354 | ); | ||
| 355 | 1 | $pod_spec->add_method( | |
| 356 | method => 'Prev', | ||
| 357 | alias => 'prev', | ||
| 358 | pod => $prev_pod, | ||
| 359 | ); | ||
| 360 | |||
| 361 | 1 | my $xs_code = <<'END_XS_CODE'; | |
| 362 | MODULE = Clownfish PACKAGE = Clownfish::StringIterator | ||
| 363 | |||
| 364 | SV* | ||
| 365 | next(self) | ||
| 366 | cfish_StringIterator *self; | ||
| 367 | CODE: | ||
| 368 | { | ||
| 369 | int32_t cp = CFISH_StrIter_Next(self); | ||
| 370 | |||
| 371 | if (cp == CFISH_STR_OOB) { | ||
| 372 | RETVAL = &PL_sv_undef; | ||
| 373 | } | ||
| 374 | else if (cp == 0) { | ||
| 375 | /* Zero but true. */ | ||
| 376 | RETVAL = newSVpvn("0e0", 3); | ||
| 377 | } | ||
| 378 | else { | ||
| 379 | RETVAL = newSViv(cp); | ||
| 380 | } | ||
| 381 | } | ||
| 382 | OUTPUT: RETVAL | ||
| 383 | |||
| 384 | SV* | ||
| 385 | prev(self) | ||
| 386 | cfish_StringIterator *self; | ||
| 387 | CODE: | ||
| 388 | { | ||
| 389 | int32_t cp = CFISH_StrIter_Prev(self); | ||
| 390 | |||
| 391 | if (cp == CFISH_STR_OOB) { | ||
| 392 | RETVAL = &PL_sv_undef; | ||
| 393 | } | ||
| 394 | else if (cp == 0) { | ||
| 395 | /* Zero but true. */ | ||
| 396 | RETVAL = newSVpvn("0e0", 3); | ||
| 397 | } | ||
| 398 | else { | ||
| 399 | RETVAL = newSViv(cp); | ||
| 400 | } | ||
| 401 | } | ||
| 402 | OUTPUT: RETVAL | ||
| 403 | END_XS_CODE | ||
| 404 | |||
| 405 | 1 | my $binding = Clownfish::CFC::Binding::Perl::Class->new( | |
| 406 | class_name => "Clownfish::StringIterator", | ||
| 407 | ); | ||
| 408 | 1 | $binding->set_pod_spec($pod_spec); | |
| 409 | 1 | $binding->exclude_method($_) for @hand_rolled; | |
| 410 | 1 | $binding->append_xs($xs_code); | |
| 411 | |||
| 412 | 1 | Clownfish::CFC::Binding::Perl::Class->register($binding); | |
| 413 | } | ||
| 414 | |||
| 415 | 1 | ▶ | sub bind_err { |
|
Subroutine
bind_err: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 416 | 1 | my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new; | |
| 417 | 1 | my $synopsis = <<'END_SYNOPSIS'; | |
| 418 | package MyErr; | ||
| 419 | use base qw( Clownfish::Err ); | ||
| 420 | |||
| 421 | ... | ||
| 422 | |||
| 423 | package main; | ||
| 424 | use Scalar::Util qw( blessed ); | ||
| 425 | while (1) { | ||
| 426 | eval { | ||
| 427 | do_stuff() or MyErr->throw("retry"); | ||
| 428 | }; | ||
| 429 | if ( blessed($@) and $@->isa("MyErr") ) { | ||
| 430 | warn "Retrying...\n"; | ||
| 431 | } | ||
| 432 | else { | ||
| 433 | # Re-throw. | ||
| 434 | die "do_stuff() died: $@"; | ||
| 435 | } | ||
| 436 | } | ||
| 437 | END_SYNOPSIS | ||
| 438 | 1 | $pod_spec->set_synopsis($synopsis); | |
| 439 | |||
| 440 | 1 | my $xs_code = <<'END_XS_CODE'; | |
| 441 | MODULE = Clownfish PACKAGE = Clownfish::Err | ||
| 442 | |||
| 443 | SV* | ||
| 444 | trap(routine_sv, context_sv) | ||
| 445 | SV *routine_sv; | ||
| 446 | SV *context_sv; | ||
| 447 | CODE: | ||
| 448 | cfish_Err *error = XSBind_trap(routine_sv, context_sv); | ||
| 449 | RETVAL = CFISH_OBJ_TO_SV_NOINC(error); | ||
| 450 | OUTPUT: RETVAL | ||
| 451 | END_XS_CODE | ||
| 452 | |||
| 453 | 1 | my $binding = Clownfish::CFC::Binding::Perl::Class->new( | |
| 454 | class_name => "Clownfish::Err", | ||
| 455 | ); | ||
| 456 | 1 | $binding->bind_constructor( alias => '_new' ); | |
| 457 | 1 | $binding->set_pod_spec($pod_spec); | |
| 458 | 1 | $binding->append_xs($xs_code); | |
| 459 | |||
| 460 | 1 | Clownfish::CFC::Binding::Perl::Class->register($binding); | |
| 461 | } | ||
| 462 | |||
| 463 | 1 | ▶ | sub bind_hash { |
|
Subroutine
bind_hash: called CC=2 SCAR=6.9
Pod
undocumented
| |||
| 464 | 1 | my @hand_rolled = qw( | |
| 465 | Store | ||
| 466 | ); | ||
| 467 | |||
| 468 | 1 | my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new; | |
| 469 | 1 | my $synopsis = <<'END_SYNOPSIS'; | |
| 470 | my $hash = Clownfish::Hash->new; | ||
| 471 | $hash->store($key, $value); | ||
| 472 | my $value = $hash->fetch($key); | ||
| 473 | END_SYNOPSIS | ||
| 474 | 1 | my $store_pod = <<'END_POD'; | |
| 475 | =head2 store | ||
| 476 | |||
| 477 | $hash->store($key, $value); | ||
| 478 | |||
| 479 | Store a key-value pair. | ||
| 480 | END_POD | ||
| 481 | 1 | $pod_spec->set_synopsis($synopsis); | |
| 482 | 1 | $pod_spec->add_constructor(); | |
| 483 | 1 | $pod_spec->add_method( | |
| 484 | method => 'Store', | ||
| 485 | alias => 'store', | ||
| 486 | pod => $store_pod, | ||
| 487 | ); | ||
| 488 | |||
| 489 | 1 | my $xs_code = <<'END_XS_CODE'; | |
| 490 | MODULE = Clownfish PACKAGE = Clownfish::Hash | ||
| 491 | SV* | ||
| 492 | fetch_raw(self, key) | ||
| 493 | cfish_Hash *self; | ||
| 494 | cfish_String *key; | ||
| 495 | CODE: | ||
| 496 | RETVAL = CFISH_OBJ_TO_SV_INC(CFISH_Hash_Fetch(self, key)); | ||
| 497 | OUTPUT: RETVAL | ||
| 498 | |||
| 499 | void | ||
| 500 | store(self, key, value_sv); | ||
| 501 | cfish_Hash *self; | ||
| 502 | cfish_String *key; | ||
| 503 | SV *value_sv; | ||
| 504 | PPCODE: | ||
| 505 | { | ||
| 506 | cfish_Obj *value | ||
| 507 | = (cfish_Obj*)XSBind_perl_to_cfish_nullable(aTHX_ value_sv, CFISH_OBJ); | ||
| 508 | CFISH_Hash_Store(self, key, value); | ||
| 509 | } | ||
| 510 | END_XS_CODE | ||
| 511 | |||
| 512 | 1 | my $binding = Clownfish::CFC::Binding::Perl::Class->new( | |
| 513 | class_name => "Clownfish::Hash", | ||
| 514 | ); | ||
| 515 | 1 | $binding->set_pod_spec($pod_spec); | |
| 516 | 1 | $binding->exclude_method($_) for @hand_rolled; | |
| 517 | 1 | $binding->append_xs($xs_code); | |
| 518 | |||
| 519 | 1 | Clownfish::CFC::Binding::Perl::Class->register($binding); | |
| 520 | } | ||
| 521 | |||
| 522 | 1 | ▶ | sub bind_hashiterator { |
|
Subroutine
bind_hashiterator: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 523 | 1 | my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new; | |
| 524 | 1 | my $synopsis = <<'END_SYNOPSIS'; | |
| 525 | my $iter = Clownfish::HashIterator->new($hash); | ||
| 526 | while ($iter->next) { | ||
| 527 | my $key = $iter->get_key; | ||
| 528 | my $value = $iter->get_value; | ||
| 529 | } | ||
| 530 | END_SYNOPSIS | ||
| 531 | 1 | my $constructor = <<'END_CONSTRUCTOR'; | |
| 532 | my $iter = Clownfish::HashIterator->new($hash); | ||
| 533 | END_CONSTRUCTOR | ||
| 534 | 1 | $pod_spec->set_synopsis($synopsis); | |
| 535 | 1 | $pod_spec->add_constructor( sample => $constructor ); | |
| 536 | |||
| 537 | 1 | my $xs_code = <<'END_XS_CODE'; | |
| 538 | MODULE = Clownfish PACKAGE = Clownfish::HashIterator | ||
| 539 | |||
| 540 | SV* | ||
| 541 | new(either_sv, hash) | ||
| 542 | SV *either_sv; | ||
| 543 | cfish_Hash *hash; | ||
| 544 | CODE: | ||
| 545 | { | ||
| 546 | cfish_HashIterator *self | ||
| 547 | = (cfish_HashIterator*)XSBind_new_blank_obj(aTHX_ either_sv); | ||
| 548 | cfish_HashIter_init(self, hash); | ||
| 549 | RETVAL = CFISH_OBJ_TO_SV_NOINC(self); | ||
| 550 | } | ||
| 551 | OUTPUT: RETVAL | ||
| 552 | END_XS_CODE | ||
| 553 | |||
| 554 | 1 | my $binding = Clownfish::CFC::Binding::Perl::Class->new( | |
| 555 | class_name => "Clownfish::HashIterator", | ||
| 556 | ); | ||
| 557 | 1 | $binding->set_pod_spec($pod_spec); | |
| 558 | 1 | $binding->append_xs($xs_code); | |
| 559 | 1 | $binding->exclude_constructor; | |
| 560 | |||
| 561 | 1 | Clownfish::CFC::Binding::Perl::Class->register($binding); | |
| 562 | } | ||
| 563 | |||
| 564 | 1 | ▶ | sub bind_float { |
|
Subroutine
bind_float: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 565 | 1 | my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new; | |
| 566 | 1 | my $synopsis = <<'END_SYNOPSIS'; | |
| 567 | my $float = Clownfish::Float->new(2.5); | ||
| 568 | my $value = $float->get_value; | ||
| 569 | END_SYNOPSIS | ||
| 570 | 1 | my $constructor = <<'END_CONSTRUCTOR'; | |
| 571 | my $float = Clownfish::Float->new($value); | ||
| 572 | END_CONSTRUCTOR | ||
| 573 | 1 | $pod_spec->set_synopsis($synopsis); | |
| 574 | 1 | $pod_spec->add_constructor( sample => $constructor ); | |
| 575 | |||
| 576 | 1 | my $xs_code = <<'END_XS_CODE'; | |
| 577 | MODULE = Clownfish PACKAGE = Clownfish::Float | ||
| 578 | |||
| 579 | SV* | ||
| 580 | new(either_sv, value) | ||
| 581 | SV *either_sv; | ||
| 582 | double value; | ||
| 583 | CODE: | ||
| 584 | { | ||
| 585 | cfish_Float *self | ||
| 586 | = (cfish_Float*)XSBind_new_blank_obj(aTHX_ either_sv); | ||
| 587 | cfish_Float_init(self, value); | ||
| 588 | RETVAL = CFISH_OBJ_TO_SV_NOINC(self); | ||
| 589 | } | ||
| 590 | OUTPUT: RETVAL | ||
| 591 | END_XS_CODE | ||
| 592 | |||
| 593 | 1 | my $binding = Clownfish::CFC::Binding::Perl::Class->new( | |
| 594 | class_name => "Clownfish::Float", | ||
| 595 | ); | ||
| 596 | 1 | $binding->set_pod_spec($pod_spec); | |
| 597 | 1 | $binding->append_xs($xs_code); | |
| 598 | 1 | $binding->exclude_constructor; | |
| 599 | |||
| 600 | 1 | Clownfish::CFC::Binding::Perl::Class->register($binding); | |
| 601 | } | ||
| 602 | |||
| 603 | 1 | ▶ | sub bind_integer { |
|
Subroutine
bind_integer: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 604 | 1 | my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new; | |
| 605 | 1 | my $synopsis = <<'END_SYNOPSIS'; | |
| 606 | my $integer = Clownfish::Integer->new(7); | ||
| 607 | my $value = $integer->get_value; | ||
| 608 | END_SYNOPSIS | ||
| 609 | 1 | my $constructor = <<'END_CONSTRUCTOR'; | |
| 610 | my $integer = Clownfish::Integer->new($value); | ||
| 611 | END_CONSTRUCTOR | ||
| 612 | 1 | $pod_spec->set_synopsis($synopsis); | |
| 613 | 1 | $pod_spec->add_constructor( sample => $constructor ); | |
| 614 | |||
| 615 | 1 | my $xs_code = <<'END_XS_CODE'; | |
| 616 | MODULE = Clownfish PACKAGE = Clownfish::Integer | ||
| 617 | |||
| 618 | SV* | ||
| 619 | new(either_sv, value) | ||
| 620 | SV *either_sv; | ||
| 621 | int64_t value; | ||
| 622 | CODE: | ||
| 623 | { | ||
| 624 | cfish_Integer *self | ||
| 625 | = (cfish_Integer*)XSBind_new_blank_obj(aTHX_ either_sv); | ||
| 626 | cfish_Int_init(self, value); | ||
| 627 | RETVAL = CFISH_OBJ_TO_SV_NOINC(self); | ||
| 628 | } | ||
| 629 | OUTPUT: RETVAL | ||
| 630 | END_XS_CODE | ||
| 631 | |||
| 632 | 1 | my $binding = Clownfish::CFC::Binding::Perl::Class->new( | |
| 633 | class_name => "Clownfish::Integer", | ||
| 634 | ); | ||
| 635 | 1 | $binding->set_pod_spec($pod_spec); | |
| 636 | 1 | $binding->append_xs($xs_code); | |
| 637 | 1 | $binding->exclude_constructor; | |
| 638 | |||
| 639 | 1 | Clownfish::CFC::Binding::Perl::Class->register($binding); | |
| 640 | } | ||
| 641 | |||
| 642 | 1 | ▶ | sub bind_obj { |
|
Subroutine
bind_obj: called CC=2 SCAR=6.9
Pod
undocumented
| |||
| 643 | 1 | my @hand_rolled = qw( Destroy ); | |
| 644 | |||
| 645 | 1 | my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new; | |
| 646 | 1 | my $synopsis = <<'END_SYNOPSIS'; | |
| 647 | package MyObj; | ||
| 648 | use base qw( Clownfish::Obj ); | ||
| 649 | |||
| 650 | # Inside-out member var. | ||
| 651 | my %foo; | ||
| 652 | |||
| 653 | sub new { | ||
| 654 | my ( $class, %args ) = @_; | ||
| 655 | my $foo = delete $args{foo}; | ||
| 656 | my $self = $class->SUPER::new(%args); | ||
| 657 | $foo{$$self} = $foo; | ||
| 658 | return $self; | ||
| 659 | } | ||
| 660 | |||
| 661 | sub get_foo { | ||
| 662 | my $self = shift; | ||
| 663 | return $foo{$$self}; | ||
| 664 | } | ||
| 665 | |||
| 666 | sub DESTROY { | ||
| 667 | my $self = shift; | ||
| 668 | delete $foo{$$self}; | ||
| 669 | $self->SUPER::DESTROY; | ||
| 670 | } | ||
| 671 | END_SYNOPSIS | ||
| 672 | 1 | my $description = <<'END_DESCRIPTION'; | |
| 673 | Clownfish::Obj is the base class of the Clownfish object hierarchy. | ||
| 674 | |||
| 675 | From the standpoint of a Perl programmer, all classes are implemented as | ||
| 676 | blessed scalar references, with the scalar storing a pointer to a C struct. | ||
| 677 | |||
| 678 | =head2 Subclassing | ||
| 679 | |||
| 680 | The recommended way to subclass Clownfish::Obj and its descendants is | ||
| 681 | to use the inside-out design pattern. (See L<Class::InsideOut> for an | ||
| 682 | introduction to inside-out techniques.) | ||
| 683 | |||
| 684 | Since the blessed scalar stores a C pointer value which is unique per-object, | ||
| 685 | C<$$self> can be used as an inside-out ID. | ||
| 686 | |||
| 687 | # Accessor for 'foo' member variable. | ||
| 688 | sub get_foo { | ||
| 689 | my $self = shift; | ||
| 690 | return $foo{$$self}; | ||
| 691 | } | ||
| 692 | |||
| 693 | |||
| 694 | Caveats: | ||
| 695 | |||
| 696 | =over | ||
| 697 | |||
| 698 | =item * | ||
| 699 | |||
| 700 | Inside-out aficionados will have noted that the "cached scalar id" stratagem | ||
| 701 | recommended above isn't compatible with ithreads. | ||
| 702 | |||
| 703 | =item * | ||
| 704 | |||
| 705 | Overridden methods must not return undef unless the API specifies that | ||
| 706 | returning undef is permissible. | ||
| 707 | |||
| 708 | =back | ||
| 709 | |||
| 710 | =head1 CONSTRUCTOR | ||
| 711 | |||
| 712 | =head2 new | ||
| 713 | |||
| 714 | my $self = $class->SUPER::new; | ||
| 715 | |||
| 716 | Abstract constructor -- must be invoked via a subclass. Attempting to | ||
| 717 | instantiate objects of class "Clownfish::Obj" directly causes an | ||
| 718 | error. | ||
| 719 | |||
| 720 | Takes no arguments; if any are supplied, an error will be reported. | ||
| 721 | END_DESCRIPTION | ||
| 722 | 1 | my $to_perl_pod = <<'END_POD'; | |
| 723 | =head2 to_perl | ||
| 724 | |||
| 725 | my $native = $obj->to_perl; | ||
| 726 | |||
| 727 | Tries to convert the object to its native Perl representation. | ||
| 728 | END_POD | ||
| 729 | 1 | my $destroy_pod = <<'END_POD'; | |
| 730 | =head2 DESTROY | ||
| 731 | |||
| 732 | All Clownfish classes implement a DESTROY method; if you override it in a | ||
| 733 | subclass, you must call C<< $self->SUPER::DESTROY >> to avoid leaking memory. | ||
| 734 | END_POD | ||
| 735 | 1 | $pod_spec->set_synopsis($synopsis); | |
| 736 | 1 | $pod_spec->set_description($description); | |
| 737 | 1 | $pod_spec->add_method( | |
| 738 | alias => 'to_perl', | ||
| 739 | pod => $to_perl_pod, | ||
| 740 | ); | ||
| 741 | 1 | $pod_spec->add_method( | |
| 742 | alias => 'DESTROY', | ||
| 743 | pod => $destroy_pod, | ||
| 744 | ); | ||
| 745 | |||
| 746 | 1 | my $xs_code = <<'END_XS_CODE'; | |
| 747 | MODULE = Clownfish PACKAGE = Clownfish::Obj | ||
| 748 | |||
| 749 | void | ||
| 750 | DESTROY(sv) | ||
| 751 | SV *sv | ||
| 752 | PPCODE: | ||
| 753 | XSBind_destroy(aTHX_ sv); | ||
| 754 | |||
| 755 | SV* | ||
| 756 | get_class(self) | ||
| 757 | cfish_Obj *self | ||
| 758 | CODE: | ||
| 759 | cfish_Class *klass = cfish_Obj_get_class(self); | ||
| 760 | RETVAL = (SV*)CFISH_Class_To_Host(klass, NULL); | ||
| 761 | OUTPUT: RETVAL | ||
| 762 | |||
| 763 | SV* | ||
| 764 | get_class_name(self) | ||
| 765 | cfish_Obj *self | ||
| 766 | CODE: | ||
| 767 | cfish_String *class_name = cfish_Obj_get_class_name(self); | ||
| 768 | RETVAL = (SV*)CFISH_Str_To_Host(class_name, NULL); | ||
| 769 | OUTPUT: RETVAL | ||
| 770 | |||
| 771 | bool | ||
| 772 | is_a(self, class_name) | ||
| 773 | cfish_Obj *self; | ||
| 774 | cfish_String *class_name; | ||
| 775 | CODE: | ||
| 776 | { | ||
| 777 | cfish_Class *target = cfish_Class_fetch_class(class_name); | ||
| 778 | RETVAL = cfish_Obj_is_a(self, target); | ||
| 779 | } | ||
| 780 | OUTPUT: RETVAL | ||
| 781 | |||
| 782 | SV* | ||
| 783 | clone_raw(self) | ||
| 784 | cfish_Obj *self; | ||
| 785 | CODE: | ||
| 786 | RETVAL = CFISH_OBJ_TO_SV_NOINC(CFISH_Obj_Clone(self)); | ||
| 787 | OUTPUT: RETVAL | ||
| 788 | |||
| 789 | SV* | ||
| 790 | to_perl(self) | ||
| 791 | cfish_Obj *self; | ||
| 792 | CODE: | ||
| 793 | RETVAL = (SV*)CFISH_Obj_To_Host(self, NULL); | ||
| 794 | OUTPUT: RETVAL | ||
| 795 | END_XS_CODE | ||
| 796 | |||
| 797 | 1 | my $binding = Clownfish::CFC::Binding::Perl::Class->new( | |
| 798 | class_name => "Clownfish::Obj", | ||
| 799 | ); | ||
| 800 | 1 | $binding->append_xs($xs_code); | |
| 801 | 1 | $binding->set_pod_spec($pod_spec); | |
| 802 | 1 | $binding->exclude_method($_) for @hand_rolled; | |
| 803 | |||
| 804 | 1 | Clownfish::CFC::Binding::Perl::Class->register($binding); | |
| 805 | } | ||
| 806 | |||
| 807 | 1 | ▶ | sub bind_vector { |
|
Subroutine
bind_vector: called CC=2 SCAR=6.9
Pod
undocumented
| |||
| 808 | 1 | my @hand_rolled = qw( | |
| 809 | Store | ||
| 810 | ); | ||
| 811 | |||
| 812 | 1 | my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new; | |
| 813 | 1 | my $synopsis = <<'END_SYNOPSIS'; | |
| 814 | my $vector = Clownfish::Vector->new; | ||
| 815 | $vector->store($tick, $value); | ||
| 816 | my $value = $vector->fetch($tick); | ||
| 817 | END_SYNOPSIS | ||
| 818 | 1 | my $store_pod = <<'END_POD'; | |
| 819 | =head2 store | ||
| 820 | |||
| 821 | $vector->store($tick, $elem) | ||
| 822 | |||
| 823 | Store an element at index C<tick>, possibly displacing an existing element. | ||
| 824 | END_POD | ||
| 825 | 1 | $pod_spec->set_synopsis($synopsis); | |
| 826 | 1 | $pod_spec->add_constructor(); | |
| 827 | 1 | $pod_spec->add_method( | |
| 828 | method => 'Store', | ||
| 829 | alias => 'store', | ||
| 830 | pod => $store_pod, | ||
| 831 | ); | ||
| 832 | |||
| 833 | 1 | my $xs_code = <<'END_XS_CODE'; | |
| 834 | MODULE = Clownfish PACKAGE = Clownfish::Vector | ||
| 835 | |||
| 836 | SV* | ||
| 837 | pop_raw(self) | ||
| 838 | cfish_Vector *self; | ||
| 839 | CODE: | ||
| 840 | RETVAL = CFISH_OBJ_TO_SV_NOINC(CFISH_Vec_Pop(self)); | ||
| 841 | OUTPUT: RETVAL | ||
| 842 | |||
| 843 | SV* | ||
| 844 | delete_raw(self, tick) | ||
| 845 | cfish_Vector *self; | ||
| 846 | uint32_t tick; | ||
| 847 | CODE: | ||
| 848 | RETVAL = CFISH_OBJ_TO_SV_NOINC(CFISH_Vec_Delete(self, tick)); | ||
| 849 | OUTPUT: RETVAL | ||
| 850 | |||
| 851 | void | ||
| 852 | store(self, tick, value); | ||
| 853 | cfish_Vector *self; | ||
| 854 | uint32_t tick; | ||
| 855 | cfish_Obj *value; | ||
| 856 | PPCODE: | ||
| 857 | { | ||
| 858 | if (value) { CFISH_INCREF(value); } | ||
| 859 | CFISH_Vec_Store(self, tick, value); | ||
| 860 | } | ||
| 861 | |||
| 862 | SV* | ||
| 863 | fetch_raw(self, tick) | ||
| 864 | cfish_Vector *self; | ||
| 865 | uint32_t tick; | ||
| 866 | CODE: | ||
| 867 | RETVAL = CFISH_OBJ_TO_SV_INC(CFISH_Vec_Fetch(self, tick)); | ||
| 868 | OUTPUT: RETVAL | ||
| 869 | END_XS_CODE | ||
| 870 | |||
| 871 | 1 | my $binding = Clownfish::CFC::Binding::Perl::Class->new( | |
| 872 | class_name => "Clownfish::Vector", | ||
| 873 | ); | ||
| 874 | 1 | $binding->set_pod_spec($pod_spec); | |
| 875 | 1 | $binding->exclude_method($_) for @hand_rolled; | |
| 876 | 1 | $binding->append_xs($xs_code); | |
| 877 | |||
| 878 | 1 | Clownfish::CFC::Binding::Perl::Class->register($binding); | |
| 879 | } | ||
| 880 | |||
| 881 | 1 | ▶ | sub bind_class { |
|
Subroutine
bind_class: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 882 | 1 | my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new; | |
| 883 | 1 | my $synopsis = <<'END_SYNOPSIS'; | |
| 884 | my $class = Clownfish::Class->fetch_class('Foo::Bar'); | ||
| 885 | my $subclass = Clownfish::Class->singleton('Foo::Bar::Jr', $class); | ||
| 886 | END_SYNOPSIS | ||
| 887 | 1 | my $fetch_class_sample = <<'END_CONSTRUCTOR'; | |
| 888 | my $class = Clownfish::Class->fetch_class($class_name); | ||
| 889 | END_CONSTRUCTOR | ||
| 890 | 1 | $pod_spec->set_synopsis($synopsis); | |
| 891 | 1 | $pod_spec->add_constructor( | |
| 892 | alias => 'fetch_class', | ||
| 893 | sample => $fetch_class_sample, | ||
| 894 | ); | ||
| 895 | 1 | $pod_spec->add_constructor( alias => 'singleton' ); | |
| 896 | |||
| 897 | 1 | my $xs_code = <<'END_XS_CODE'; | |
| 898 | MODULE = Clownfish PACKAGE = Clownfish::Class | ||
| 899 | |||
| 900 | SV* | ||
| 901 | fetch_class(unused_sv, class_name) | ||
| 902 | SV *unused_sv; | ||
| 903 | cfish_String *class_name; | ||
| 904 | CODE: | ||
| 905 | { | ||
| 906 | cfish_Class *klass = cfish_Class_fetch_class(class_name); | ||
| 907 | CFISH_UNUSED_VAR(unused_sv); | ||
| 908 | RETVAL = klass ? (SV*)CFISH_Class_To_Host(klass, NULL) : &PL_sv_undef; | ||
| 909 | } | ||
| 910 | OUTPUT: RETVAL | ||
| 911 | |||
| 912 | SV* | ||
| 913 | singleton(unused_sv, ...) | ||
| 914 | SV *unused_sv; | ||
| 915 | CODE: | ||
| 916 | { | ||
| 917 | static const XSBind_ParamSpec param_specs[2] = { | ||
| 918 | XSBIND_PARAM("class_name", true), | ||
| 919 | XSBIND_PARAM("parent", false), | ||
| 920 | }; | ||
| 921 | int32_t locations[2]; | ||
| 922 | cfish_String *class_name = NULL; | ||
| 923 | cfish_Class *parent = NULL; | ||
| 924 | cfish_Class *singleton = NULL; | ||
| 925 | CFISH_UNUSED_VAR(unused_sv); | ||
| 926 | XSBind_locate_args(aTHX_ &(ST(0)), 1, items, param_specs, locations, 2); | ||
| 927 | class_name = (cfish_String*)XSBind_arg_to_cfish( | ||
| 928 | aTHX_ ST(locations[0]), "class_name", CFISH_STRING, | ||
| 929 | CFISH_ALLOCA_OBJ(CFISH_STRING)); | ||
| 930 | if (locations[1] < items) { | ||
| 931 | parent = (cfish_Class*)XSBind_arg_to_cfish_nullable( | ||
| 932 | aTHX_ ST(locations[1]), "parent", CFISH_CLASS, NULL); | ||
| 933 | } | ||
| 934 | singleton = cfish_Class_singleton(class_name, parent); | ||
| 935 | RETVAL = (SV*)CFISH_Class_To_Host(singleton, NULL); | ||
| 936 | } | ||
| 937 | OUTPUT: RETVAL | ||
| 938 | END_XS_CODE | ||
| 939 | |||
| 940 | 1 | my $binding = Clownfish::CFC::Binding::Perl::Class->new( | |
| 941 | class_name => "Clownfish::Class", | ||
| 942 | ); | ||
| 943 | 1 | $binding->set_pod_spec($pod_spec); | |
| 944 | 1 | $binding->append_xs($xs_code); | |
| 945 | |||
| 946 | 1 | Clownfish::CFC::Binding::Perl::Class->register($binding); | |
| 947 | } | ||
| 948 | |||
| 949 | 1 | 1; | |