Serializing $self to call my own Perl script

RT lets you run arbitrary code when a ticket is created/updated, but
I’m lazy and don’t want to type my code into the textbox.

What’s the best way to serialize the $self object to a file so I can
then do system(“myscript.pl file-with-serialized-self-.txt”) or something?