Hi all, Here is my third question for the list: sometimes I want to have a subclass- specific constant commonly implemented as a method in the subclass-hierarchy. So I can do something like:
[code] # For demonstration - untested. package XmlGenerator; sub _gen_paragraph_tag { my $self = shift; my $elem = shift; my $tag_name = $self->_get_paragraph_tag_name(); $self->_start_tag($tag_name); $self->_render_contents($elem); $self->_end_tag($tag_name); return; } package DocBook; extends('XmlGenerator'); sub _get_paragraph_tag_name { return "para"; } package HTML; extends('XmlGenerator'); sub _get_paragraph_tag_name { return "p"; } [/code] My question is whether there's a better way to do such a thing in Moose? (Note that it's unrelated to walkmeth - only the single, most specific, method should be called). I though of doing something like: [code] has '_get_paragraph_tag_name' => (is => 'ro', default => "para"); [/code] And maybe specialise it further using «has '+_get_paragraph_tag_name'», but it seems like it would be much more verbose. Just wondering if there's a Moose best practice ("MBP", heh.) here. Regards, Shlomi Fish -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Funny Anti-Terrorism Story - http://shlom.in/enemy God considered inflicting XSLT as the tenth plague of Egypt, but then decided against it because he thought it would be too evil. Please reply to list if it's a mailing list post - http://shlom.in/reply .