« lib/Video/PlaybackMachine/FillProducer/RandomStillFrame.pm
↑ Summary
lib/Video/PlaybackMachine/Config.pm »
| 1 | package Video::PlaybackMachine::DB; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 3 | our $VERSION = '0.09'; # VERSION | |||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | =pod | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | =head1 NAME | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | Video::PlaybackMachine::DB | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | Singleton database class for PlaybackMachine. | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | =cut | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 3 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 3 | ▶ | use Video::PlaybackMachine::Config; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | 3 | ▶ | use Video::PlaybackMachine::Schema; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | ####################### Module Constants ######################### | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 3 | our $Database_Name = Video::PlaybackMachine::Config->config()->database(); | |||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 3 | our $Schema; | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | ####################### Class Methods ############################ | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 0 | ▶ | sub schema { | ||||||||||||||||||||||||||
|
Subroutine
schema: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 36 | 0 | my $type = shift; | |||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 0 | ▶ | unless ( defined($Schema) && $Schema->storage->connected() ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $Video::PlaybackMachine::DB::Schema and $Video::PlaybackMachine::DB::Schema->storage->connected
MC/DC0%0/2
defined $Video::PlaybackMachine::DB::Schema and $Video::PlaybackMachine::DB::Schema->storage->connected
defined $Video::PlaybackMachine::DB::Schema
$Video::PlaybackMachine::DB::Schema->storage->connected
Truth table0%0/3
A and B
A= defined $Video::PlaybackMachine::DB::SchemaB= $Video::PlaybackMachine::DB::Schema->storage->connected
| |||||||||||||||||||||||||||||
| 39 | 0 | $Schema = Video::PlaybackMachine::Schema->connect("dbi:SQLite:dbname=$Database_Name", '', ''); | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 0 | return $Schema; | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 0 | ▶ | sub db { | ||||||||||||||||||||||||||
|
Subroutine
db: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 46 | 0 | my $type = shift; | |||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 0 | my $Schema = $type->schema(@_); | |||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 0 | return $Schema->storage->dbh; | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 3 | 1; | |||||||||||||||||||||||||||