From: Tara L Andrews Date: Fri, 28 Sep 2012 08:55:39 +0000 (+0200) Subject: make no-language-module warning less irritating X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=475e0be8f8e3e248559a54acacec8003adbdcbad;p=scpubgit%2Fstemmatology.git make no-language-module warning less irritating --- diff --git a/morphology/lib/Text/Tradition/Language.pm b/morphology/lib/Text/Tradition/Language.pm index 0f947b2..b43e7c3 100644 --- a/morphology/lib/Text/Tradition/Language.pm +++ b/morphology/lib/Text/Tradition/Language.pm @@ -30,7 +30,7 @@ use_ok( 'Text::Tradition' ); # with Language # Test setting and recovering language my $t = Text::Tradition->new( input => 'Self', file => 't/data/legendfrag.xml' ); -warning_like { $t->language( 'Klingon' ); } qr/^Cannot load language/, +warning_like { $t->language( 'Klingon' ); } qr/^Cannot load any language/, "Got expected warning for setting of unsupported language"; $t->language( 'English' ); is( $t->language, 'English', "Successfully set supported language" ); @@ -65,7 +65,7 @@ before 'language' => sub { try { load( "Text::Tradition::Language::".$_[0] ); } catch ( $e ) { - warn( "Cannot load language module for @_: $e" ); + warn "Cannot load any language module for @_"; } } }; diff --git a/morphology/lib/Text/Tradition/Morphology.pm b/morphology/lib/Text/Tradition/Morphology.pm index 7f8a93a..e3cdc5c 100644 --- a/morphology/lib/Text/Tradition/Morphology.pm +++ b/morphology/lib/Text/Tradition/Morphology.pm @@ -187,7 +187,6 @@ sub regularize { if( $self->has_language ) { # If we do have a language, regularize the tokens in $answer. my $mod = 'Text::Tradition::Language::' . $self->language; - my $rsub; eval { load( $mod ); }; # If a module doesn't exist for our language, use the base routine $mod = 'Text::Tradition::Language::Base' if $@; diff --git a/morphology/t/data/legendfrag.xml b/morphology/t/data/legendfrag.xml index 960a948..77fe60c 100644 --- a/morphology/t/data/legendfrag.xml +++ b/morphology/t/data/legendfrag.xml @@ -1436,12 +1436,6 @@ orthographic local - - oriundus - #LACUNA# - collated - local - svecia suetia diff --git a/morphology/t/text_tradition_language.t b/morphology/t/text_tradition_language.t index 92f736a..7454985 100644 --- a/morphology/t/text_tradition_language.t +++ b/morphology/t/text_tradition_language.t @@ -14,7 +14,7 @@ use_ok( 'Text::Tradition' ); # with Language # Test setting and recovering language my $t = Text::Tradition->new( input => 'Self', file => 't/data/legendfrag.xml' ); -warning_like { $t->language( 'Klingon' ); } qr/^Cannot load language/, +warning_like { $t->language( 'Klingon' ); } qr/^Cannot load any language/, "Got expected warning for setting of unsupported language"; $t->language( 'English' ); is( $t->language, 'English', "Successfully set supported language" );