| 1 | 11 | ▶ | use 5.008; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 11 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 11 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | package Data::Storage; | ||||||||||
| 6 | 11 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 11 | $Data::Storage::VERSION = '1.102720'; | |||||||||
| 8 | } | ||||||||||
| 9 | # ABSTRACT: Base class for storages | ||||||||||
| 10 | 11 | ▶ | use Class::Null; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 11 | ▶ | use parent qw( | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | Class::Accessor::Complex | ||||||||||
| 13 | Class::Accessor::Constructor | ||||||||||
| 14 | 11 | ); | |||||||||
| 15 | 11 | __PACKAGE__ | |||||||||
| 16 | ->mk_constructor | ||||||||||
| 17 | ->mk_boolean_accessors(qw(rollback_mode)) | ||||||||||
| 18 | ->mk_abstract_accessors(qw(create initialize_data)) | ||||||||||
| 19 | ->mk_scalar_accessors(qw(log)); | ||||||||||
| 20 | 11 | ▶ | use constant is_abstract => 1; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | 11 | ▶ | use constant DEFAULTS => (log => Class::Null->new,); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | |||||||||||
| 23 | 0 | ▶ | sub setup { | ||||||||
|
Subroutine
setup: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 24 | 0 | my $self = shift; | |||||||||
| 25 | 0 | $self->log->debug('creating storage schema'); | |||||||||
| 26 | 0 | $self->create; | |||||||||
| 27 | 0 | $self->log->debug('populating storage with initial data'); | |||||||||
| 28 | 0 | $self->initialize_data; | |||||||||
| 29 | } | ||||||||||
| 30 | 0 | ▶ | sub test_setup { } | ||||||||
|
Subroutine
test_setup: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 31 | |||||||||||
| 32 | # convenience method to access an object's id | ||||||||||
| 33 | 0 | ▶ | sub id { | ||||||||
|
Subroutine
id: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 34 | 0 | my $self = shift; | |||||||||
| 35 | 0 | my $object = shift; | |||||||||
| 36 | 0 | ▶ | if ($@) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | 0 | my $id = shift; | |||||||||
| 38 | 0 | $object->id($self, $id); | |||||||||
| 39 | } else { | ||||||||||
| 40 | 0 | $object->id($self); | |||||||||
| 41 | } | ||||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | # The storage object's signature is needed by Class::Scaffold::Storable to | ||||||||||
| 45 | # associate an object's id with the storage. We can't just store an id in a | ||||||||||
| 46 | # get_set_std accessor, because the business object's storage might be a | ||||||||||
| 47 | # multiplexing storage, and the object would have a different id in each | ||||||||||
| 48 | # multiplexed storage. | ||||||||||
| 49 | 0 | ▶ | sub signature { | ||||||||
|
Subroutine
signature: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 50 | 0 | my $self = shift; | |||||||||
| 51 | 0 | ref $self; | |||||||||
| 52 | } | ||||||||||
| 53 | 0 | ▶ | sub connect { } | ||||||||
|
Subroutine
connect: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 54 | 0 | ▶ | sub disconnect { } | ||||||||
|
Subroutine
disconnect: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 55 | |||||||||||
| 56 | # Some storage classes won't make a difference between a normal connection and | ||||||||||
| 57 | # a lazy connection - for memory storages, there is no connection anyway. But | ||||||||||
| 58 | # see Data::Storage::DBI for a way to use lazy connections. | ||||||||||
| 59 | 0 | ▶ | sub lazy_connect { } | ||||||||
|
Subroutine
lazy_connect: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 60 | 11 | 1; | |||||||||
| 61 | |||||||||||
| 62 | |||||||||||
| 63 | __END__ | ||||||||||