Using new Rect with v2.2.2.11. Had to change getClipRect paramters.
[sdlgit/SDL_perl.git] / lib / SDL.pm
index 8def190..0778469 100644 (file)
@@ -31,6 +31,9 @@
 package SDL;
 
 use strict;
+use warnings;
+use Carp;
+
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
 
 require Exporter;
@@ -44,12 +47,18 @@ BEGIN {
        @EXPORT = qw( in verify &NULL );
 };
 
+# Give our caller SDL::Constant's stuff as well as ours.
+sub import {
+  my $self = shift;
 
-$VERSION = '2.2.1';
+  $self->export_to_level(1, @_);
+  SDL::Constants->export_to_level(1);
+}
+$VERSION = '2.2.2.11';
 
 print "$VERSION" if (defined($ARGV[0]) && ($ARGV[0] eq '--SDLperl'));
 
-$SDL::DEBUG=1;
+$SDL::DEBUG=0;
 
 sub NULL {
        return 0;
@@ -57,13 +66,17 @@ sub NULL {
 
 sub in {
        my ($k,@t) = @_;
-       (scalar grep { defined $_ && $_ eq $k } @t) <=> 0;
+       return 0 unless defined $k;
+       my $r = ((scalar grep { defined $_ && $_ eq $k } @t) <=> 0);
+       return 0 if $r eq '';
+       return $r;
+
 } 
 
 sub verify (\%@) {
        my ($options,@valid_options) = @_;
        for (keys %$options) {
-               die "Invalid option $_\n" unless in ($_, @valid_options);
+               croak "Invalid option $_\n" unless in ($_, @valid_options);
        }
 }