# New Ticket Created by  Steven Albano 
# Please include the string:  [perl #74858]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=74858 >


Hello, 

I hope you have had a good weekend.  I had just downloaded the April 
development release, and was experimenting with Perl 6 classes when I found 
that I could not use the 'say' subroutine from within a method declared in a 
role.  I found this as bug #74078.  

I then tried several other built in functions, and they suffered similar 
fates.  I did not immediately find any tickets that matched the others, though 
I could have missed. I have included some example code below. 

Hopefully this is helpful.   Even if it is not, I would like to thank you for 
your efforts.  Have a good week.

Steven Albano
use v6;

our &s = &say;
our &p = &print;
our &o = &open;
our &sl = &sleep;

role Howdy {
  method sayHowdy {
    # say 'Howdy!'; # does not work
    # print "Howdy!\n"; # does not work
    p "Howdy!\n"; # works
    # s 'Howdy!'; # works
    # my $file = open('hello.p6'); # does not work
    my $file = o('hello.p6'); # works
    # sleep(1); # does not work
    sl(1);
  }
}

class Greet does Howdy {
  method sayHi {
    say 'Hi!';
    # print "Hi!\n"; # works
    # my $file = open('hello.p6'); # works
    #sleep(1); #works
  }
}
#my $file = open('hello.p6'); # works
my $nod  = Greet.new();
#sleep(1); # works

$nod.sayHowdy();



      

Reply via email to