Subject: | perl 5.12 deprecation warnings |
I've found 2 deprecation warnings which need patching.
1. UNIVERSAL->import is deprecated. It's no longer appropriate to do use Universal qw/isa/;
2. uc() warns if undef is passed to it.
This patch corrects both.
Subject: | patch.txt |
commit 3ffaa20741057980f59b203beadae3cb5e1cbcd9
Author: Todd Rinaldo <toddr@cpan.org>
Date: Tue Nov 16 23:50:09 2010 -0600
fix perl 5.12 deprecation issues
diff --git a/lib/SQL/Translator/Parser/SQLite.pm b/lib/SQL/Translator/Parser/SQLite.pm
index 55f6e8d..69add66 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..5a79f75 100644
--- a/t/32schema-lookups.t
+++ b/t/32schema-lookups.t
@@ -16,7 +16,7 @@ use Data::Dumper;
use SQL::Translator;
use SQL::Translator::Schema;
use SQL::Translator::Schema::Constants;
-use UNIVERSAL qw/isa/;
+use UNIVERSAL;
# Simple options. -d for debug
my %opt;
@@ -84,30 +84,30 @@ my (@flds,@cons);
@flds = $tbl_order->pkey_fields;
is( join(",",@flds), "order_id", "pkey_fields" );
-ok( isa($flds[0], "SQL::Translator::Schema::Field"),
+ok( UNIVERSAL::isa($flds[0], "SQL::Translator::Schema::Field"),
"pkey_fields returns SQL::Translator::Schema::Field" );
@flds = $tbl_order->fkey_fields;
is( join(",",@flds), "customer_id", "fkey_fields" );
-ok( isa($flds[0], "SQL::Translator::Schema::Field"),
+ok( UNIVERSAL::isa($flds[0], "SQL::Translator::Schema::Field"),
"fkey_fields returns 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"),
+ UNIVERSAL::isa($flds[0], "SQL::Translator::Schema::Field")
+ && UNIVERSAL::isa($flds[1], "SQL::Translator::Schema::Field"),
"nonpkey_fields returns SQL::Translator::Schema::Field's"
);
@flds = $tbl_order->data_fields;
is( join(",",@flds), "invoice_number,notes", "data_fields" );
-ok( isa($flds[0], "SQL::Translator::Schema::Field"),
+ok( UNIVERSAL::isa($flds[0], "SQL::Translator::Schema::Field"),
"data_fields returns SQL::Translator::Schema::Field" );
@flds = $tbl_order->unique_fields;
is( join(",",@flds), "invoice_number", "unique_fields" );
-ok( isa($flds[0], "SQL::Translator::Schema::Field"),
+ok( UNIVERSAL::isa($flds[0], "SQL::Translator::Schema::Field"),
"unique_fields returns SQL::Translator::Schema::Field" );
@cons = $tbl_order->unique_constraints;