From: Kartik Thakore Date: Tue, 4 Aug 2009 11:04:44 +0000 (-0400) Subject: Brought all packages under eye of strict, warnings and love of Carp, For X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=084b921f85583af6a5b82572f6a561c94dd2fb5d;p=sdlgit%2FSDL_perl.git Brought all packages under eye of strict, warnings and love of Carp, For debugging help. Also removed forced die in Build of MSWin32. --- diff --git a/Build.PL b/Build.PL index 019ea64..6bed354 100644 --- a/Build.PL +++ b/Build.PL @@ -5,7 +5,8 @@ # Copyright (C) 2009 Kartik Thakore use strict; - +use warnings; +use Carp; use lib 'make/lib'; use SDL::Build; @@ -17,7 +18,7 @@ my $sdl_link_flags = `sdl-config --libs`; if ($? >> 8) { - die "SDL doesn't appear to be installed.\n" . + croak "SDL doesn't appear to be installed.\n" . "Please check that sdl-config is in your path and try again.\n"; } diff --git a/lib/SDL.pm b/lib/SDL.pm index 3bc998f..0fdf435 100644 --- a/lib/SDL.pm +++ b/lib/SDL.pm @@ -1,10 +1,13 @@ # # Copyright (C) 2004 David J. Goehrig -# +# Copyright (C) 2009 Kartik Thakore package SDL; use strict; +use warnings; +use Carp; + use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); require Exporter; @@ -41,7 +44,7 @@ sub in { 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); } } diff --git a/lib/SDL/App.pm b/lib/SDL/App.pm index fe61fe5..6a3fa1f 100644 --- a/lib/SDL/App.pm +++ b/lib/SDL/App.pm @@ -8,6 +8,8 @@ package SDL::App; use strict; +use warnings; +use Carp; use SDL; use SDL::Event; use SDL::Surface; @@ -82,7 +84,7 @@ sub new { } my $self = \SDL::SetVideoMode($w,$h,$d,$f); $$self - or die SDL::GetError(); + or croak SDL::GetError(); if ($ic and -e $ic) { my $icon = new SDL::Surface -name => $ic; @@ -176,7 +178,7 @@ sub attribute ($$;$) { SDL::GLSetAttribute($mode,$value); } my $returns = SDL::GLGetAttribute($mode); - die "SDL::App::attribute failed to get GL attribute" if ($$returns[0] < 0); + croak "SDL::App::attribute failed to get GL attribute" if ($$returns[0] < 0); $$returns[1]; } @@ -331,11 +333,12 @@ or OpenGL buffer if applicable. This is prefered to calling flip on the applica C allows one to set and get GL attributes. By passing a value in addition to the attribute selector, the value will be set. C -always returns the current value of the given attribute, or dies on failure. +always returns the current value of the given attribute, or croaks on failure. =head1 AUTHOR David J. Goehrig +Kartik Thakore =head1 SEE ALSO diff --git a/lib/SDL/Cdrom.pm b/lib/SDL/Cdrom.pm index c70608f..1ad2471 100644 --- a/lib/SDL/Cdrom.pm +++ b/lib/SDL/Cdrom.pm @@ -7,6 +7,8 @@ package SDL::Cdrom; use strict; +use warnings; +use Carp; BEGIN { use Exporter(); @@ -21,7 +23,7 @@ sub new { my $self; my $number = shift; $self = \SDL::CDOpen($number); - die SDL::GetError() if ( SDL::CD_ERROR() eq SDL::CDStatus($$self)); + croak SDL::GetError() if ( SDL::CD_ERROR() eq SDL::CDStatus($$self)); bless $self,$class; return $self; } diff --git a/lib/SDL/Color.pm b/lib/SDL/Color.pm index 33bc4e3..6a8f36f 100644 --- a/lib/SDL/Color.pm +++ b/lib/SDL/Color.pm @@ -7,6 +7,8 @@ package SDL::Color; use strict; +use warnings; +use Carp; use SDL; sub new { @@ -24,7 +26,7 @@ sub new { if ($options{-color}) { $self = \$options{-color}; } elsif ($options{-pixel} && $options{-surface}) { - die "SDL::Color::new requires an SDL::Surface" + croak "SDL::Color::new requires an SDL::Surface" unless !$SDL::DEBUG || $options{-surface}->isa("SDL::Surface"); $self = \SDL::NewColor(SDL::GetRGB(${$options{-surface}}, $options{-pixel})); } else { @@ -34,7 +36,7 @@ sub new { push @color, $options{-blue} || $options{-b} || 0; $self = \SDL::NewColor(@color); } - die "Could not create color, ", SDL::GetError(), "\n" + croak "Could not create color, ", SDL::GetError(), "\n" unless ($$self); bless $self, $class; } @@ -64,7 +66,7 @@ sub rgb { } sub pixel { - die "SDL::Color::pixel requires an SDL::Surface" + croak "SDL::Color::pixel requires an SDL::Surface" unless !$SDL::DEBUG || $_[1]->isa("SDL::Surface"); SDL::MapRGB(${$_[1]},$_[0]->r(),$_[0]->g(),$_[0]->b()); } diff --git a/lib/SDL/Cursor.pm b/lib/SDL/Cursor.pm index f84c50d..34598b7 100644 --- a/lib/SDL/Cursor.pm +++ b/lib/SDL/Cursor.pm @@ -5,6 +5,8 @@ package SDL::Cursor; use strict; +use warnings; +use Carp; sub new { my $proto = shift; diff --git a/lib/SDL/Event.pm b/lib/SDL/Event.pm index dd21aff..00da15e 100644 --- a/lib/SDL/Event.pm +++ b/lib/SDL/Event.pm @@ -9,6 +9,9 @@ package SDL::Event; use strict; +use warnings; +use Carp; + use SDL; sub new { diff --git a/lib/SDL/Font.pm b/lib/SDL/Font.pm index 62d7387..c49a982 100644 --- a/lib/SDL/Font.pm +++ b/lib/SDL/Font.pm @@ -7,6 +7,8 @@ package SDL::Font; use strict; +use warnings; +use Carp; use SDL; use SDL::SFont; use SDL::Surface; diff --git a/lib/SDL/MPEG.pm b/lib/SDL/MPEG.pm index b16ae3b..bf16eab 100644 --- a/lib/SDL/MPEG.pm +++ b/lib/SDL/MPEG.pm @@ -8,6 +8,8 @@ package SDL::MPEG; use strict; +use warnings; +use Carp; use SDL; sub new { @@ -19,7 +21,7 @@ sub new { my $self; if ( $options{-from} ) { - die "SDL::MPEG::new -from requires a SDL::Video object\n" + croak "SDL::MPEG::new -from requires a SDL::Video object\n" unless $options{-from}->isa('SDL::Video'); $self = \SDL::SMPEGGetInfo(${$options{-from}}); diff --git a/lib/SDL/Mixer.pm b/lib/SDL/Mixer.pm index ff9a29e..94d0fb4 100644 --- a/lib/SDL/Mixer.pm +++ b/lib/SDL/Mixer.pm @@ -7,6 +7,9 @@ package SDL::Mixer; use strict; +use warnings; +use Carp; + use SDL; use SDL::Sound; use SDL::Music; @@ -27,7 +30,7 @@ sub new { my $size = $options{-size} || 4096; unless ( $SDL::Mixer::initialized ) { SDL::MixOpenAudio($frequency,$format,$channels,$size ) && - die SDL::GetError(); + croak SDL::GetError(); $SDL::Mixer::initialized = 1; } else { ++$SDL::Mixer::initialized; diff --git a/lib/SDL/Music.pm b/lib/SDL/Music.pm index 402030d..d9b6f66 100644 --- a/lib/SDL/Music.pm +++ b/lib/SDL/Music.pm @@ -6,6 +6,8 @@ package SDL::Music; use strict; +use warnings; +use Carp; use SDL; sub new { diff --git a/lib/SDL/OpenGL.pm b/lib/SDL/OpenGL.pm index 56b8887..4064186 100644 --- a/lib/SDL/OpenGL.pm +++ b/lib/SDL/OpenGL.pm @@ -7,6 +7,10 @@ package SDL::OpenGL; +use strict; +use warnings; +use Carp; + require Exporter; require DynaLoader; use vars qw( @@ -18,6 +22,7 @@ use vars qw( use SDL; use SDL::OpenGL::Constants; + bootstrap SDL::OpenGL; for ( keys %SDL::OpenGL:: ) { if (/^gl/) { diff --git a/lib/SDL/Palette.pm b/lib/SDL/Palette.pm index 8f388af..40ea970 100644 --- a/lib/SDL/Palette.pm +++ b/lib/SDL/Palette.pm @@ -7,6 +7,8 @@ package SDL::Palette; use strict; +use warnings; +use Carp; # NB: there is no palette destructor because most of the time the # palette will be owned by a surface, so any palettes you create diff --git a/lib/SDL/Rect.pm b/lib/SDL/Rect.pm index 850fd13..13f05d2 100644 --- a/lib/SDL/Rect.pm +++ b/lib/SDL/Rect.pm @@ -7,6 +7,8 @@ package SDL::Rect; use strict; +use warnings; +use Carp; use SDL; sub new { diff --git a/lib/SDL/Sound.pm b/lib/SDL/Sound.pm index c2312a0..6b2eff6 100644 --- a/lib/SDL/Sound.pm +++ b/lib/SDL/Sound.pm @@ -7,7 +7,8 @@ package SDL::Sound; use strict; - +use warnings; +use Carp; sub new { my $proto = shift; my $class = ref($proto) || $proto; diff --git a/lib/SDL/Surface.pm b/lib/SDL/Surface.pm index 1348875..95b07f1 100644 --- a/lib/SDL/Surface.pm +++ b/lib/SDL/Surface.pm @@ -8,6 +8,8 @@ package SDL::Surface; use strict; +use warnings; +use Carp; use SDL; use SDL::SFont; use SDL::Color; @@ -47,7 +49,7 @@ sub new { $self = \SDL::CreateRGBSurface($f,$w,$h,$d,$r,$g,$b,$a); } } - die "SDL::Surface::new failed. ", SDL::GetError() + croak "SDL::Surface::new failed. ", SDL::GetError() unless ( $$self); bless $self,$class; return $self; @@ -130,7 +132,7 @@ sub pixels { } sub pixel { - die "SDL::Surface::pixel requires a SDL::Color" + croak "SDL::Surface::pixel requires a SDL::Color" if $_[3] && $SDL::DEBUG && !$_[3]->isa("SDL::Color"); $_[3] ? new SDL::Color -color => SDL::SurfacePixel(${$_[0]},$_[1],$_[2],${$_[3]}) : @@ -138,9 +140,9 @@ sub pixel { } sub fill { - die "SDL::Surface::fill requires a SDL::Rect object" + croak "SDL::Surface::fill requires a SDL::Rect object" unless !$SDL::DEBUG || $_[1] == 0 || $_[1]->isa('SDL::Rect'); - die "SDL::Surface::fill requires a SDL::Color object" + croak "SDL::Surface::fill requires a SDL::Color object" unless !$SDL::DEBUG || $_[2]->isa('SDL::Color'); if ($_[1] == 0 ) { SDL::FillRect(${$_[0]},0,${$_[2]}); @@ -165,7 +167,7 @@ sub update { my $self = shift;; if ($SDL::DEBUG) { for (@_) { - die "SDL::Surface::update requires SDL::Rect objects" + croak "SDL::Surface::update requires SDL::Rect objects" unless $_->isa('SDL::Rect'); } } @@ -178,10 +180,10 @@ sub flip { sub blit { if ($SDL::DEBUG) { - die "SDL::Surface::blit requires SDL::Rect objects" + croak "SDL::Surface::blit requires SDL::Rect objects" unless ($_[1] == 0 || $_[1]->isa('SDL::Rect')) && ($_[3] == 0 || $_[3]->isa('SDL::Rect')); - die "SDL::Surface::blit requires SDL::Surface objects" + croak "SDL::Surface::blit requires SDL::Surface objects" unless $_[2]->isa('SDL::Surface'); } SDL::BlitSurface(map { $_ != 0 ? ${$_} : $_ } @_); @@ -191,14 +193,14 @@ sub set_colors { my $self = shift; my $start = shift; for (@_) { - die "SDL::Surface::set_colors requires SDL::Color objects" + croak "SDL::Surface::set_colors requires SDL::Color objects" unless !$SDL::DEBUG || $_->isa('SDL::Color'); } return SDL::SetColors($$self, $start, map { ${$_} } @_); } sub set_color_key { - die "SDL::Surface::set_color_key requires a SDL::Color object" + croak "SDL::Surface::set_color_key requires a SDL::Color object" unless !$SDL::DEBUG || (ref($_[2]) && $_[2]->isa('SDL::Color')); SDL::SetColorKey(${$_[0]},$_[1],${$_[2]}); } diff --git a/lib/SDL/TTFont.pm b/lib/SDL/TTFont.pm index 9bb180d..ab9387e 100644 --- a/lib/SDL/TTFont.pm +++ b/lib/SDL/TTFont.pm @@ -8,6 +8,8 @@ package SDL::TTFont; use strict; +use warnings; +use Carp; use SDL; use SDL::Surface; @@ -27,15 +29,15 @@ sub new { $self->{-fg} = $options{-foreground} || $options{-fg} || $SDL::Color::black; $self->{-bg} = $options{-background} || $options{-bg} || $SDL::Color::white; - die "SDL::TTFont::new requires a -name\n" + croak "SDL::TTFont::new requires a -name\n" unless ($$self{-name}); - die "SDL::TTFont::new requires a -size\n" + croak "SDL::TTFont::new requires a -size\n" unless ($$self{-size}); $self->{-font} = SDL::TTFOpenFont($self->{-name},$self->{-size}); - die "Could not open font $$self{-name}, ", SDL::GetError(), "\n" + croak "Could not open font $$self{-name}, ", SDL::GetError(), "\n" unless ($self->{-font}); bless $self,$class; @@ -51,7 +53,7 @@ sub DESTROY { sub print { my ($self,$surface,$x,$y,@text) = @_; - die "Print requies an SDL::Surface" + croak "Print requies an SDL::Surface" unless( ref($surface) && $surface->isa("SDL::Surface") ); SDL::FreeSurface($self->{-surface}) if ($$self{-surface}); @@ -59,7 +61,7 @@ sub print { $$self{-surface} = SDL::TTFPutString($$self{-font},$$self{-mode}, $$surface,$x,$y,${$$self{-fg}},${$$self{-bg}},join("",@text)); - die "Could not print \"", join("",@text), "\" to surface, ", + croak "Could not print \"", join("",@text), "\" to surface, ", SDL::GetError(), "\n" unless ($$self{-surface}); } @@ -150,7 +152,7 @@ sub unicode_blended { $$self{-mode} = UNICODE_BLENDED(); } -die "Could not initialize True Type Fonts\n" +croak "Could not initialize True Type Fonts\n" if ( SDL::TTFInit() < 0); 1; diff --git a/lib/SDL/Timer.pm b/lib/SDL/Timer.pm index b60c42d..aaacdd3 100644 --- a/lib/SDL/Timer.pm +++ b/lib/SDL/Timer.pm @@ -6,6 +6,8 @@ package SDL::Timer; use strict; +use warnings; +use Carp; use SDL; sub new { @@ -17,7 +19,7 @@ sub new { verify(%options,qw/ -delay -times -d -t /); - die "SDL::Timer::new no delay specified\n" + croak "SDL::Timer::new no delay specified\n" unless ($options{-delay}); $$self{-delay} = $options{-delay} || $options{-d} || 0; $$self{-times} = $options{-times} || $options{-t} || 0; @@ -27,7 +29,7 @@ sub new { $$self{-routine} = sub { &$func; $$self{-delay}}; } $$self{-timer} = SDL::NewTimer($$self{-delay},$$self{-routine}); - die "Could not create timer, ", SDL::GetError(), "\n" + croak "Could not create timer, ", SDL::GetError(), "\n" unless ($self->{-timer}); bless $self,$class; return $self; diff --git a/lib/SDL/Tool/Font.pm b/lib/SDL/Tool/Font.pm index 02b5c39..637e5ab 100644 --- a/lib/SDL/Tool/Font.pm +++ b/lib/SDL/Tool/Font.pm @@ -5,6 +5,10 @@ package SDL::Tool::Font; +use strict; +use warnings; +use Carp; + use SDL; use SDL::Font; use SDL::TTFont; @@ -12,7 +16,7 @@ use SDL::TTFont; sub new { my $proto = shift; my $class = ref($proto) || $proto; - $self = {}; + my $self = {}; my %option = @_; verify (%option, qw/ -sfont -ttfont -size -fg -bg -foreground -background @@ -33,7 +37,7 @@ sub new { } } } else { - die "SDL::Tool::Font requires either a -sfont or -ttfont"; + croak "SDL::Tool::Font requires either a -sfont or -ttfont"; } bless $self,$class; $self; @@ -45,7 +49,7 @@ sub DESTROY { sub print { my ($self,$surface,$x,$y,@text) = @_; - die "Tool::Font::print requires a SDL::Surface\n" + croak "Tool::Font::print requires a SDL::Surface\n" unless ($surface->isa('SDL::Surface')); if ($$self{-font}->isa('SDL::Font')) { $$self{-font}->use(); diff --git a/lib/SDL/Tool/Graphic.pm b/lib/SDL/Tool/Graphic.pm index 049b31d..780fdc2 100644 --- a/lib/SDL/Tool/Graphic.pm +++ b/lib/SDL/Tool/Graphic.pm @@ -6,6 +6,9 @@ package SDL::Tool::Graphic; +use strict; +use warnings; +use Carp; use SDL; use SDL::Config; require SDL::Surface; @@ -13,7 +16,7 @@ require SDL::Surface; sub new { my $proto = shift; my $class = ref($proto) || $proto; - $self = {}; + my $self = {}; bless $self, $class; $self; } @@ -26,7 +29,7 @@ sub DESTROY { sub zoom { my ( $self, $surface, $zoomx, $zoomy, $smooth) = @_; - die "SDL::Tool::Graphic::zoom requires an SDL::Surface\n" + croak "SDL::Tool::Graphic::zoom requires an SDL::Surface\n" unless ( ref($surface) && $surface->isa('SDL::Surface')); my $tmp = $$surface; $$surface = SDL::GFXZoom($$surface, $zoomx, $zoomy, $smooth); @@ -36,7 +39,7 @@ sub zoom { sub rotoZoom { my ( $self, $surface, $angle, $zoom, $smooth) = @_; - die "SDL::Tool::Graphic::rotoZoom requires an SDL::Surface\n" + croak "SDL::Tool::Graphic::rotoZoom requires an SDL::Surface\n" unless ( ref($surface) && $surface->isa('SDL::Surface')); my $tmp = $$surface; $$surface = SDL::GFXRotoZoom($$surface, $angle, $zoom, $smooth); @@ -46,8 +49,9 @@ sub rotoZoom { sub grayScale { my ( $self, $surface ) = @_; + my $workingSurface; if($surface->isa('SDL::Surface')) { - $workingSurface = $$surface; + $workingSurface = $$surface; } else { $workingSurface = $surface; } @@ -71,6 +75,7 @@ sub grayScale { sub invertColor { my ( $self, $surface ) = @_; + my $workingSurface; if($surface->isa('SDL::Surface')) { $workingSurface = $$surface; } else { @@ -93,7 +98,7 @@ sub invertColor { } } -die "SDL::Tool::Graphic requires SDL_gfx support\n" +croak "SDL::Tool::Graphic requires SDL_gfx support\n" unless SDL::Config->has('SDL_gfx'); diff --git a/lib/SDL/Video.pm b/lib/SDL/Video.pm index eba52f1..516dd1f 100644 --- a/lib/SDL/Video.pm +++ b/lib/SDL/Video.pm @@ -8,6 +8,8 @@ package SDL::Video; use strict; +use warnings; +use Carp; use SDL; use SDL::Surface; use SDL::MPEG; @@ -19,7 +21,7 @@ sub new { verify (%options, qw/ -name -audio / ) if $SDL::DEBUG; - my $n = $options{-name} || die "SDL::Video must supply a filename to SDL::Video::new\n"; + my $n = $options{-name} || croak "SDL::Video must supply a filename to SDL::Video::new\n"; my $a = $options{'-audio'} ? 1 : 0; my $info = new SDL::MPEG(); @@ -51,7 +53,7 @@ sub volume { } sub display { - die "SDL::Video::Display requires a SDL::Surface\n" unless $_[1]->isa('SDL::Surface'); + croak "SDL::Video::Display requires a SDL::Surface\n" unless $_[1]->isa('SDL::Surface'); SDL::SMPEGSetDisplay( ${$_[0]}, ${$_[1]}, 0); } @@ -90,7 +92,7 @@ sub loop { } sub region { - die "SDL::Video::region requires a SDL::Rect\n" unless $_[1]->isa('SDL::Rect'); + croak "SDL::Video::region requires a SDL::Rect\n" unless $_[1]->isa('SDL::Rect'); SDL::SMPEGDisplayRegion(${$_[0]},${$_[1]}); } diff --git a/make/lib/SDL/Build.pm b/make/lib/SDL/Build.pm index 4d8a8e4..0186412 100644 --- a/make/lib/SDL/Build.pm +++ b/make/lib/SDL/Build.pm @@ -6,6 +6,8 @@ package SDL::Build; use strict; +use warnings; +use Carp; use base 'Module::Build'; use File::Spec; @@ -35,7 +37,7 @@ sub get_arch 'SDL', 'Build', ucfirst( $os ) . '.pm' ); my $module = 'SDL::Build::' . ucfirst( $os ); - require $modpath or die "No module for $os platform\n"; + require $modpath or croak "No module for $os platform\n"; return $module; } @@ -52,7 +54,7 @@ sub find_subsystems for my $library (@{ $subsystem->{libraries} }) { my $lib = $libraries->{$library} - or die "Unknown library '$library' for '$name'\n"; + or croak "Unknown library '$library' for '$name'\n"; my ($inc_dir, $link_dir) = $self->find_header( $lib->{header}, \%includes_libs ); @@ -194,7 +196,7 @@ sub write_sdl_config $text =~ s/^\t//gm; - open my $file, '>', $path or die "Cannot write to '$path': $!\n"; + open my $file, '>', $path or croak "Cannot write to '$path': $!\n"; print $file $text; } diff --git a/make/lib/SDL/Build/MSWin32.pm b/make/lib/SDL/Build/MSWin32.pm index 131473a..232a3c7 100644 --- a/make/lib/SDL/Build/MSWin32.pm +++ b/make/lib/SDL/Build/MSWin32.pm @@ -1,13 +1,14 @@ package SDL::Build::MSWin32; use strict; - +use warnings; +usr Carp; use base 'SDL::Build'; use File::Spec::Functions; sub fetch_includes { - die "Environment variable INCLUDE is empty\n" unless $ENV{INCLUDE}; + croak "Environment variable INCLUDE is empty\n" unless $ENV{INCLUDE}; return map { $_ => 1 } grep { $_ } split( ';', $ENV{INCLUDE} ); } @@ -16,7 +17,8 @@ sub find_header { for my $key (qw( LIBS PATH )) { - die "Environment variable $key is empty\n" unless $ENV{$key}; + carp "Environment variable $key is empty\n" unless $ENV{$key}; + carp "This will probably fail the compile \nSet $key manually or try building anyway\n" unless $ENV{$key}; } my ( $self, $header, $includes ) = @_; @@ -78,7 +80,7 @@ sub gl_vendor return 'mesa_gl' if $vendor eq 'MESA'; return 'ms_gl' if $vendor eq 'MS'; - die "Unrecognized GL vendor '$vendor'\n"; + croak "Unrecognized GL vendor '$vendor'\n"; } sub ms_gl_subsystems diff --git a/test/loopwave.pl b/test/loopwave.pl index b9e75d2..458d93c 100644 --- a/test/loopwave.pl +++ b/test/loopwave.pl @@ -1,13 +1,14 @@ #!/usr/bin/env perl use SDL; +use Carp; -die "Could not initialize SDL: ", SDL::GetError() +croak "Could not initialize SDL: ", SDL::GetError() if ( 0 > SDL::Init(SDL_INIT_AUDIO())); $ARGV[0] ||= 'data/sample.wav'; -die "usage: $0 [wavefile]\n" +croak "usage: $0 [wavefile]\n" if ( in $ARGV[0], qw/ -h --help -? /); my ($wav_spec,$wav_buffer,$wav_len,$wav_pos) = (0,0,0,0); @@ -47,9 +48,9 @@ $wave = SDL::LoadWAV($ARGV[0],$spec); ($wav_spec,$wav_buffer,$wav_len) = @$wave; -die "Could not load wav file $ARGV[0], ", SDL::GetError(), "\n" unless ( $wav_len ); +croak "Could not load wav file $ARGV[0], ", SDL::GetError(), "\n" unless ( $wav_len ); -die "Could not open audio ", SDL::GetError() +croak "Could not open audio ", SDL::GetError() if (0 > SDL::OpenAudio($wav_spec,$fillerup)); SDL::PauseAudio(0);