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


commit e5a245053324ed7054020887310be70f05d38b2b


Code:

class ConstructorTest1 {
         has $.a1;
         has $.a2;

}

class ConstructorTest2 {
         has $.a1;
         has $.a2;

         multi method new(Int $number, Str $color) {
                 self.bless(*, :a1($number), :a2($color));
         }

}

say "Testing vanilla class default named constructor";
my ConstructorTest1 $ct1 .= new(:a1(1), :a2<foobar>);
say "\$ct1 {$ct1.a1} {$ct1.a2}";

say "Testing multi-constructor class alternate (positional) constructor";
my ConstructorTest2 $ct2 .= new(2, "geegaw");
say "\$ct2 {$ct2.a1} {$ct2.a2}";

say "Testing multi-constructor class alternate default named constructor";
my ConstructorTest2 $ct2_2 .= new(:a1(3), :a2<yoohoo>);
say "\$ct2_2 {$ct2_2.a1} {$ct2_2.a2}";




Output:

$ ./perl6 bugtest.pl
Testing vanilla class default named constructor
$ct1 1 foobar
Testing multi-constructor class alternate (positional) constructor
$ct2 2 geegaw
Testing multi-constructor class alternate default named constructor
Use of uninitialized value
Use of uninitialized value
$ct2_2



-- 

-Kevan Benson
-A-1 Networks

Reply via email to