File Coverage

blib/lib/Text/Xslate/Bridge/TypeDeclaration/Registry.pm
Criterion Covered Total %
statement 25 25 100.0
branch 6 6 100.0
condition 3 3 100.0
subroutine 7 7 100.0
pod 3 3 100.0
total 44 44 100.0


line stmt bran cond sub pod time code
1             package Text::Xslate::Bridge::TypeDeclaration::Registry;
2 11     11   43668 use strict;
  11         28  
  11         337  
3 11     11   61 use warnings;
  11         31  
  11         339  
4 11     11   80 use parent qw(Type::Registry);
  11         31  
  11         61  
5              
6             # override
7             sub new {
8 54     54 1 174866 my ($class) = @_;
9 54         359 my $self = $class->SUPER::new;
10 54         685 $self->add_types('Types::Standard');
11 54         262114 return $self;
12             }
13              
14             # override
15             sub simple_lookup {
16 196     196 1 55681 my ($self, $name, $flag) = @_;
17 196         697 my $type = $self->SUPER::simple_lookup($name, $flag);
18              
19             # Given 1 to $flag when parsing a name (undocumented)
20 196 100 100     3009 return (!defined $type && $flag)
21             ? $self->_class_type($name) : $type;
22             }
23              
24             # override
25             sub foreign_lookup {
26 26     26 1 7969 my ($self, $name, $flag) = @_;
27 26         132 my $type = $self->SUPER::foreign_lookup($name, $flag);
28 26 100       9204 return $type ? $type : $self->_class_type($name);
29             }
30              
31             sub _class_type {
32 27     27   87 my ($self, $name) = @_;
33              
34 27         112 my $type = $self->SUPER::simple_lookup($name);
35 27 100       354 unless ($type) {
36 26         132 $type = $self->make_class_type($name);
37 26         14895 $self->add_type($type, $name);
38             }
39              
40 27         638 return $type;
41             }
42              
43             1;
44              
45             __END__