Best way of implementing Walkmeth in Moose

2010-04-27 Thread Shlomi Fish
Hi all! After merging XML-Grammar-Fiction and XML-Grammar-Screenplay, I have accumulated several questions about Moose, so I'd post each one in a separate post to keep each thread single-topic. (I hope it's OK.) The first one is how to implement a Class::Std/Perl 6-like walkmeth: *

XML-Grammar-Fiction's Tests Succeed Normally and Die under ./Build testcover

2010-04-27 Thread Shlomi Fish
Hi all, When I run XML-Grammar-Fiction's tests, they succeed normally and die due to uncaught exceptions under ./Build testcover: [quote] shlomi:$trunk/perl/modules/XML-Grammar-Fiction$ ./Build test t/00-load.t ... 1/1 # Testing XML::Grammar::Fiction

Re: Best way of implementing Walkmeth in Moose

2010-04-27 Thread Stevan Little
On Apr 27, 2010, at 3:36 AM, Shlomi Fish wrote: Hi all! After merging XML-Grammar-Fiction and XML-Grammar-Screenplay, I have accumulated several questions about Moose, so I'd post each one in a separate post to keep each thread single-topic. (I hope it's OK.) The first one is how to

Re: Best way of implementing Walkmeth in Moose

2010-04-27 Thread Shlomi Fish
On Tuesday 27 Apr 2010 15:51:07 Stevan Little wrote: On Apr 27, 2010, at 3:36 AM, Shlomi Fish wrote: Hi all! After merging XML-Grammar-Fiction and XML-Grammar-Screenplay, I have accumulated several questions about Moose, so I'd post each one in a separate post to keep each thread

Re: Design Question: Subclass-specific Constants

2010-04-27 Thread Dave Rolsky
On Tue, 27 Apr 2010, Shlomi Fish wrote: [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. I would do this ... has _paragraph_name = ( is =

Re: Design Question: Subclass-specific Constants

2010-04-27 Thread Hans Dieter Pearcey
On Tue, 27 Apr 2010 10:54:06 -0500 (CDT), Dave Rolsky auta...@urth.org wrote: has _paragraph_name = ( is = 'ro', builder = '_build_paragraph_name' ); Then in the parent class: sub _build_paragraph_name { die 'This method must be overridden in the child' } Alternately, turn

Re: Design Question: Subclass-specific Constants

2010-04-27 Thread Ovid
- Original Message From: Dave Rolsky auta...@urth.org I would do this ... has _paragraph_name = ( is = 'ro', builder = '_build_paragraph_name' ); Then in the parent class: sub _build_paragraph_name { die 'This method must be overridden in the child' } Why not just define

Re: Design Question: Subclass-specific Constants

2010-04-27 Thread Shlomi Fish
On Tuesday 27 Apr 2010 18:54:06 Dave Rolsky wrote: On Tue, 27 Apr 2010, Shlomi Fish wrote: [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

Re: Design Question: Subclass-specific Constants

2010-04-27 Thread Dave Rolsky
On Tue, 27 Apr 2010, Shlomi Fish wrote: Wouldn't it mean that perl will call the _build_paragraph_name of the sub- class upon every instantiation of an object? I could be prematurely micro- optimising in thinking that it matters, though. Yes, you are prematurely optimizing. As an aside,