X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FText%2FTradition%2FWitness.pm;h=dc38c0518008bb14a8b8fc069d1b3c763c895c19;hb=b74d89f9e926466ba4ded77746fd0f98912cc17a;hp=5010ffe7bcc1ea343a5fff49a3e977aa92cdff66;hpb=3837c155d39333869a93adf1e8375960ffbf3a92;p=scpubgit%2Fstemmatology.git diff --git a/lib/Text/Tradition/Witness.pm b/lib/Text/Tradition/Witness.pm index 5010ffe..dc38c05 100644 --- a/lib/Text/Tradition/Witness.pm +++ b/lib/Text/Tradition/Witness.pm @@ -65,15 +65,10 @@ Accessor method for the witness identifier. Accessor method for the general witness description. -=head2 path +=head2 is_layered -An array of Text::Tradition::Collation::Reading objects which, taken in -sequence, represent the text. - -=head2 uncorrected_path - -An array of Text::Tradition::Collation::Reading objects which, taken in -sequence, represent the text before any scribal corrections were made. +Boolean method to note whether the witness has layers (e.g. pre-correction +readings) in the collation. =begin testing @@ -118,18 +113,24 @@ has 'source' => ( predicate => 'has_source', ); -# Path. This is an array of Reading nodes that should mirror the -# text above. +# Path. This is an array of Reading nodes that can be saved during +# initialization, but should be cleared before saving in a DB. has 'path' => ( is => 'rw', isa => 'ArrayRef[Text::Tradition::Collation::Reading]', predicate => 'has_path', + clearer => 'clear_path', ); has 'uncorrected_path' => ( is => 'rw', isa => 'ArrayRef[Text::Tradition::Collation::Reading]', - predicate => 'has_ante_corr', + clearer => 'clear_uncorrected_path', + ); + +has 'is_layered' => ( + is => 'rw', + isa => 'Bool', ); # Manuscript name or similar @@ -144,6 +145,14 @@ has 'other_info' => ( isa => 'Str', ); +# If we set an uncorrected path, ever, remember that we did so. +around 'uncorrected_path' => sub { + my $orig = shift; + my $self = shift; + + $self->is_layered( 1 ); + $self->$orig( @_ ); +}; sub BUILD { my $self = shift; @@ -202,6 +211,7 @@ around text => sub { $self->$orig( @_ ); }; + no Moose; __PACKAGE__->meta->make_immutable;