Re: Error calling bless in non-default constructor

2007-05-15 Thread Matthew Keene
Thanks for all your help. Interestingly enough the .perl method reports that the parameter passed to the new method is stored in the object whether it's defined as an attribute or not: class MattTest { has Str $.bar ; submethod BUILD (:$foo) { say "passed $foo"; $.bar

Re: Error calling bless in non-default constructor

2007-05-15 Thread David Brunton
>I think so (after fixing a couple of minor typos). > >Does this mean that you can only pass defined attributes to a constructor ? >What if you want to pass parameters that are used during build but don't >actually need to be stored in the object ? Hopefully you don't mind my cc'ing the list-

Re: Error calling bless in non-default constructor

2007-05-15 Thread David Brunton
Is this what you're looking for? class MattTest { has Str $.string; submethod BUILD (:$string) { ## submethod BUILD is the constructor ## :$string is a named argument "string" say "passed $string"; } } my $test = MattTest(:stri