I want to create a plugin for pt-archiver and I can’t seem to get it working.
These are the relevant versions:
$ pt-archiver --version
pt-archiver 3.6.0
$ perl --version
This is perl 5, version 38, subversion 2 (v5.38.2)
This is the pt-archiver command without any plugins and it works just fine.
$ /opt/homebrew/bin/pt-archiver
–source h=127.0.0.1,D=sb1,t=t1,u=root,p=test
–progress=500
–where=“1=1”
–primary-key-only
–purgeTIME ELAPSED COUNT
2024-11-29T08:06:43 0 0
Then I copied/pasted the plugin from the documentation found here and saved it as /tmp/test_plugin.pm.
package test_plugin;
sub new {
my ( $class, %args ) = @_;
return bless(%args, $class);
}sub before_begin {
my ( $self, %args ) = @_;
$self->{cols} = $args{cols};
}sub is_archivable {
my ( $self, %args ) = @_;
return 1;
}sub before_delete {} # Take no action
sub before_insert {} # Take no action
sub custom_sth {} # Take no action
sub after_finish {} # Take no action1;
Then I added the plugin parameter to the pt-archiver like this:
/opt/homebrew/bin/pt-archiver
–source h=127.0.0.1,D=sb1,t=t1,u=root,p=test
–progress=500
–where=“1=1”
–primary-key-only
–purge
–plugin=test_plugin.pm
And when I run it with PTDEBUG=1, I get this error:
Bareword “test_plugin.pm” not allowed while “strict subs” in use at (eval 34) line 1.
What am I doing wrong here? Can anyone give some pointers on what I can try to debug this issue?