From: Peter Rabbitson Date: Sun, 3 May 2009 01:45:10 +0000 (+0000) Subject: Improve xml database_event deprecation warning X-Git-Tag: v0.11008~178 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9768b204bf349afdbcf278f5fc06eb5077eb4aef;p=dbsrgits%2FSQL-Translator.git Improve xml database_event deprecation warning Only issue warning if show_warnings was set on translator Fix tests to suppress warn noise --- diff --git a/lib/SQL/Translator/Parser/XML/SQLFairy.pm b/lib/SQL/Translator/Parser/XML/SQLFairy.pm index f8135ce..3e2d68a 100644 --- a/lib/SQL/Translator/Parser/XML/SQLFairy.pm +++ b/lib/SQL/Translator/Parser/XML/SQLFairy.pm @@ -102,7 +102,7 @@ $VERSION = '1.59'; $DEBUG = 0 unless defined $DEBUG; use Data::Dumper; -use Carp; +use Carp::Clan qw/^SQL::Translator/; use Exporter; use base qw(Exporter); @EXPORT_OK = qw(parse); @@ -238,8 +238,8 @@ sub parse { /); # back compat - if (my $evt = $data{database_event}) { - carp 'The database_event tag is deprecated - please use database_events, which can take multiple comma separated event names'; + if (my $evt = $data{database_event} and $translator->{show_warnings}) { + carp 'The database_event tag is deprecated - please use database_events (which can take one or more comma separated event names)'; $data{database_events} = join (', ', $data{database_events} || (), $evt, diff --git a/t/18ttschema-producer.t b/t/18ttschema-producer.t index 67233ad..8485785 100644 --- a/t/18ttschema-producer.t +++ b/t/18ttschema-producer.t @@ -38,7 +38,7 @@ use SQL::Translator::Producer::TTSchema; { my $obj; $obj = SQL::Translator->new( - show_warnings => 1, + show_warnings => 0, from => "XML-SQLFairy", filename => "$Bin/data/xml/schema.xml", to => "TTSchema", @@ -65,7 +65,7 @@ use SQL::Translator::Producer::TTSchema; [%- END %]}; my $obj; $obj = SQL::Translator->new( - show_warnings => 1, + show_warnings => 0, from => "XML-SQLFairy", filename => "$Bin/data/xml/schema.xml", to => "TTSchema", diff --git a/t/34tt-base.t b/t/34tt-base.t index 02fdca8..30d62b2 100644 --- a/t/34tt-base.t +++ b/t/34tt-base.t @@ -26,7 +26,7 @@ use lib ("$Bin/lib"); my $obj; $obj = SQL::Translator->new( debug => 0, - show_warnings => 1, + show_warnings => 0, add_drop_table => 1, from => "XML-SQLFairy", filename => "$Bin/data/xml/schema.xml", diff --git a/t/43xml-to-db2.t b/t/43xml-to-db2.t index 223daf3..dbedbdb 100644 --- a/t/43xml-to-db2.t +++ b/t/43xml-to-db2.t @@ -20,7 +20,7 @@ my $xmlfile = "$Bin/data/xml/schema.xml"; my $sqlt; $sqlt = SQL::Translator->new( no_comments => 1, - show_warnings => 1, + show_warnings => 0, add_drop_table => 1, ); diff --git a/t/44-xml-to-db2-array.t b/t/44-xml-to-db2-array.t index 37c69cc..fa73159 100644 --- a/t/44-xml-to-db2-array.t +++ b/t/44-xml-to-db2-array.t @@ -20,7 +20,7 @@ my $xmlfile = "$Bin/data/xml/schema.xml"; my $sqlt; $sqlt = SQL::Translator->new( no_comments => 1, - show_warnings => 1, + show_warnings => 0, add_drop_table => 1, ); diff --git a/t/46xml-to-pg.t b/t/46xml-to-pg.t index dcf08af..c38d917 100644 --- a/t/46xml-to-pg.t +++ b/t/46xml-to-pg.t @@ -21,7 +21,7 @@ my $xmlfile = "$Bin/data/xml/schema.xml"; my $sqlt; $sqlt = SQL::Translator->new( no_comments => 1, - show_warnings => 1, + show_warnings => 0, add_drop_table => 1, );