| 1 | package DBIx::MoCo::Readonly; | ||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 2 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use base qw(DBIx::MoCo); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | sub create { croak "Can't create into readonly class ", shift } | ||||||||
|
Subroutine
create: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 7 | 1 | ▶ | sub delete { croak "Can't delete from readonly class ", shift } | ||||||||
|
Subroutine
delete: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 8 | 0 | ▶ | sub delete_all { croak "Can't delete from readonly class ", shift } | ||||||||
|
Subroutine
delete_all: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 9 | 0 | ▶ | sub save { croak "Can't save into readonly class ", shift } | ||||||||
|
Subroutine
save: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 10 | |||||||||||
| 11 | 8 | ▶ | sub param { | ||||||||
|
Subroutine
param: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 12 | 8 | my $self = shift; | |||||||||
| 13 | 8 | ▶ | croak "Can't change params for readonly class ", $self if $_[1]; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 14 | 6 | $self->{$_[0]}; | |||||||||
| 15 | } | ||||||||||
| 16 | |||||||||||
| 17 | 2 | 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<DBIx::MoCo> | ||||||||||
| 37 | |||||||||||
| 38 | =head1 AUTHOR | ||||||||||
| 39 | |||||||||||
| 40 | Junya Kondo, E<lt>jkondo@hatena.comE<gt> | ||||||||||
| 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 | ||||||||||