update: ASP is Application Service Provider
I've worked at a couple startup companies and learned a couple different ways to structure licensing, these two may help you:
- Use an ASP model where you run the script on your server and license access to that server to perform the critical functions. This way you can publish an API to the service without compromising the integrity of your code.
- Another way is to have the customer sign a non-disclosure agreement spelling out that they will pay a set amount of damages (make the amount high enough that they won't want to pay it) if they disseminate the script without your permission.
What time is it? It's Camel Time!