Re: Was the attribute set in the constructor?

2009-11-03 Thread Jesse Luehrs
On Tue, Nov 03, 2009 at 11:09:19AM -0600, Evan Carroll wrote: > around 'attribute' => sub { > my ($next, $this, $key) = @_; > unless ( $this->meta->get_attribute('attribute')->has_init_arg ) { > if ( $key ) { > $self->has_attribute ? die 'exception' :

Re: Was the attribute set in the constructor?

2009-11-03 Thread Evan Carroll
around 'attribute' => sub { my ($next, $this, $key) = @_; unless ( $this->meta->get_attribute('attribute')->has_init_arg ) { if ( $key ) { $self->has_attribute ? die 'exception' : $this->$next($key); } else {

Re: Was the attribute set in the constructor?

2009-11-03 Thread Hans Dieter Pearcey
Excerpts from Evan Carroll's message of Tue Nov 03 11:55:04 -0500 2009: > has 'attribute' => ( isa => 'Str', is => 'rw', predicate => 'has_attribute' ); > > around 'attribute' => sub { > my ($next, $this, $key) = @_; > if ( $key ) { > $self->has_attribute ? die 'exception' : $this->$next($

Re: Was the attribute set in the constructor?

2009-11-03 Thread Evan Carroll
> This might be preferable to my suggestion if your object's methods are being > called mid-parse, rather than building up a data structure first and setting > attributes based on it after parsing is done.  Even then, I think I'd rather > have a separate method than modify the accessor. Yea that w

Re: Was the attribute set in the constructor?

2009-11-03 Thread Hans Dieter Pearcey
Excerpts from Evan Carroll's message of Tue Nov 03 11:38:47 -0500 2009: > On Tue, Nov 3, 2009 at 10:01 AM, Ovid wrote: > > When parsing documents, if my code finds more than one title in a document, > > it's an error because we don't know which title is needed. The user should > > be able to ov

Re: Was the attribute set in the constructor?

2009-11-03 Thread Evan Carroll
On Tue, Nov 3, 2009 at 10:01 AM, Ovid wrote: > When parsing documents, if my code finds more than one title in a document, > it's an error because we don't know which title is needed. The user should > be able to override this in the constructor and provide their own title (this > is actually

Re: Was the attribute set in the constructor?

2009-11-03 Thread Hans Dieter Pearcey
Excerpts from Ovid's message of Tue Nov 03 11:01:12 -0500 2009: > When parsing documents, if my code finds more than one title in a document, > it's an error because we don't know which title is needed. The > user should be able to override this in the constructor and provide their own > title (

Re: Was the attribute set in the constructor?

2009-11-03 Thread Jesse Luehrs
On Tue, Nov 03, 2009 at 08:01:12AM -0800, Ovid wrote: > When parsing documents, if my code finds more than one title in a document, > it's an error because we don't know which title is needed. The user should > be able to override this in the constructor and provide their own title (this > is a

Was the attribute set in the constructor?

2009-11-03 Thread Ovid
When parsing documents, if my code finds more than one title in a document, it's an error because we don't know which title is needed. The user should be able to override this in the constructor and provide their own title (this is actually true for several attributes): my $parser = Pod::Par