simplify Directory and add exceptions;
[scpubgit/stemmatology.git] / lib / Text / Tradition / Witness.pm
index dc38c05..776cebe 100644 (file)
@@ -32,7 +32,12 @@ Create a new witness.  Options include:
 =item * sigil - A short code to represent the manuscript.  Required.
 
 =item * text - An array of strings (words) that contains the text of the
-manuscript.
+manuscript.  This should not change after the witness has been instantiated,
+and the path through the collation should always match it.
+
+=item * layertext - An array of strings (words) that contains the layered text,
+if any, of the manuscript.  This should not change after the witness has been 
+instantiated, and the path through the collation should always match it.
 
 =item * source - A reference to the text, such as a filename, if it is not
 given in the 'text' option.
@@ -104,6 +109,12 @@ has 'text' => (
        isa => 'ArrayRef[Str]',
        predicate => 'has_text',
        );
+       
+has 'layertext' => (
+       is => 'rw',
+       isa => 'ArrayRef[Str]',
+       predicate => 'has_layertext',
+       );
 
 # Source.  This is where we read in the witness, if not from a
 # pre-prepared collation.  It is probably a filename.
@@ -174,44 +185,6 @@ sub BUILD {
        }
 }
 
-=begin testing
-
-use Text::Tradition;
-
-my $simple = 't/data/simple.txt';
-my $s = Text::Tradition->new( 
-    'name'  => 'inline', 
-    'input' => 'Tabular',
-    'file'  => $simple,
-    );
-my $wit_c = $s->witness( 'C' );
-is( ref( $wit_c ), 'Text::Tradition::Witness' ),;
-if( $wit_c ) {
-    ok( !$wit_c->has_text, "Text property not yet set" );
-    my $c_arr = $wit_c->text;
-    is( $c_arr->[0], 'Je', "Text constructed from path" );
-    ok( $wit_c->has_text, "Text property now set" );
-}
-
-=end testing
-
-=cut
-
-# If the text is not present, and the path is, and this is a 'get'
-# request, generate text from path.
-around text => sub {
-       my $orig = shift;
-       my $self = shift;
-
-       if( $self->has_path && !$self->has_text && !@_ ) {
-               my @words = map { $_->label } grep { !$_->is_meta } @{$self->path};
-               $self->$orig( \@words );
-       }
-       
-       $self->$orig( @_ );
-};
-
-
 no Moose;
 __PACKAGE__->meta->make_immutable;