Perlito5/Perl6/Runtime.pm untested

filter: Statementstmt 0.0% 0 / 12 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 27 CC 6 SCAR 34.7
CC
6
Cov
0%
ref
42.0
bless
2.0
BEGIN
2.0
CRAP 32.0
1  
2 use v6;
3  
4 module Perlito5::Perl6::Runtime {
5  
6  
7 # bless() contributed by not_gerd in #perl6
8 #
9 # role Foo { method bar { say self<spam>; } };
10 # my $x = { spam => 'eggs' };
11 # bless5($x, 'Foo'); $x.bar;
12 sub bless ($obj, $role) {
13 $obj does ::($role)
14 }
15  
16 # class X { has $.val }; my $v = {}; bless($v, "X"); $v.WHAT.say
17 # sub bless ($v is rw, $class) {
18 # $v = ::($class).new(val=>$v)
19 # }
20  
21 sub ref ($obj) { #OK
22 my $s = $obj.WHAT.perl;
23 return 'ARRAY' if $s eq 'Array';
24 return 'HASH' if $s eq 'Hash';
25 return '' if $s eq 'Str';
26 return '' if $s eq 'Int';
27 return '' if $s eq 'Rat';
28 # TODO - REF, CODE, ...
29 return $s;
30 }
31  
32 }
33  
34 =begin
35  
36 =head1 NAME
37  
38 Perlito5::Perl5::Runtime
39  
40 =head1 DESCRIPTION
41  
42 Provides runtime routines for the Perlito5-in-Perl6 compiled code
43  
44 =head1 AUTHORS
45  
46 The Pugs Team.
47  
48 =head1 COPYRIGHT
49  
50 Copyright 2006, 2009, 2011, 2012 by Flavio Soibelmann Glock and others.
51  
52 This program is free software; you can redistribute it and/or modify it
53 under the same terms as Perl itself.
54  
55 See L<http://www.perl.com/perl/misc/Artistic.html>
56  
57 =end