Sartak wrote: > Does it have to be a full attribute? It could just be a method that > returns a constant. I often have this in my classes: > > package Parent; > use constant needs_trinket => 0; > > package Child; > use constant needs_trinket => 1;
No, it doesn't have to be a full attribute... And I'm ashamed I didn't think of adding a simple method. That works beautifully. > > Otherwise, if you need a full attribute, you could use: > > has needs_trinket => ( > init_arg => undef, # I think this works... > is => 'ro', > default => 0, > ); It does work indeed. I'm adding that to my Moose notes! Searching the Class::MOP documentation (which I haven't read yet with the attention it probably deserves), in Class::MOP::Attribute it says this: "If an explicit undef is given for an init_arg, an attribute value can't be specified during initialization." So there it is, in all its glory. Thanks for your help. Not one day goes by without learning something new. Bernardo