578
|
883 |
35 |
0 |
$self->{'debugobj'} ||= do {
if (my $profile = $ENV{'DBIC_TRACE_PROFILE'}) {
require DBIx::Class::Storage::Debug::PrettyPrint;
my @pp_args;
if ($profile =~ m[^\.?/]) {
require DBIx::Class::Optional::Dependencies;
if (my $missing = 'DBIx::Class::Optional::Dependencies'->req_missing_for('config_file_reader')) {
$self->throw_exception("Unable to parse TRACE_PROFILE config file '${profile}' without $missing");
};
my $cfg = &dbic_internal_try(sub {
'Config::Any'->load_files({'files', [$profile], 'use_ext', 1});
}
, &dbic_internal_catch(sub {
$_ =~ s/at \s+ .+ Storage\.pm \s line \s \d+ $//x;
$self->throw_exception("Failure processing \$ENV{DBIC_TRACE_PROFILE}: $_");
}
));
@pp_args = values %{$$cfg[0];};
}
else {
@pp_args = {'profile', $profile};
};
&dbic_internal_try(sub {
'DBIx::Class::Storage::Debug::PrettyPrint'->new(@pp_args);
}
, &dbic_internal_catch(sub {
$self->throw_exception($_);
}
));
}
else {
require DBIx::Class::Storage::Statistics;
'DBIx::Class::Storage::Statistics'->new;
}
} |