« blib/lib/DBIx/Class/ParseError/Parser/MySQL.pm
↑ Summary
blib/lib/DBIx/Class/ParseError/Parser/SQLite.pm »
| 1 | package DBIx::Class::ParseError; | ||
| 2 | |||
| 3 | 4 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 4 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 4 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 4 | ▶ | use Try::Tiny; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 4 | ▶ | use Module::Runtime 'use_module'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 4 | ▶ | use DBIx::Class::Exception; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 4 | our $VERSION = '0.01'; | |
| 11 | 4 | $VERSION = eval $VERSION; | |
| 12 | |||
| 13 | 4 | has _schema => ( | |
| 14 | is => 'ro', required => 1, init_arg => 'schema', | ||
| 15 | handles => { _storage => 'storage' } | ||
| 16 | ); | ||
| 17 | |||
| 18 | 4 | has db_driver => ( | |
| 19 | is => 'lazy', init_arg => undef, | ||
| 20 | ); | ||
| 21 | |||
| 22 | 4 | ▶ | sub _build_db_driver { shift->_storage->sqlt_type } |
|
Subroutine
_build_db_driver: called CC=1 SCAR=0.0
| |||
| 23 | |||
| 24 | 4 | has _parser_class => ( | |
| 25 | is => 'lazy', builder => '_build_parser_class', | ||
| 26 | ); | ||
| 27 | |||
| 28 | sub _build_parser_class { | ||
| 29 | 4 | ▶ | return join q{::}, 'DBIx::Class::ParseError::Parser', shift->db_driver; |
|
Subroutine
_build_parser_class: called CC=1 SCAR=0.0
| |||
| 30 | } | ||
| 31 | |||
| 32 | 4 | has _parser => ( | |
| 33 | is => 'lazy', builder => '_build_parser', | ||
| 34 | ); | ||
| 35 | |||
| 36 | sub _build_parser { | ||
| 37 | 4 | ▶ | my $self = shift; |
|
Subroutine
_build_parser: called CC=1 SCAR=0.2
| |||
| 38 | return try { | ||
| 39 | 4 | ▶ | use_module($self->_parser_class)->new( |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 40 | schema => $self->_schema | ||
| 41 | ) | ||
| 42 | 4 | ▶ | } catch { die 'No parser found for ' . $self->_db_driver }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 43 | } | ||
| 44 | |||
| 45 | sub process { | ||
| 46 | 17 | ▶ | my ($self, $error) = @_; |
|
Subroutine
process: called CC=1 SCAR=0.6
Pod
undocumented
| |||
| 47 | 17 | ▶ | return try { $self->_parser->process($error) } |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 48 | 17 | ▶ | catch { warn $_; DBIx::Class::Exception->throw($error) }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=2.6
| |||
| 49 | } | ||
| 50 | |||
| 51 | 4 | 1; | |
| 52 | |||
| 53 | __END__ | ||