various bugfixes, getting real traditions to parse
[scpubgit/stemmatology.git] / lib / Text / Tradition / Collation / Reading.pm
index b77649a..d0d0385 100644 (file)
@@ -1,7 +1,7 @@
 package Text::Tradition::Collation::Reading;
 
 use Moose;
-use overload '""' => \&_stringify;
+use overload '""' => \&_stringify, 'fallback' => 1;
 use Text::Tradition::Collation;
 
 =head1 NAME
@@ -78,6 +78,7 @@ has 'text' => (
        is => 'ro',
        isa => 'Str',
        required => 1,
+       writer => 'alter_text',
        );
 
 has 'is_start' => (
@@ -118,7 +119,7 @@ around BUILDARGS => sub {
        # If one of our special booleans is set, we change the text and the
        # ID to match.
        
-       if( exists $args->{'is_lacuna'} ) {
+       if( exists $args->{'is_lacuna'} && !exists $args->{'text'} ) {
                $args->{'text'} = sprintf( "#LACUNA_%s#", $args->{'id'} );
        } elsif( exists $args->{'is_start'} ) {
                $args->{'id'} = '#START#';  # Change the ID to ensure we have only one
@@ -151,6 +152,12 @@ sub related_readings {
        return $self->collation->related_readings( $self, @_ );
 }
 
+sub set_identical {
+       my( $self, $other ) = @_;
+       return $self->collation->add_relationship( $self, $other, 
+               { 'type' => 'transposition' } );
+}
+
 sub _stringify {
        my $self = shift;
        return $self->id;