I have a Perl script ("use"-ing a number of packages written by me) which is supposed to be run from a particular directory (this is the "supported" version of the script). Some smart users are making a local copy of this script and using that after making whatever modifications they want. How to prevent this?
Make your users sign a contract not to change the code, and only to run the script in the supported way.
Or only provide the software "as a service", i.e. have it run on machines that you control.
I'm serious. There's no reliable way to ensure the integrity of a program (be it Perl, C or anything else) on a machine that somebody else has administrative access to.
Update: as davido++ pointed out, there's a third option: you can make your code flexible enough and provide an API for extensions. Then others don't feel a need to change your code.