File Coverage

blib/lib/Scalar/Util/Instance.pm
Criterion Covered Total %
statement 23 23 100.0
branch 4 4 100.0
condition n/a
subroutine 5 5 100.0
pod n/a
total 32 32 100.0


line stmt bran cond sub pod time code
1             package Scalar::Util::Instance;
2              
3 5     5   244435 use 5.008_001;
  5         21  
  5         223  
4 5     5   30 use strict;
  5         11  
  5         226  
5 5     5   26 use warnings;
  5         13  
  5         362  
6              
7             our $VERSION = '0.001';
8              
9 5     5   29 use XSLoader;
  5         7  
  5         990  
10             XSLoader::load(__PACKAGE__, $VERSION);
11              
12             sub import {
13 7     7   5161 my $class = shift;
14              
15 7         21 my $into = caller;
16 7         158 foreach my $config(@_){
17 5         12 my $as = $config->{as};
18 5 100       18 if(!defined $as){
19 1         11 require Carp;
20 1         22 Carp::croak("You must define a predicate name by 'as'");
21             }
22 4 100       17 if($as !~ /::/){
23 3         8 $as = $into . '::' . $as;
24             }
25 4         54 $class->generate_for($config->{for}, $as);
26             }
27 5         218 return;
28             }
29              
30             1;
31             __END__