File Coverage

blib/lib/SDLx/Validate.pm
Criterion Covered Total %
statement 28 29 96.5
branch 4 6 66.6
condition n/a
subroutine 8 8 100.0
pod 0 2 0.0
total 40 45 88.8


line stmt bran cond sub pod time code
1             #Interal Module to validate SDLx types
2             package SDLx::Validate;
3 10     10   58 use strict;
  10         22  
  10         348  
4 10     10   65 use warnings;
  10         24  
  10         334  
5 10     10   57 use vars qw(@ISA @EXPORT @EXPORT_OK);
  10         24  
  10         1693  
6             require Exporter;
7             require DynaLoader;
8             our @ISA = qw(Exporter DynaLoader);
9              
10             $SIG{__WARN__} = sub { warn $_[0] unless $_[0] =~ /Use of uninitialized value in subroutine entry/};
11              
12 10     10   71 use Carp ();
  10         18  
  10         209  
13 10     10   57 use Scalar::Util ();
  10         19  
  10         183  
14              
15 10     10   55 use SDL::Internal::Loader;
  10         22  
  10         2703  
16             internal_load_dlls(__PACKAGE__);
17              
18             sub surfacex {
19 20     20 0 39 my ($arg) = @_;
20 20 50       108 if ( Scalar::Util::blessed($arg)) {
21 20 100       178 if ( $arg->isa("SDLx::Surface") ) {
22 13         51 return $arg;
23             }
24 7 50       32 if( $arg->isa("SDL::Surface") ) {
25 7         41 require SDLx::Surface;
26 7         38 return SDLx::Surface->new( surface => $arg );
27             }
28             }
29 0         0 Carp::confess("Surface must be SDL::Surface or SDLx::Surface");
30             }
31              
32             sub color {
33 13     13 0 7577 require SDL::Color;
34 13         24 return SDL::Color->new( @{ list_rgb(@_) } );
  13         168  
35             }
36              
37             bootstrap SDLx::Validate;
38              
39             1;
40