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


# yahoo sent the first copy before I finished, arg!
# ignore first email
#
# bug commented in code

use v6;

class Int is also {
  method prime() {
    return True; # actual test algorithm removed for clarity
  }
}

# This loop works
say "Testing 1,2,3,4,5";
for 1,2,3,4,5 {
  print "$_ is: ";
  if .prime { say "prime" } else { say "NOT prime" }
}
say "";

# This loop doesn't work
# Output:
## 1 is: prime
## 2 is: Method 'prime' not found for invocant of class 'Integer' in Main (file 
src/gen_setting.pm, line 324)
#
# fwiw - calling the method with a negative int also produces this error.
# what is "class 'Integer'" ? I thought it was class "Int" in Perl 6.

say "Testing 1..5";
for 1..5 {
  print "$_ is: ";
  if .prime { say "prime" } else { say "NOT prime" }
}





Reply via email to