File Coverage

blib/lib/Devel/TypeCheck/Type/Rho.pm
Criterion Covered Total %
statement 24 29 82.7
branch n/a
condition n/a
subroutine 8 11 72.7
pod 3 3 100.0
total 35 43 81.4


line stmt bran cond sub pod time code
1             package Devel::TypeCheck::Type::Rho;
2              
3 1     1   10 use strict;
  1         3  
  1         71  
4 1     1   7 use Carp;
  1         3  
  1         93  
5              
6 1     1   7 use Devel::TypeCheck::Type;
  1         2  
  1         51  
7 1     1   8 use Devel::TypeCheck::Type::TRef;
  1         2  
  1         37  
8 1     1   5 use Devel::TypeCheck::Type::TSub;
  1         2  
  1         32  
9 1     1   7 use Devel::TypeCheck::Type::TVar;
  1         2  
  1         47  
10 1     1   7 use Devel::TypeCheck::Util;
  1         2  
  1         227  
11              
12             =head1 NAME
13              
14             Devel::TypeCheck::Type::Rho - Type representing references.
15              
16             =head1 SYNOPSIS
17              
18             use Devel::TypeCheck::Type::Rho;
19              
20             =head1 DESCRIPTION
21              
22             Rho represents references. The underlying subtype can be a new type
23             (starting with Mu), or a type variable.
24              
25             Inherits from Devel::TypeCheck::Type::TSub and Devel::TypeCheck::Type::TRef.
26              
27             =cut
28             our @ISA = qw(Devel::TypeCheck::Type::TRef Devel::TypeCheck::Type::TSub Devel::TypeCheck::Type::TVar);
29              
30             # **** CLASS ****
31              
32             our @SUBTYPES;
33             our @subtypes;
34              
35             BEGIN {
36 1     1   10 @SUBTYPES = (Devel::TypeCheck::Type::M(), Devel::TypeCheck::Type::VAR());
37              
38 1         20 for my $i (@SUBTYPES) {
39 2         217 $subtypes[$i] = 1;
40             }
41             }
42              
43             sub hasSubtype {
44 0     0 1   my ($this, $index) = @_;
45 0           return ($subtypes[$index]);
46             }
47              
48             sub type {
49 0     0 1   return Devel::TypeCheck::Type::P();
50             }
51              
52             sub pretty {
53 0     0 1   my ($this, $env) = @_;
54 0           return "REFERENCE to " . $this->subtype->pretty($env);
55             }
56              
57             TRUE;
58              
59             =head1 AUTHOR
60              
61             Gary Jackson, C<< >>
62              
63             =head1 BUGS
64              
65             This version is specific to Perl 5.8.1. It may work with other
66             versions that have the same opcode list and structure, but this is
67             entirely untested. It definitely will not work if those parameters
68             change.
69              
70             Please report any bugs or feature requests to
71             C, or through the web interface at
72             L.
73             I will be notified, and then you'll automatically be notified of progress on
74             your bug as I make changes.
75              
76             =head1 COPYRIGHT & LICENSE
77              
78             Copyright 2005 Gary Jackson, all rights reserved.
79              
80             This program is free software; you can redistribute it and/or modify it
81             under the same terms as Perl itself.
82              
83             =cut