File: TestConnect.pm

package info (click to toggle)
libdbix-class-helpers-perl 2.036000-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,008 kB
  • sloc: perl: 5,041; sql: 537; makefile: 7
file content (40 lines) | stat: -rw-r--r-- 703 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package A::Role::TestConnect;

use Moo::Role;
use TestSchema;

use A::Util;

has [qw(on_connect_call engine)] => ( is => 'ro' );

has storage_type => (
   is => 'ro',
   lazy => 1,
   default => sub { shift->engine }
);

sub connected { A::Util::connected($_[0]->engine, $_[0]->on_connect_call) }

has connect_info => (
   is => 'ro',
   lazy => 1,
   default => sub {
      my $self = shift;

      A::Util::connect_info($self->engine, $self->on_connect_call)
   },
);

sub env_vars { A::Util::env(shift->engine) }

has schema => (
   is => 'ro',
   lazy => 1,
   builder => sub {
      my $self = shift;

      A::Util::connect($self->engine, $self->storage_type, $self->on_connect_call)
   },
);

1;