From afdbc56e71488d2cf662d3679556a8419883100b Mon Sep 17 00:00:00 2001 From: Andrew Yates Date: Thu, 18 Dec 2014 10:31:13 +0000 Subject: [PATCH 1/2] Stopping redefined subroutine warnings. Perl 5.16 and upwards did a lot of undefined subroutine warnings which really clutter up output. I moved the functions into a single XS package and had TabixIterator use the Tabix XS module directly. It probably isn't the best solution but it does stop the problem. --- .gitignore | 58 +++++++++++++++++++++++++++++++++++++++++++ perl/Tabix.pm | 30 ++++++++++++++++++++-- perl/Tabix.xs | 2 -- perl/TabixIterator.pm | 41 ------------------------------ 4 files changed, 86 insertions(+), 45 deletions(-) create mode 100644 .gitignore delete mode 100644 perl/TabixIterator.pm diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..98a26d4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,58 @@ +#### General stuff +/tabix +/bgzip +/perl/Tabix*.c + +#### C stuff +# Object files +*.o +*.ko +*.obj +*.elf + +# Precompiled Headers +*.gch +*.pch + +# Libraries +*.lib +*.a +*.la +*.lo + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + +#### Perl stuff +/perl/blib/ +/perl/.build/ +/perl/_build/ +/perl/cover_db/ +/perl/inc/ +/perl/Build +/perl/!Build/ +/perl/Build.bat +/perl/.last_cover_stats +/perl/Makefile +/perl/Makefile.old +/perl/MANIFEST.bak +/perl/META.yml +/perl/META.json +/perl/MYMETA.* +nytprof.out +/perl/pm_to_blib +*.o +*.bs + +/.perl-version diff --git a/perl/Tabix.pm b/perl/Tabix.pm index fd7165d..e5aa4e2 100644 --- a/perl/Tabix.pm +++ b/perl/Tabix.pm @@ -4,8 +4,6 @@ use strict; use warnings; use Carp qw/croak/; -use TabixIterator; - require Exporter; our @ISA = qw/Exporter/; @@ -72,5 +70,33 @@ sub getnames { return tabix_getnames($self->{_}); } +package TabixIterator; + +use strict; +use warnings; + +sub new { + my $invocant = shift; + my $class = ref($invocant) || $invocant; + my $self = {}; + bless($self, $class); + return $self; +} + +sub set { + my ($self, $iter) = @_; + $self->{_} = $iter; +} + +sub get { + my $self = shift; + return $self->{_}; +} + +sub DESTROY { + my $self = shift; + Tabix::tabix_iter_free($self->{_}) if ($self->{_}); +} + 1; __END__ diff --git a/perl/Tabix.xs b/perl/Tabix.xs index 50dabb1..b18134d 100644 --- a/perl/Tabix.xs +++ b/perl/Tabix.xs @@ -62,8 +62,6 @@ tabix_getnames(t) XPUSHs(sv_2mortal(newSVpv(names[i], 0))); free(names); -MODULE = Tabix PACKAGE = TabixIterator - void tabix_iter_free(iter) ti_iter_t iter diff --git a/perl/TabixIterator.pm b/perl/TabixIterator.pm deleted file mode 100644 index 335194a..0000000 --- a/perl/TabixIterator.pm +++ /dev/null @@ -1,41 +0,0 @@ -package TabixIterator; - -use strict; -use warnings; -use Carp qw/croak/; - -require Exporter; - -our @ISA = qw/Exporter/; -our @EXPORT = qw/tabix_iter_free/; - -our $VERSION = '0.2.0'; - -require XSLoader; -XSLoader::load('Tabix', $VERSION); - -sub new { - my $invocant = shift; - my $class = ref($invocant) || $invocant; - my $self = {}; - bless($self, $class); - return $self; -} - -sub set { - my ($self, $iter) = @_; - $self->{_} = $iter; -} - -sub get { - my $self = shift; - return $self->{_}; -} - -sub DESTROY { - my $self = shift; - tabix_iter_free($self->{_}) if ($self->{_}); -} - -1; -__END__ From 1db5ef6669a9a9e98cee726bab8983bc0e3ce3bb Mon Sep 17 00:00:00 2001 From: Andrew Yates Date: Fri, 19 Dec 2014 12:00:42 +0000 Subject: [PATCH 2/2] TabixIterator.pm has gone so removed from MANIFEST --- perl/MANIFEST | 1 - 1 file changed, 1 deletion(-) diff --git a/perl/MANIFEST b/perl/MANIFEST index 877da96..b27d9e2 100644 --- a/perl/MANIFEST +++ b/perl/MANIFEST @@ -2,7 +2,6 @@ MANIFEST typemap Tabix.xs Tabix.pm -TabixIterator.pm Makefile.PL t/01local.t t/02remote.t \ No newline at end of file