File Coverage

blib/lib/E2/Room.pm
Criterion Covered Total %
statement 28 36 77.7
branch 3 10 30.0
condition 1 3 33.3
subroutine 9 13 69.2
pod 4 6 66.6
total 45 68 66.1


line stmt bran cond sub pod time code
1             # E2::Room.pm
2             # Jose M. Weeks
3             # 05 June 2003
4             #
5             # See bottom for pod documentation.
6              
7             package E2::Room;
8              
9 2     2   16091 use 5.006;
  2         6  
  2         75  
10 2     2   9 use strict;
  2         4  
  2         52  
11 2     2   10 use warnings;
  2         3  
  2         54  
12 2     2   9 use Carp;
  2         3  
  2         133  
13              
14 2     2   511 use E2::Node;
  2         4  
  2         868  
15              
16             our @ISA = "E2::Node";
17             our $VERSION = "0.32";
18             our $DEBUG; *DEBUG = *E2::Interface::DEBUG;
19              
20             # Prototypes
21              
22             sub new;
23             sub clear;
24              
25             sub description;
26             sub can_enter;
27              
28             # Private
29              
30             sub type_as_string;
31             sub twig_handlers;
32              
33             # Object Methods
34              
35             sub new {
36 1     1 1 83 my $arg = shift;
37 1   33     8 my $class = ref( $arg ) || $arg;
38 1         12 my $self = $class->SUPER::new();
39              
40             # See clear for the other members of $self
41              
42 1         3 $self->clear;
43 1         3 return $self;
44             }
45              
46             sub clear {
47 3 50   3 1 13 my $self = shift or croak "Usage: clear E2USERGROUP";
48              
49 3 50       6 warn "E2::Room::clear\n" if $DEBUG > 1;
50              
51 3         4 $self->{description} = undef;
52 3         5 $self->{can_enter} = undef;
53              
54             # Now clear parent
55              
56 3         10 return $self->SUPER::clear;
57             }
58              
59             sub twig_handlers {
60 1 50   1 0 4 my $self = shift or croak "Usage: twig_handlers E2USERGROUP";
61              
62             return (
63             'description' => sub {
64 0     0   0 (my $a, my $b) = @_;
65 0         0 $self->{description} = $b->text;
66             },
67             'canenter' => sub {
68 0     0   0 (my $a, my $b) = @_;
69 0         0 $self->{can_enter} = $b->text;
70             }
71 1         8 );
72             }
73              
74             sub type_as_string {
75 1     1 0 5 return 'room';
76             }
77              
78             sub description {
79 0 0   0 1   my $self = shift or croak "Usage: description E2ROOM";
80 0           return $self->{description};
81             }
82              
83             sub can_enter {
84 0 0   0 1   my $self = shift or croak "Usage: can_enter E2ROOM";
85 0           return $self->{can_enter};
86             }
87              
88             1;
89             __END__