Skip to content

Commit

Permalink
changed all Carp::carp to Carp::cluck and Carp::croak to Carp::confess
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Leich committed Sep 11, 2010
1 parent 034c105 commit b44a085
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion Build.PL
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ my %platforms = (
);
my $package = 'My::Builder::' . ( $platforms{$^O} || 'Unix' );
print "Gonna use '$package' class ...\n";
eval "require $package" or croak "Require '$package' failed: $@\n";
eval "require $package" or confess "Require '$package' failed: $@\n";

### subsystems to build
# <subsystem>
Expand Down
10 changes: 5 additions & 5 deletions examples/GFX/script_roto.pl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
SDL::Rect->new( 0, 0, $display->w, $display->h ), $pixel
);

croak SDL::get_error if !$display;
confess SDL::get_error if !$display;

my $src = SDL::Video::load_BMP('test/data/picture.bmp');
my $temp_surf;
Expand All @@ -43,20 +43,20 @@ sub draw {
foreach ( 1 .. 360 ) {

$temp_surf = SDL::GFX::Rotozoom::surface( $src, $_, $_ / 180, 1 );
croak SDL::get_error if !$temp_surf;
confess SDL::get_error if !$temp_surf;
draw( $temp_surf, 2 );
}

$temp_surf = SDL::GFX::Rotozoom::surface_xy( $src, 1, 1, 1, 1 );
croak SDL::get_error if !$temp_surf;
confess SDL::get_error if !$temp_surf;
draw( $temp_surf, 1000 );

$temp_surf = SDL::GFX::Rotozoom::zoom_surface( $src, 1, 1, 1 );
croak SDL::get_error if !$temp_surf;
confess SDL::get_error if !$temp_surf;
draw( $temp_surf, 1000 );

$temp_surf = SDL::GFX::Rotozoom::shrink_surface( $src, 1, 1 );
croak SDL::get_error if !$temp_surf;
confess SDL::get_error if !$temp_surf;
draw( $temp_surf, 1000 );

SDL::delay(1000);
Expand Down
4 changes: 2 additions & 2 deletions examples/SDLx/SDLx_controller_two_squares.pl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ sub init {

# Initing video
# Die here if we cannot make video init
croak 'Cannot init ' . SDL::get_error()
confess 'Cannot init ' . SDL::get_error()
if ( SDL::init(SDL_INIT_VIDEO) == -1 );

# Create our display window
Expand All @@ -52,7 +52,7 @@ sub init {
SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_HWACCEL
);

croak 'Cannot init video mode 800x600x32: ' . SDL::get_error()
confess 'Cannot init video mode 800x600x32: ' . SDL::get_error()
unless $a;

return $a;
Expand Down
4 changes: 2 additions & 2 deletions examples/SDLx/pong.pl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ sub init {

# Initing video
# Die here if we cannot make video init
croak 'Cannot init ' . SDL::get_error()
confess 'Cannot init ' . SDL::get_error()
if ( SDL::init(SDL_INIT_VIDEO) == -1 );

# Create our display window
Expand All @@ -81,7 +81,7 @@ sub init {
SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_HWACCEL
);

croak 'Cannot init video mode 800x600x32: ' . SDL::get_error()
confess 'Cannot init video mode 800x600x32: ' . SDL::get_error()
unless $a;

return $a;
Expand Down
4 changes: 2 additions & 2 deletions examples/pixel_operations/sols/ch02.pl
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ sub render {
}

sub main {
carp 'Unable to init SDL: ' . SDL::get_error()
cluck 'Unable to init SDL: ' . SDL::get_error()
if ( SDL::init(SDL_INIT_VIDEO) < 0 );

$screen = SDL::Video::set_video_mode( 640, 480, 32, SDL_SWSURFACE );

carp 'Unable to set 640x480x32 video' . SDL::get_error() if ( !$screen );
cluck 'Unable to set 640x480x32 video' . SDL::get_error() if ( !$screen );

while (1) {

Expand Down
2 changes: 1 addition & 1 deletion inc/My/Builder.pm
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ sub find_subsystems {
my $param;
for my $library ( @{ $subsystem->{libraries} } ) {
my $lib = $libraries->{$library}
or croak "Unknown library '$library' for '$name'\n";
or confess "Unknown library '$library' for '$name'\n";
my $h =
ref( $lib->{header} ) eq 'ARRAY'
? $lib->{header}
Expand Down
2 changes: 1 addition & 1 deletion t/extendingrect.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sub new {
my $self = $class->SUPER::new(@_);
unless ( ref $self ) {
require Carp;
Carp::croak SDL::GetError();
Carp::confess SDL::GetError();
}
return bless $self => $class;

Expand Down
10 changes: 5 additions & 5 deletions t_backcompat/MoP/lib/SDL/Tutorial/MoP/Model/Map.pm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ my $tile_size = 10;

my $path = module_file( 'SDL::Tutorial::MoP', 'data/tiles.bmp' );
my $tiles = SDL::Video::load_BMP($path);
croak 'Error: ' . SDL::get_error() if ( !$tiles );
confess 'Error: ' . SDL::get_error() if ( !$tiles );

my $map_surface; # the image(s) of the current map are here
my $is_up_to_date = 0;
Expand All @@ -49,7 +49,7 @@ sub new {
sub init {
my ( $self, %params ) = @_;

$self->load_map() || carp("load_map() failed");
$self->load_map() || cluck("load_map() failed");
$self->x(0);
$self->y(0);
$self->w( $self->surface()->w() );
Expand All @@ -61,7 +61,7 @@ sub init {
sub notify {
my ( $self, $event ) = (@_);

print carp( sprintf( "Notify '%s'in Map", $event->{name} ) )
print cluck( sprintf( "Notify '%s'in Map", $event->{name} ) )
if $self->{EDEBUG};

my %event_action = (
Expand Down Expand Up @@ -94,7 +94,7 @@ sub load_map {
$_surface = undef;
return 1;
} else {
carp("Could not load bitmap $_path.");
cluck("Could not load bitmap $_path.");
return -1;
}
}
Expand All @@ -111,7 +111,7 @@ sub get_tile_by_index {
my $self = shift;
my $index = shift || 0;

carp 'Unable to load tiles ' . SDL::get_error() if ( !$tiles );
cluck 'Unable to load tiles ' . SDL::get_error() if ( !$tiles );

my $x = ( $index * $tile_size ) % $tiles->w;
my $y = int( ( $index * $tile_size ) / $tiles->w ) * $tile_size;
Expand Down
6 changes: 3 additions & 3 deletions t_backcompat/MoP/lib/SDL/Tutorial/MoP/View.pm
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ sub map_move {
sub draw_map {
my $self = shift;

carp('There is no surface to draw to') unless $self->{app};
carp('There are no tiles to draw') unless $map->tiles;
cluck('There is no surface to draw to') unless $self->{app};
cluck('There are no tiles to draw') unless $map->tiles;

# blitting the whole map-surface to app-surface
my $srect = SDL::Rect->new( 0, 0, $map->w(), $map->h() ); #we want all of map;
Expand All @@ -143,7 +143,7 @@ sub draw_scene {

$self->draw_map();

carp('There is no surface to draw to') unless $self->{app};
cluck('There is no surface to draw to') unless $self->{app};

$self->{count} = $self->{count} + 1;

Expand Down
8 changes: 4 additions & 4 deletions t_backcompat/MoP/lib/SDL/Tutorial/MoP/View/Map.pm
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ my $diff = 'MoP/../../';
$diff = '../' if ( $^O =~ /linux/ );
my $path = catpath( $volume, catfile( $dirs, $diff . 'tiles.bmp' ) );
my $tiles = SDL::Video::load_BMP($path);
croak 'Error: ' . SDL::get_error() if ( !$tiles );
confess 'Error: ' . SDL::get_error() if ( !$tiles );

sub draw_map {
carp 'Unable to init SDL: ' . SDL::get_error()
cluck 'Unable to init SDL: ' . SDL::get_error()
if ( SDL::init(SDL_INIT_VIDEO) < 0 );

$screen = SDL::Video::set_video_mode( 640, 480, 32, SDL_SWSURFACE );

carp 'Unable to set 640x480x32 video ' . SDL::get_error() if ( !$screen );
cluck 'Unable to set 640x480x32 video ' . SDL::get_error() if ( !$screen );

move_map(MOP_LEFT);

Expand Down Expand Up @@ -92,7 +92,7 @@ sub move_map {
sub get_tile {
my $index = shift || 0;

carp 'Unable to load tiles ' . SDL::get_error() if ( !$tiles );
cluck 'Unable to load tiles ' . SDL::get_error() if ( !$tiles );

my $x = ( $index * $tile_size ) % $tiles->w;
my $y = int( ( $index * $tile_size ) / $tiles->w ) * $tile_size;
Expand Down
4 changes: 2 additions & 2 deletions t_backcompat/Timer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ sub new {
my $func = shift;
my (%options) = @_;

croak "SDL::Timer::new no delay specified\n"
confess "SDL::Timer::new no delay specified\n"
unless ( $options{-delay} );
$$self{-delay} = $options{-delay} || $options{-d} || 0;
$$self{-times} = $options{-times} || $options{-t} || 0;
Expand All @@ -52,7 +52,7 @@ sub new {
$$self{-routine} = sub { &$func; $$self{-delay} };
}
$$self{-timer} = SDL::NewTimer( $$self{-delay}, $$self{-routine} );
croak "Could not create timer, ", SDL::get_error(), "\n"
confess "Could not create timer, ", SDL::get_error(), "\n"
unless ( $self->{-timer} );
bless $self, $class;
return $self;
Expand Down
8 changes: 4 additions & 4 deletions t_backcompat/loopwave.pl
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
use SDL::Event;
use Carp;

croak "Could not initialize SDL: ", SDL::GetError()
confess "Could not initialize SDL: ", SDL::GetError()
if ( 0 > SDL::Init(SDL_INIT_AUDIO) );

$ARGV[0] ||= 'data/sample.wav';

croak "usage: $0 [wavefile]\n"
confess "usage: $0 [wavefile]\n"
if ( in $ARGV[0], qw/ -h --help -? / );

my ( $wav_spec, $wav_buffer, $wav_len, $wav_pos ) = ( 0, 0, 0, 0 );
Expand Down Expand Up @@ -49,10 +49,10 @@

( $wav_spec, $wav_buffer, $wav_len ) = @$wave;

croak "Could not load wav file $ARGV[0], ", SDL::GetError(), "\n"
confess "Could not load wav file $ARGV[0], ", SDL::GetError(), "\n"
unless ($wav_len);

croak "Could not open audio ", SDL::GetError()
confess "Could not open audio ", SDL::GetError()
if ( 0 > SDL::OpenAudio( $wav_spec, $fillerup ) );

SDL::PauseAudio(0);
Expand Down
2 changes: 1 addition & 1 deletion t_backcompat/testsprite.pl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ sub init_game_context {

$sprite = SDL::Video::load_BMP("data/icon.bmp");

croak 'Cannot make sprite:' . SDL::get_error() if !$sprite;
confess 'Cannot make sprite:' . SDL::get_error() if !$sprite;

# Set transparent pixel as the pixel at (0,0)

Expand Down

0 comments on commit b44a085

Please sign in to comment.