File Coverage

blib/lib/HTML/Native/Attribute/ReadOnly.pm
Criterion Covered Total %
statement 18 18 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 0 2 0.0
total 24 26 92.3


line stmt bran cond sub pod time code
1             package HTML::Native::Attribute::ReadOnly;
2              
3             # Copyright (C) 2011 Michael Brown .
4             #
5             # This program is free software; you can redistribute it and/or
6             # modify it under the terms of the GNU General Public License as
7             # published by the Free Software Foundation; either version 2 of the
8             # License, or any later version.
9             #
10             # This program is distributed in the hope that it will be useful, but
11             # WITHOUT ANY WARRANTY; without even the implied warranty of
12             # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13             # General Public License for more details.
14             #
15             # You should have received a copy of the GNU General Public License
16             # along with this program; if not, write to the Free Software
17             # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18              
19             =head1 NAME
20              
21             HTML::Native::Attribute::ReadOnly - A read-only HTML element attribute
22              
23             =head1 SYNOPSIS
24              
25             use HTML::Native::Attribute::ReadOnly;
26              
27             my $attr =
28             HTML::Native::Attribute::ReadOnly->new ( [ qw ( foo bar ) ] );
29             print $attr; # prints "foo bar"
30             $attr->{foo} = 0; # dies
31              
32             =head1 DESCRIPTION
33              
34             An L object is an
35             L object that does not allow modification of
36             its values.
37              
38             See L for further
39             details on when and why you might want to use an
40             L object.
41              
42             =cut
43              
44 1     1   39904 use base qw ( HTML::Native::Attribute );
  1         4  
  1         1180  
45 1     1   1834 use mro "c3";
  1         883  
  1         7  
46 1     1   53 use strict;
  1         2  
  1         32  
47 1     1   6 use warnings;
  1         3  
  1         116  
48              
49             sub hash {
50 3     3 0 6 my $self = shift;
51 3         15 my $value = $self->next::method ( @_ );
52              
53 3         18 return $self->new_readonly_hash ( $value );
54             }
55              
56             sub array {
57 2     2 0 2 my $self = shift;
58 2         9 my $value = $self->next::method ( @_ );
59              
60 2         14 return $self->new_readonly_array ( $value );
61             }
62              
63             1;