Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package DBIx::Skinny::Mixin::CustomProfiler;
- use strict;
- use warnings;
- our $VERSION = '0.01';
- use Carp ( );
- sub register_method
- {
- return {
- register_profiler => \®ister_profiler,
- };
- }
- sub register_profiler
- {
- my $class = shift;
- my ($profiler, $config, $profile) = @_;
- eval "use $profiler"; ## no critic
- Carp::croak $@ if $@;
- unless ( $profiler->can('record_query') ) {
- Carp::croak "profiler must implement a 'record_query' method";
- }
- $class->attribute->{profile} = $profile || 0;
- $class->attribute->{profiler} = $profiler->new($config);
- }
- 1;
Add Comment
Please, Sign In to add comment