Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: b2512a4129
Fetching contributors…

Cannot retrieve contributors at this time

executable file 58 lines (38 sloc) 1.124 kb
use v6;
module Perlito5::Perl6::Runtime {
# bless() contributed by not_gerd in #perl6
#
# role Foo { method bar { say self<spam>; } };
# my $x = { spam => 'eggs' };
# bless5($x, 'Foo'); $x.bar;
sub bless ($obj, $role) {
$obj does ::($role)
}
# class X { has $.val }; my $v = {}; bless($v, "X"); $v.WHAT.say
# sub bless ($v is rw, $class) {
# $v = ::($class).new(val=>$v)
# }
sub ref ($obj) { #OK
my $s = $obj.WHAT.perl;
return 'ARRAY' if $s eq 'Array';
return 'HASH' if $s eq 'Hash';
return '' if $s eq 'Str';
return '' if $s eq 'Int';
return '' if $s eq 'Rat';
# TODO - REF, CODE, ...
return $s;
}
}
=begin
=head1 NAME
Perlito5::Perl5::Runtime
=head1 DESCRIPTION
Provides runtime routines for the Perlito5-in-Perl6 compiled code
=head1 AUTHORS
The Pugs Team E<lt>perl6-compiler@perl.orgE<gt>.
=head1 COPYRIGHT
Copyright 2006, 2009, 2011, 2012 by Flavio Soibelmann Glock and others.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See L<http://www.perl.com/perl/misc/Artistic.html>
=end
Jump to Line
Something went wrong with that request. Please try again.