File Coverage

blib/lib/gum.pm
Criterion Covered Total %
statement 15 30 50.0
branch 6 18 33.3
condition 0 3 0.0
subroutine 3 3 100.0
pod n/a
total 24 54 44.4


line stmt bran cond sub pod time code
1             # ABSTRACT: Convenient Shoehorn for Bubblegum
2             package gum;
3              
4 6     6   2474 use 5.10.0;
  6         21  
  6         284  
5 6     6   3115 use Import::Into;
  6         15602  
  6         1460  
6              
7             our $VERSION = '0.44'; # VERSION
8              
9             sub import {
10 6     6   50 my $target = caller;
11 6         10 my $class = shift;
12              
13 6         41 my @flags = grep /^-\w+/, @_;
14 6         33 my %flags = map +($_, 1), map substr($_, 1), @flags;
15              
16 6 100       36 if ($flags{class}) {
    100          
    100          
17 1         326 require 'Bubblegum/Class.pm';
18 0         0 'Bubblegum::Class'->import::into($target);
19             }
20             elsif ($flags{role}) {
21 1         536 require 'Bubblegum/Role.pm';
22 0         0 'Bubblegum::Role'->import::into($target);
23             }
24             elsif ($flags{singleton}) {
25 1         513 require 'Bubblegum/Singleton.pm';
26 0         0 'Bubblegum::Singleton'->import::into($target);
27             }
28             else {
29 3         1323 require 'Bubblegum.pm';
30 0           'Bubblegum'->import::into($target);
31             }
32 0 0 0       if ($flags{proto} or $flags{prototype}) {
33 0           require 'Bubblegum/Prototype.pm';
34 0           'Bubblegum::Prototype'->import::into($target);
35             }
36              
37 0           my @exports = ();
38 0 0         push @exports, '-types' if $flags{types};
39 0 0         push @exports, '-typesof' if $flags{types};
40 0 0         push @exports, '-isas' if $flags{isas};
41 0 0         push @exports, '-nots' if $flags{isas};
42              
43 0 0         if (@exports) {
44 0           require 'Bubblegum/Constraints.pm';
45 0           'Bubblegum::Constraints'->import::into($target, @exports);
46             }
47             }
48              
49             1;
50              
51             __END__