From: Peter Rabbitson Date: Wed, 10 Nov 2010 22:57:40 +0000 (+0000) Subject: Fix some legacy code to stop warning on newer perls X-Git-Tag: v0.11008~35 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=56b9e6a566b09e57d63d8b854f80f84002ae0f14;p=dbsrgits%2FSQL-Translator.git Fix some legacy code to stop warning on newer perls --- diff --git a/Changes b/Changes index d908652..b30bfb3 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ * Add explicit Scalar::Util to the deplist for really old perls * Add support for PostGIS Geometry and Geography data types in the Pg producer +* Some minor fixes to squash warnings on new perls # ---------------------------------------------------------- # 0.11006 2010-06-03 diff --git a/lib/SQL/Translator/Parser/SQLite.pm b/lib/SQL/Translator/Parser/SQLite.pm index 55f6e8d..0188028 100644 --- a/lib/SQL/Translator/Parser/SQLite.pm +++ b/lib/SQL/Translator/Parser/SQLite.pm @@ -674,7 +674,7 @@ sub parse { for my $idata ( @{ $tdata->{'indices'} || [] } ) { my $index = $table->add_index( name => $idata->{'name'}, - type => uc $idata->{'type'}, + type => uc ($idata->{'type'}||''), fields => $idata->{'fields'}, ) or die $table->error; } diff --git a/t/32schema-lookups.t b/t/32schema-lookups.t index 265e5b9..a60e267 100644 --- a/t/32schema-lookups.t +++ b/t/32schema-lookups.t @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl -w # vim:filetype=perl # Before `make install' is performed this script should be runnable with @@ -16,7 +16,6 @@ use Data::Dumper; use SQL::Translator; use SQL::Translator::Schema; use SQL::Translator::Schema::Constants; -use UNIVERSAL qw/isa/; # Simple options. -d for debug my %opt; @@ -78,37 +77,30 @@ die "Test is schema is invalid! : ".$schema->err unless $schema->is_valid; # Testing 1,2,3,.. #============================================================================= -plan( tests => 14 ); +plan( tests => 15 ); my (@flds,@cons); @flds = $tbl_order->pkey_fields; is( join(",",@flds), "order_id", "pkey_fields" ); -ok( isa($flds[0], "SQL::Translator::Schema::Field"), - "pkey_fields returns SQL::Translator::Schema::Field" ); +isa_ok( $flds[0], "SQL::Translator::Schema::Field" ); @flds = $tbl_order->fkey_fields; is( join(",",@flds), "customer_id", "fkey_fields" ); -ok( isa($flds[0], "SQL::Translator::Schema::Field"), - "fkey_fields returns SQL::Translator::Schema::Field" ); +isa_ok( $flds[0], "SQL::Translator::Schema::Field" ); @flds = $tbl_order->nonpkey_fields; is( join(",",@flds), "customer_id,invoice_number,notes", "nonpkey_fields" ); -ok( - isa($flds[0], "SQL::Translator::Schema::Field") - && isa($flds[1], "SQL::Translator::Schema::Field"), - "nonpkey_fields returns SQL::Translator::Schema::Field's" -); +isa_ok( $flds[0], "SQL::Translator::Schema::Field" ); +isa_ok( $flds[1], "SQL::Translator::Schema::Field" ); @flds = $tbl_order->data_fields; is( join(",",@flds), "invoice_number,notes", "data_fields" ); -ok( isa($flds[0], "SQL::Translator::Schema::Field"), - "data_fields returns SQL::Translator::Schema::Field" ); +isa_ok( $flds[0], "SQL::Translator::Schema::Field" ); @flds = $tbl_order->unique_fields; is( join(",",@flds), "invoice_number", "unique_fields" ); -ok( isa($flds[0], "SQL::Translator::Schema::Field"), - "unique_fields returns SQL::Translator::Schema::Field" ); +isa_ok( $flds[0], "SQL::Translator::Schema::Field" ); @cons = $tbl_order->unique_constraints; is( scalar @cons, 1, "Number of unique_constraints is 1" );