Re: Best way of implementing "Walkmeth" in Moose

2010-04-27 Thread Daniel Pittman
Shlomi Fish writes: > On Tuesday 27 Apr 2010 15:51:07 Stevan Little wrote: >> On Apr 27, 2010, at 3:36 AM, Shlomi Fish wrote: >> > >> > 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

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, nami

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 b

Re: Design Question: Subclass-specific Constants

2010-04-27 Thread Dave Rolsky
On Tue, 27 Apr 2010, Hans Dieter Pearcey wrote: On Tue, 27 Apr 2010 10:54:06 -0500 (CDT), Dave Rolsky 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 c

Re: Design Question: Subclass-specific Constants

2010-04-27 Thread Ovid
- Original Message > From: Dave Rolsky > 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 a "para

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 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 your pare

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 =

Design Question: Subclass-specific Constants

2010-04-27 Thread Shlomi Fish
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

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 eac

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 impleme

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 0.1.

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: * http://blog