File Coverage

blib/lib/Bio/Gonzales/Role/BioPerl/Constructor.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 19 19 100.0


line stmt bran cond sub pod time code
1             #Copyright (c) 2010 Joachim Bargsten <code at bargsten dot org>. All rights reserved.
2              
3             package Bio::Gonzales::Role::BioPerl::Constructor;
4              
5 1     1   643 use Mouse::Role;
  1         4  
  1         7  
6              
7 1     1   294 use warnings;
  1         2  
  1         28  
8 1     1   5 use strict;
  1         12  
  1         24  
9 1     1   6 use Carp;
  1         2  
  1         65  
10              
11 1     1   17 use 5.010;
  1         4  
12             our $VERSION = '0.083'; # VERSION
13              
14             around BUILDARGS => sub {
15             my $orig = shift;
16             my $class = shift;
17              
18             return $class->$orig(@_) unless ( substr( $_[0] || '', 0, 1 ) eq '-' );
19             push @_, undef unless $#_ % 2;
20              
21             my %param;
22             while (@_) {
23             ( my $key = shift ) =~ tr/A-Z\055/a-z/d; #deletes all dashes!
24             $param{$key} = shift;
25             }
26              
27             return $class->$orig(%param);
28             };
29              
30             1;