MxScreen/Tie/Read_Checked.pm untested

filter: Statementstmt 0.0% 0 / 21 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 32 CC 2 SCAR 11.0
CC
2
Cov
0%
FETCH
6.0
TIEHASH
2.0
BEGIN
2.0
CRAP 3.0
1 # -*- Mode: perl -*-
2 #
3 # $Id: Read_Checked.pm,v 0.1 2001/04/22 17:57:04 ram Exp $
4 #
5 # Copyright (c) 1998-2001, Raphael Manfredi
6 # Copyright (c) 2000-2001, Christophe Dehaudt
7 #
8 # You may redistribute only under the terms of the Artistic License,
9 # as specified in the README file that comes with the distribution.
10 #
11 # HISTORY
12 # $Log: Read_Checked.pm,v $
13 # Revision 0.1 2001/04/22 17:57:04 ram
14 # Baseline for first Alpha release.
15 #
16 # $EndLog$
17 #
18  
19 use strict;
20  
21 package CGI::MxScreen::Tie::Read_Checked;
22  
23 require Tie::Hash;
24  
25 use vars qw(@ISA);
26 @ISA = qw(Tie::StdHash);
27  
28 use Carp::Datum;
29 use Log::Agent;
30  
31 #
32 # (TIEHASH)
33 #
34 # Initial tieing.
35 #
36 sub TIEHASH {
37 DFEATURE my $f_;
38 my $self = bless {}, shift;
39 return DVAL $self;
40 }
41  
42 #
43 # (FETCH)
44 #
45 # Redefined to croak when accessing non-existing key.
46 #
47 sub FETCH {
48 return $_[0]->{$_[1]} if exists $_[0]->{$_[1]};
49 logcroak "access to unknown key '$_[1]'";
50 }
51  
52 1;
53  
54 =head1 NAME
55  
56 CGI::MxScreen::Tie::Read_Checked - Global hash key access checking
57  
58 =head1 SYNOPSIS
59  
60 # Not meant to be used directly
61  
62 =head1 DESCRIPTION
63  
64 This class implements the runtime checks to keys from the global persistent
65 hash, made available to all screens via C<$self-E<gt>vars>. This behaviour
66 is configured by the C<$mx_check_vars> variable: see L<CGI::MxScreen::Config>.
67  
68 =head1 AUTHOR
69  
70 Raphael Manfredi F<E<lt>Raphael_Manfredi@pobox.comE<gt>>
71  
72 =head1 SEE ALSO
73  
74 CGI::MxScreen::Config(3).
75