Fix some legacy code to stop warning on newer perls
Peter Rabbitson [Wed, 10 Nov 2010 22:57:40 +0000 (22:57 +0000)]
Changes
lib/SQL/Translator/Parser/SQLite.pm
t/32schema-lookups.t

diff --git a/Changes b/Changes
index d908652..b30bfb3 100644 (file)
--- 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
index 55f6e8d..0188028 100644 (file)
@@ -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;
         }
index 265e5b9..a60e267 100644 (file)
@@ -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" );