X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FText%2FTradition%2FWitness.pm;fp=lib%2FText%2FTradition%2FWitness.pm;h=551d3ea38ea9f903ac1c0b08944c9c45b89b1d6c;hb=e4b0f4643062d1654a512ab882b9e0798d40248e;hp=dc38c0518008bb14a8b8fc069d1b3c763c895c19;hpb=255875b8b5d34bbb40eb4b101657e4ca0ac256d3;p=scpubgit%2Fstemmatology.git diff --git a/lib/Text/Tradition/Witness.pm b/lib/Text/Tradition/Witness.pm index dc38c05..551d3ea 100644 --- a/lib/Text/Tradition/Witness.pm +++ b/lib/Text/Tradition/Witness.pm @@ -174,44 +174,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;