Skip Menu |

This queue is for tickets about the Geo-IATA CPAN distribution.

Report information
The Basics
Id: 87972
Status: open
Priority: 0/
Queue: Geo-IATA

People
Owner: Nobody in particular
Requestors: abeltje [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.0.3
Fixed in: (no value)



Subject: Two buglets (sqlite_unicode, database location)
Hi, I found two small bugs in the code, fixed by the attached patch. The database also needs to be regenerated. Thanks for this module. Good Luck!
Subject: patch.diff
commit f72bc673a8937b0457ef11f5a47f4c934b911abe Author: abeltje <abeltje@test-smoke.org> Date: Tue Aug 20 00:32:51 2013 +0200 Fix: sqlitedb file location; sqlite_unicode attribute for DBI->connect; Tests diff --git a/Geo-IATA/Geo-IATA-0.0.3/Build.PL b/Geo-IATA/Geo-IATA-0.0.3/Build.PL index 7dcc467..b20cb67 100644 --- a/Geo-IATA/Geo-IATA-0.0.3/Build.PL +++ b/Geo-IATA/Geo-IATA-0.0.3/Build.PL @@ -8,12 +8,13 @@ my $builder = Module::Build->new( dist_author => 'Joerg Meltzer <joerg <at> joergmeltzer.de>', dist_version_from => 'lib/Geo/IATA.pm', requires => { - 'Test::More' => 0, - 'version' => 0, - 'DBI' => 0, - 'DBD::SQLite' => 0, - 'Sub::Install' => 0, - }, + 'Test::More' => 0, + 'Test::NoWarnings' => 0, + 'version' => 0, + 'DBI' => 0, + 'DBD::SQLite' => 0, + 'Sub::Install' => 0, + }, add_to_cleanup => [ 'Geo-IATA-*' ], ); $builder->add_build_element('db'); diff --git a/Geo-IATA/Geo-IATA-0.0.3/lib/Geo/IATA.pm b/Geo-IATA/Geo-IATA-0.0.3/lib/Geo/IATA.pm index d41001a..62dd159 100644 --- a/Geo-IATA/Geo-IATA-0.0.3/lib/Geo/IATA.pm +++ b/Geo-IATA/Geo-IATA-0.0.3/lib/Geo/IATA.pm @@ -22,10 +22,10 @@ sub new { $db =~s{::}{/}gxms; $db =~s{$}{.pm}xms; ($path = $INC{$db}) =~ s{.pm$}{}xms; - $path="iata_sqlite.db"; + $path = File::Spec->catfile($path, "iata_sqlite.db"); } - my $dbh = DBI->connect("dbi:SQLite:dbname=$path","","", {RaiseError => 1, unicode=> 1}); + my $dbh = DBI->connect("dbi:SQLite:dbname=$path","","", {RaiseError => 1, sqlite_unicode=> 1}); return bless {dbh => $dbh, dbname => $path}, $pkg; } @@ -236,3 +236,5 @@ RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +=cut diff --git a/Geo-IATA/Geo-IATA-0.0.3/lib/Geo/IATA/iata_sqlite.db b/Geo-IATA/Geo-IATA-0.0.3/lib/Geo/IATA/iata_sqlite.db old mode 100755 new mode 100644 index a261d9e..2422dcd Binary files a/Geo-IATA/Geo-IATA-0.0.3/lib/Geo/IATA/iata_sqlite.db and b/Geo-IATA/Geo-IATA-0.0.3/lib/Geo/IATA/iata_sqlite.db differ diff --git a/Geo-IATA/Geo-IATA-0.0.3/t/01_basic.t b/Geo-IATA/Geo-IATA-0.0.3/t/01_basic.t index c5e7a31..82cf110 100644 --- a/Geo-IATA/Geo-IATA-0.0.3/t/01_basic.t +++ b/Geo-IATA/Geo-IATA-0.0.3/t/01_basic.t @@ -1,11 +1,12 @@ use strict; use warnings; -use Test::More tests => 4; # last test to print +use Test::More tests => 5; # last test to print +use Test::NoWarnings; use_ok("Geo::IATA"); my $iata; eval { - $iata=Geo::IATA->new("lib/Geo/IATA/iata_sqlite.db"); + $iata=Geo::IATA->new(); }; is ($@,'', "new doesn't die"); ok (defined $iata, "\$iata is defined"); diff --git a/Geo-IATA/Geo-IATA-0.0.3/t/02_simple.t b/Geo-IATA/Geo-IATA-0.0.3/t/02_simple.t index 55e2b3b..01e2b45 100644 --- a/Geo-IATA/Geo-IATA-0.0.3/t/02_simple.t +++ b/Geo-IATA/Geo-IATA-0.0.3/t/02_simple.t @@ -1,7 +1,8 @@ use strict; use warnings; -use Test::More tests => 6; # last test to print +use Test::More tests => 7; # last test to print +use Test::NoWarnings; use Geo::IATA; my $iata=Geo::IATA->new("lib/Geo/IATA/iata_sqlite.db"); is($iata->iata2icao("SXF"),'EDDB', "SXF => EDDB iata2icao");
I propose this less invasive patch to fix just the specific bug.
Subject: patch.txt
diff --git a/lib/Geo/IATA.pm b/lib/Geo/IATA.pm index d8381e1..1d0a3b2 100644 --- a/lib/Geo/IATA.pm +++ b/lib/Geo/IATA.pm @@ -22,7 +22,7 @@ sub new { $db =~s{::}{/}gxms; $db =~s{$}{.pm}xms; ($path = $INC{$db}) =~ s{.pm$}{}xms; - $path="iata_sqlite.db"; + $path = File::Spec->catfile($path, "iata_sqlite.db"); } my $dbh = DBI->connect("dbi:SQLite:dbname=$path","","", {RaiseError => 1, sqlite_unicode=> 1}); diff --git a/t/01_basic.t b/t/01_basic.t index c5e7a31..f6ed1cc 100644 --- a/t/01_basic.t +++ b/t/01_basic.t @@ -5,7 +5,7 @@ use Test::More tests => 4; # last test to print use_ok("Geo::IATA"); my $iata; eval { - $iata=Geo::IATA->new("lib/Geo/IATA/iata_sqlite.db"); + $iata=Geo::IATA->new(); }; is ($@,'', "new doesn't die"); ok (defined $iata, "\$iata is defined");