pt-archiver custom module won't work even with documented example
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
I was trying to use the custom modules for pt-archiver documented at http://
Using an exact copy/paste of the example module
====Begin paste===
package My::Module;
sub new {
my ( $class, %args ) = @_;
return bless(\%args, $class);
}
sub before_begin {
my ( $self, %args ) = @_;
# Save column names for later
$self->{cols} = $args{cols};
}
sub is_archivable {
my ( $self, %args ) = @_;
# Do some advanced logic with $args{row}
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 action
1;
====End paste===
I attempt to run with:
pt-archiver --source A=utf8,
And am greeted with:
Can't call method "before_begin" without a package or object reference at /usr/bin/
I have a My/Module.pm in Perls @INC paths so it is definitely able to find the file.
tags: | added: docs pt-archiver |
Changed in percona-toolkit: | |
milestone: | none → 2.2.2 |
assignee: | nobody → Brian Fraser (fraserbn) |
Changed in percona-toolkit: | |
status: | Triaged → Incomplete |
Yes, the docs might be inaccurate. There are tests for plugins, but they use single namespaces instead of multiple like My::Plugin. So perhaps multiple don't actually work. What does work, and is a workaround for the moment, is using a single namespace for the package like "package foo" and put that in foo.pm, then m=foo. If @INC has whatever dir foo.pm is in, that should work.