File Coverage

blib/lib/Devel/TypeCheck/Glob2type.pm
Criterion Covered Total %
statement 12 21 57.1
branch 0 4 0.0
condition 0 3 0.0
subroutine 4 7 57.1
pod 3 3 100.0
total 19 38 50.0


line stmt bran cond sub pod time code
1             package Devel::TypeCheck::Glob2type;
2              
3 1     1   1674 use strict;
  1         4  
  1         43  
4 1     1   7 use Carp;
  1         2  
  1         78  
5 1     1   6 use Devel::TypeCheck::Type;
  1         3  
  1         38  
6 1     1   654 use Devel::TypeCheck::Sym2type;
  1         3  
  1         225  
7              
8             our @ISA = qw(Devel::TypeCheck::Sym2type);
9              
10             =head1 NAME
11              
12             Devel::TypeCheck::Sym2type - abstract parent to symbol table types.
13              
14             =head1 SYNOPSIS
15              
16             Devel::TypeCheck::Type is an abstract class and should not be
17             instantiated directly. This defines the interface for symbol table
18             types, for keeping track of types in a symbol table.
19              
20             =head1 DESCRIPTION
21              
22             =over 4
23              
24             =cut
25              
26             =item B
27              
28             Retrieve a glob from the global table.
29              
30             =cut
31             sub get {
32 0     0 1   my ($this, $glob, $env) = @_;
33              
34 0 0         confess("env is null") if (!$env);
35              
36 0 0 0       if (!exists($this->{$glob}) || $glob eq "_") {
37 0           $this->{$glob} = $env->freshEta;
38             }
39              
40 0           return $this->{$glob};
41             }
42              
43             =item B
44              
45             The list of all symbols tracked in this table.
46              
47             =cut
48             sub symbols {
49 0     0 1   my ($this) = @_;
50 0           return keys(%$this);
51             }
52              
53             1;
54              
55             =back
56              
57             =item B
58              
59             Remove a glob from the global table. Used in an ad-hoc fashion to localize *_ in functions.
60              
61             =cut
62             sub del {
63 0     0 1   my ($this, $glob) = @_;
64              
65 0           delete($this->{$glob});
66             }
67              
68             =head1 AUTHOR
69              
70             Gary Jackson, C<< >>
71              
72             =head1 BUGS
73              
74             This version is specific to Perl 5.8.1. It may work with other
75             versions that have the same opcode list and structure, but this is
76             entirely untested. It definitely will not work if those parameters
77             change.
78              
79             Please report any bugs or feature requests to
80             C, or through the web interface at
81             L.
82             I will be notified, and then you'll automatically be notified of progress on
83             your bug as I make changes.
84              
85             =head1 COPYRIGHT & LICENSE
86              
87             Copyright 2005 Gary Jackson, all rights reserved.
88              
89             This program is free software; you can redistribute it and/or modify it
90             under the same terms as Perl itself.
91              
92             =cut