File Coverage

blib/lib/Devel/TypeCheck/Type/Kappa.pm
Criterion Covered Total %
statement 21 26 80.7
branch n/a
condition n/a
subroutine 7 10 70.0
pod 3 3 100.0
total 31 39 79.4


line stmt bran cond sub pod time code
1             package Devel::TypeCheck::Type::Kappa;
2              
3 1     1   8 use strict;
  1         5  
  1         939  
4 1     1   10 use Carp;
  1         2  
  1         98  
5              
6 1     1   8 use Devel::TypeCheck::Type;
  1         2  
  1         44  
7 1     1   7 use Devel::TypeCheck::Type::TSub;
  1         2  
  1         30  
8 1     1   702 use Devel::TypeCheck::Type::TVar;
  1         4  
  1         58  
9 1     1   6 use Devel::TypeCheck::Util;
  1         2  
  1         305  
10              
11             =head1 NAME
12              
13             Devel::TypeCheck::Type::Kappa - Type representing scalar values.
14              
15             =head1 SYNOPSIS
16              
17             use Devel::TypeCheck::Type::Kappa;
18              
19             =head1 DESCRIPTION
20              
21             Kappa represents scalar values. The underlying subtype can be a
22             variable, to represent a generic scalar, or an Upsilon or Rho type to
23             represent a "printable" type and a reference, respectively.
24              
25             Inherits from Devel::TypeCheck::Type::TSub and Devel::TypeCheck::Type::TVar.
26              
27             =cut
28             our @ISA = qw(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::P(), Devel::TypeCheck::Type::Y(), Devel::TypeCheck::Type::VAR());
37              
38 1         4 for my $i (@SUBTYPES) {
39 3         153 $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::K();
50             }
51              
52             sub deref {
53 0     0 1   my ($this) = @_;
54 0           return $this->subtype->deref;
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