File Coverage

blib/lib/DBIx/MoCo/Readonly.pm
Criterion Covered Total %
statement 14 16 87.5
branch 2 2 100.0
condition n/a
subroutine 6 8 75.0
pod 5 5 100.0
total 27 31 87.1


line stmt bran cond sub pod time code
1             package DBIx::MoCo::Readonly;
2 2     2   64523 use strict;
  2         4  
  2         59  
3 2     2   11 use Carp;
  2         5  
  2         119  
4 2     2   13 use base qw(DBIx::MoCo);
  2         4  
  2         1431  
5              
6 1     1 1 2073 sub create { croak "Can't create into readonly class ", shift }
7 1     1 1 1061 sub delete { croak "Can't delete from readonly class ", shift }
8 0     0 1 0 sub delete_all { croak "Can't delete from readonly class ", shift }
9 0     0 1 0 sub save { croak "Can't save into readonly class ", shift }
10              
11             sub param {
12 8     8 1 19 my $self = shift;
13 8 100       377 croak "Can't change params for readonly class ", $self if $_[1];
14 6         82 $self->{$_[0]};
15             }
16              
17             1;
18              
19             =head1 NAME
20              
21             DBIx::MoCo::Readonly - Base class for read-only DBIx::MoCo classes.
22              
23             =head1 SYNOPSIS
24              
25             package NeverChangeModel;
26             use base qw(DBIx::MoCo);
27              
28             __PACKAGE__->db_object('NeverChangeDataBase');
29             __PACKAGE__->table('user');
30             __PACKAGE__->primary_keys(['user_id']);
31              
32             1;
33              
34             =head1 SEE ALSO
35              
36             L
37              
38             =head1 AUTHOR
39              
40             Junya Kondo, Ejkondo@hatena.comE
41              
42             =head1 COPYRIGHT AND LICENSE
43              
44             Copyright (C) Hatena Inc. All Rights Reserved.
45              
46             This library is free software; you may redistribute it and/or modify
47             it under the same terms as Perl itself.
48              
49             =cut