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($key);
> }
> else {
> $this->$next
> }
> };
Looking at this again, it doesn't actually do what I think Ovid wants, namely:
* Ignore all titles from the document if one was passed to the constructor
* Die on > 1 title from the document otherwise
Your code will die on any title in the document if one was passed to the
constructor.
hdp.