So, I've been playing a little with Mojolicious::Lite, and here's what I came up with :-)
Tweetylicious is a small - but rather complete - microblogging web application in a single file! It is meant to demonstrate how easy and fun it is to create your own Web applications using modern Perl 5 and jQuery!
Some features:
- Multi-user, with homepages, search and list of followers/following
- Nice, clean, pretty interface (at least I think so :P)
- User avatar images provided by gravatar
- Unicode support
- Well structured, commented code, easy to expand and customize
- Encrypted online sessions
- Uses an actual database (SQLite) and stores encrypted user password
If you want it, the full code is in github. Removing just blank lines and comments, the Model has ~80 lines, the Controller ~110 lines, templates ~170 lines, plus ~90 lines of static css and ~60 of static javascript. And that's the whole app :D
How do you run it?
perl tweetylicious.pl daemon
You'll need Mojolicious and ORLite - two very lightweight modules - to run the app, and that's about it! A live Internet connection is also good, since it fetches jQuery on the fly.
Mind you, it's far from perfect (bug reports and patches always welcome!). I wrote it as a demo to show the kind of stuff you can quickly achieve with Perl. It's totally usable and might be a good fit for quick deployment and customization on internal networks, but if you're looking for a business ready microblogging solution, you might want to look at status.net (which powers identi.ca). But it's waaaay bigger ;-P
Tutorial...ish
I tried making the commits linear and modular, so newcomers can take a look at git log for a "tutorial":
- initial commit - diff, full file
- adding index page (and route) - diff, full file
- separating common html into a shareable 'layout' - diff, full file
- adding (all) css - sorry, this is not a css tutorial :P - diff, full file
- users will need to 'login' and 'join' (register)! - diff, full file
- first jQuery contact: turning links into buttons - diff, full file
- creating the 'User' model schema in our database - diff, full file
- registering users: the template - diff, full file
- registering users: the controller - diff, full file
- registering users: validating registration data - diff, full file
- registering users: prevent usernames that are part of a route - diff, full file
- user login: the template (and basic route) - diff, full file
- user login: the controller (handling form submission) - diff, full file
- user logout: controller, and option in template - diff, full file
- the user's homepage (template) - diff, full file
- the user's homepage (controller) - diff, full file
- adding a 'not found' page - diff, full file
- making 'login' and 'join' redirect to user's homepage - diff, full file
- updating our model: posts! - diff, full file
- making user's homepage show posts (but user can't create them just yet - diff, full file
- updating our controller: creating posts - diff, full file
- updating our controller: deleting posts - diff, full file
- updating our controller: turning common posting auth code into a ladder - diff, full file
- more jQuery: styling post submit into a button too - diff, full file
- more jQuery: showing how many characters are left in a post - diff, full file
- more jQuery: highlighting posts on hover - diff, full file
- more jQuery: formatting our content for RTs (@user) - diff, full file
- creating posts via Ajax (rather, Ajaj, since we're using JSON ;) - diff, full file
- deleting posts via Ajax (rather, Ajaj, since we're using JSON ;) - diff, full file
- searching posts: search form template - diff, full file
- searching posts: jQuery effects - diff, full file
- searching posts: model - diff, full file
- searching posts: controller - diff, full file
- searching posts: results template - diff, full file
- searching posts: jQuery (naive) formatting for topics (#topic) - diff, full file
- followers and following: the model - diff, full file
- followers and following: the controller - diff, full file
- followers and following: template changes - diff, full file
Newer commits will likely be not as organized, and mostly bugfixing, but this should get people going - hopefully :P
Well, that's it. Have fun!