| 1 | package DBIx::Aurora; | ||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use DBIx::Aurora::Cluster; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | our $VERSION = '0.01'; | |||||||||
| 7 | 1 | our $AUTOLOAD; | |||||||||
| 8 | |||||||||||
| 9 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 10 | 0 | my ($class, %clusters) = @_; | |||||||||
| 11 | 0 | my $self = bless { clusters => {} }, $class; | |||||||||
| 12 | |||||||||||
| 13 | 0 | for my $cluster_name (keys %clusters) { | |||||||||
| 14 | 0 | my $config = $clusters{$cluster_name}; | |||||||||
| 15 | 0 | $self->{clusters}{lc $cluster_name} = DBIx::Aurora::Cluster->new(@$config{qw/ instances opts /}); | |||||||||
| 16 | } | ||||||||||
| 17 | |||||||||||
| 18 | 0 | return $self; | |||||||||
| 19 | } | ||||||||||
| 20 | |||||||||||
| 21 | 0 | ▶ | sub AUTOLOAD { | ||||||||
|
Subroutine
AUTOLOAD: not called CC=2 SCAR=17.9
| |||||||||||
| 22 | 0 | my ($self, @args) = @_; | |||||||||
| 23 | 0 | my $method = [ split /::/, $AUTOLOAD ]->[-1]; | |||||||||
| 24 | $self->{clusters}{$method} | ||||||||||
| 25 | or Carp::croak "Cannot find cluster `$method`. Available clusters are: " | ||||||||||
| 26 | 0 | ▶ | . join ", ", sort keys %{$self->{clusters}}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | 1 | 1; | |||||||||
| 30 | __END__ | ||||||||||