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   66 use strict;
  10         20  
  10         276  
4 10     10   50 use warnings;
  10         19  
  10         294  
5 10     10   68 use vars qw(@ISA @EXPORT @EXPORT_OK);
  10         21  
  10         1393  
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   75 use Carp ();
  10         27  
  10         203  
13 10     10   59 use Scalar::Util ();
  10         20  
  10         204  
14              
15 10     10   57 use SDL::Internal::Loader;
  10         19  
  10         2360  
16             internal_load_dlls(__PACKAGE__);
17              
18             our $VERSION = 2.548;
19              
20             sub surfacex {
21 20     20 0 36 my ($arg) = @_;
22 20 50       64 if ( Scalar::Util::blessed($arg)) {
23 20 100       80 if ( $arg->isa("SDLx::Surface") ) {
24 13         36 return $arg;
25             }
26 7 50       18 if( $arg->isa("SDL::Surface") ) {
27 7         32 require SDLx::Surface;
28 7         19 return SDLx::Surface->new( surface => $arg );
29             }
30             }
31 0         0 Carp::confess("Surface must be SDL::Surface or SDLx::Surface");
32             }
33              
34             sub color {
35 13     13 0 7115 require SDL::Color;
36 13         25 return SDL::Color->new( @{ list_rgb(@_) } );
  13         110  
37             }
38              
39             bootstrap SDLx::Validate;
40              
41             1;
42