Since I’ve been working on unifying my website, I decided that I would take some time to update some of the other sections of my site while I was at it. The first thing that I wanted to work on was my dice roller – this is probably some of the oldest working perl code that I have, and it shows. It has some fairly obvious security flaws, an inflexible persistence model, and is lacking some options I’ve wanted for a while.
So, I’ve decided to update the code. Since it’s less than 150 lines of code, it should be easy to rewrite from scratch, so that’s my initial plan. Here is my feature list, in priority order:
- Rewrite the rolling engine:
Strip the CGI parameter for id – I don’t have a use case for multiple dice rollers anymore.Sanitize input.Update storage model for rolls.(Used Storable)
- Rewrite the display engine:
Strip the template parameter – This is a security hole and I don’t have a use case for it anymore.Sanitize output.Find a better way to import templates.(used HTML::Template)
- Do better session management
Keep the user’s options so they don’t have to retype them every time.Explore cookies or CGI sessions for this.(Used CGI::Session and cookies)
- Unify my Gaussian dice roller via options rather than a separate script.
- Provide options for counting dice over a threshold (like World of Darkness “successes”).
- Provide options for getting the total value of the dice (lots of games do this).
- Explore output filters
- Name
- Game name?
- Provide options for glyph dice (Star Wars).
- Provide options for exploding dice.
And, as it turns out, it took me longer to write this post than it did to update. Here it is!