| 1 | package Apache::AxKit::Provider::RDBMS; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | our @ISA = qw( Apache::AxKit::Provider ); | |||||||||
| 7 | |||||||||||
| 8 | 1 | our $VERSION = '0.01'; | |||||||||
| 9 | |||||||||||
| 10 | # Preloaded methods go here. | ||||||||||
| 11 | |||||||||||
| 12 | |||||||||||
| 13 | ## private methods | ||||||||||
| 14 | 1 | our $loadModule; | |||||||||
| 15 | |||||||||||
| 16 | 0 | ▶ | sub init { | ||||||||
|
Subroutine
init: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 17 | 0 | my $this = shift; | |||||||||
| 18 | 0 | my ( %p ) = @_; | |||||||||
| 19 | 0 | my $r = $this->{apache}; | |||||||||
| 20 | |||||||||||
| 21 | 0 | my $adapter = $r->dir_config( "RDBMSCacheAdapter" ); | |||||||||
| 22 | |||||||||||
| 23 | 0 | ▶ | if( ! defined $adapter ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | 0 | $adapter = "Apache::AxKit::Provider::RDBMS::DBCacheAdapter::SQLite"; | |||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | |||||||||||
| 28 | 0 | my $content_provider = $r->dir_config( "RDBMSContentProvider" ); | |||||||||
| 29 | |||||||||||
| 30 | 0 | ▶ | if( ! defined $content_provider ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | 0 | $content_provider = "Apache::AxKit::Provider::RDBMS::ContentProvider::SQL"; | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 0 | $this->$loadModule( $adapter ); | |||||||||
| 35 | 0 | $this->$loadModule( $content_provider ); | |||||||||
| 36 | |||||||||||
| 37 | 0 | $this->{cacheAdapter} = $adapter->new( $this->{apache} ); | |||||||||
| 38 | 0 | $this->{contentAdapter} = $content_provider->new( $this->{apache} ); | |||||||||
| 39 | |||||||||||
| 40 | 0 | $this->{key} = $this->{apache}->location; | |||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | 0 | ▶ | $loadModule = sub { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 44 | 0 | my $this = shift; | |||||||||
| 45 | 0 | my $module = shift; | |||||||||
| 46 | |||||||||||
| 47 | 0 | $module =~ s/::/\//g; | |||||||||
| 48 | 0 | $module .= ".pm"; | |||||||||
| 49 | |||||||||||
| 50 | 0 | require $module; | |||||||||
| 51 | 1 | }; | |||||||||
| 52 | |||||||||||
| 53 | 0 | ▶ | sub mtime { | ||||||||
|
Subroutine
mtime: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 54 | 0 | my $this = shift; | |||||||||
| 55 | 0 | return $this->{cacheAdapter}->mtime(); | |||||||||
| 56 | } | ||||||||||
| 57 | |||||||||||
| 58 | |||||||||||
| 59 | 0 | ▶ | sub get_strref { | ||||||||
|
Subroutine
get_strref: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 60 | 0 | my $this = shift; | |||||||||
| 61 | 0 | my $content; | |||||||||
| 62 | |||||||||||
| 63 | ## work-around axit-bug | ||||||||||
| 64 | 0 | ▶ | if( ! defined $this->{xml} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 65 | 0 | $this->{xml} = $this->{contentAdapter}->getContent(); | |||||||||
| 66 | } | ||||||||||
| 67 | |||||||||||
| 68 | 0 | $content = $this->{xml}; | |||||||||
| 69 | |||||||||||
| 70 | 0 | return \$content; | |||||||||
| 71 | } | ||||||||||
| 72 | |||||||||||
| 73 | 0 | ▶ | sub key { | ||||||||
|
Subroutine
key: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 74 | 0 | return $_[0]->{key}; | |||||||||
| 75 | } | ||||||||||
| 76 | |||||||||||
| 77 | 0 | ▶ | sub process { | ||||||||
|
Subroutine
process: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 78 | 0 | return 1; | |||||||||
| 79 | } | ||||||||||
| 80 | |||||||||||
| 81 | 1 | 1; | |||||||||
| 82 | |||||||||||
| 83 | __END__ | ||||||||||