File Coverage

blib/lib/Bio/Protease/Types.pm
Criterion Covered Total %
statement 16 16 100.0
branch 2 2 100.0
condition n/a
subroutine 5 5 100.0
pod n/a
total 23 23 100.0


line stmt bran cond sub pod time code
1             package Bio::Protease::Types;
2             {
3             $Bio::Protease::Types::VERSION = '1.112900'; # TRIAL
4             }
5              
6             # ABSTRACT: Specific types for Bio::Protease
7              
8 5     5   1792 use MooseX::Types::Moose qw(Str ArrayRef RegexpRef Any);
  5         171666  
  5         40  
9 5     5   17436 use MooseX::Types -declare => [qw(ProteaseName ProteaseRegex)];
  5         7  
  5         21  
10 5     5   14704 use namespace::autoclean;
  5         9  
  5         19  
11 5     5   292 use Carp qw(croak);
  5         7  
  5         1744  
12              
13             subtype ProteaseName, as Str;
14              
15             subtype ProteaseRegex, as ArrayRef;
16              
17             coerce ProteaseRegex,
18             from Str, via { _str_to_prot_regex($_) },
19             from RegexpRef, via { [ $_ ] };
20              
21             coerce ProteaseName,
22             from Any, via { 'custom' };
23              
24             sub _str_to_prot_regex {
25 46     46   62 my $specificity = shift;
26 46         1092 my $specificity_of = Bio::Protease->Specificities;
27              
28 45 100       209 croak "Not a known specificity\n"
29             unless $specificity ~~ %$specificity_of;
30              
31 44         901 return $specificity_of->{$specificity};
32             }
33              
34             __PACKAGE__->meta->make_immutable;
35              
36              
37             __END__
38             =pod
39              
40             =head1 NAME
41              
42             Bio::Protease::Types - Specific types for Bio::Protease
43              
44             =head1 VERSION
45              
46             version 1.112900
47              
48             =head1 DESCRIPTION
49              
50             This module defines specific types and type coercions to be used by
51             L<Bio::Protease>. It should not be used by end users or consumer of the
52             Bio::ProteaseI role.
53              
54             =head1 AUTHOR
55              
56             Bruno Vecchi <vecchi.b gmail.com>
57              
58             =head1 COPYRIGHT AND LICENSE
59              
60             This software is copyright (c) 2011 by Bruno Vecchi.
61              
62             This is free software; you can redistribute it and/or modify it under
63             the same terms as the Perl 5 programming language system itself.
64              
65             =cut
66