SMOP/Interoperability.pm untested

filter: Statementstmt 0.0% 0 / 51 Branchbran 0.0% 0 / 2 Subroutinesub 0.0% 0 / 13 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 72 CC 2 SCAR 9.4
CC
2
Cov
0%
coro_from_eval
6.0
BEGIN
2.0
coro_from_methodcall
2.0
CRAP 2.6
1 package SMOP;
2 BEGIN {
3 $SMOP::VERSION = '0.6';
4 }
5  
6 use 5.010000;
7 use strict;
8 use warnings;
9 use Carp;
10 use Coro;
11 our $main_coro = new Coro::State;
12  
13  
14 require XSLoader;
15 XSLoader::load('SMOP::Interoperability');
16  
17 sub coro_from_eval {
18 my $code = shift;
19 Coro::State->new(sub {
20 my $ret = eval $code;
21 die if $@;
22 SMOP::Interoperability::goto_back($ret);
23 });
24 }
25 sub coro_from_methodcall {
26 my $invocant = shift;
27 my $method = shift;
28 my $args = \@_;
29 Coro::State->new(sub {
30 my $ret = $invocant->$method(@$args);
31 SMOP::Interoperability::goto_back($ret);
32 });
33 }
34 sub coro_from_subcall {
35 my $sub = shift;
36 my $args = \@_;
37 Coro::State->new(sub {
38 my $ret = $sub->(@$args);
39 SMOP::Interoperability::goto_back($ret);
40 });
41 }
42  
43 package SMOP::Object;
44 BEGIN {
45 $SMOP::Object::VERSION = '0.6';
46 }
47 use overload
48 #'fallback' =>0,
49 'bool' => sub {
50 SMOP::NATIVE::bool::fetch($_[0]->true);
51 },
52 '""' => sub {
53 SMOP::NATIVE::idconst::fetch($_[0]);
54 },
55 '0+' => sub {
56 SMOP::NATIVE::int::fetch($_[0]);
57 },
58 '.' => sub {
59 "$_[0]" . "$_[1]";
60 },
61 'eq' => sub {
62 "$_[0]" eq "$_[1]";
63 },
64 'ne' => sub {
65 "$_[0]" eq "$_[1]";
66 }
67 ;
68 sub DESTROY {
69 #print "DESTROY :)\n";
70 }
71 1;
72 __END__