# Pt-archiver plugin error

**URL:** <https://forums.percona.com/t/pt-archiver-plugin-error/35356>\
**Category:** Percona Toolkit\
**Tags:** mysql, percona\
**Created:** [November 29, 2024, 4:40pm UTC](https://forums.percona.com/t/pt-archiver-plugin-error/35356 "2024-11-29T16:40:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![brianestrada658](https://avatars.discourse-cdn.com/v4/letter/b/839c29/32.png) [@brianestrada658](https://forums.percona.com/u/brianestrada658)\
**Post date:** [November 29, 2024, 4:40pm UTC](https://forums.percona.com/t/pt-archiver-plugin-error/35356/1 "2024-11-29T16:40:50Z")

</div>

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   
> –purge
> 
> TIME ELAPSED COUNT  
> 2024-11-29T08:06:43 0 0

Then I copied/pasted the plugin from the documentation found [here](https://docs.percona.com/percona-toolkit/pt-archiver.html#extending) 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 action
> 
> 1;

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?

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [November 29, 2024, 9:39pm UTC](https://forums.percona.com/t/pt-archiver-plugin-error/35356/2 "2024-11-29T21:39:33Z")

</div>

The docs say:

```auto
Specify the Perl module name

```

In your example, you are specifying the filename (test\_plugin.pm). Try specifying only the module name.

---

<div class="post-metadata">

**Author:** ![brianestrada658](https://avatars.discourse-cdn.com/v4/letter/b/839c29/32.png) [@brianestrada658](https://forums.percona.com/u/brianestrada658)\
**Post date:** [November 30, 2024, 4:05am UTC](https://forums.percona.com/t/pt-archiver-plugin-error/35356/3 "2024-11-30T04:05:19Z")

</div>

So I tried 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”
> 
> Bareword “test\_plugin.pm” not allowed while “strict subs” in use at (eval 34) line 1.

It is the same error though.

---

<div class="post-metadata">

**Author:** ![brianestrada658](https://avatars.discourse-cdn.com/v4/letter/b/839c29/32.png) [@brianestrada658](https://forums.percona.com/u/brianestrada658)\
**Post date:** [November 30, 2024, 4:10am UTC](https://forums.percona.com/t/pt-archiver-plugin-error/35356/4 "2024-11-30T04:10:42Z")

</div>

Actually, if I specify m=test\_plugin instead of using --plugin option, it actually works. I just need to make sure that test\_plugin.pm is in the proper path that pt-archiver can find.
