Building on my (second) example from my recent post A Simple Mojolicious/DBI Example, I thought I would take it just a little bit futher. One of my favorite features of Mojolicious is that it comes with WebSockets out of the box! In this example I show how you can take the example script and allow it to run without refreshing the window.
[ This is cross-posted from the
new home of the Ocean of Awareness blog. ]
This post is part of
a configurable HTML parser.
The last two posts described how to change
the context and contents of the HTML
elements, both new and existing.
This post describes how to configure
optional start tags: how to change
which start tags
and how to specify the circumstances
in which they will be supplied.
How the parser works
In the first posts in this series I went into some detail describing
my Marpa-based approach to HTML parsing.
Briefly, it combines a parse engine using a "wishful thinking" grammar
with a Ruby Slippers lexer.
The "wishful thinking" grammar expects all elements,
to have both start and end tags.
This overstrict grammar demands tags even in cases
HTML 4.01 Strict DTD
mandates that they be treated as optional.
The 15th German Perlworkshop is taking place from March 13th to 15th 2013 in Berlin. The main workshop language is german, but we also welcome talks in english.
The venue is located in the center of Berlin-Kreuzberg at the Betahaus.
We are ready to accept talk proposals. Usually we have 20 and 40 minute talks and Lightning talks (5 minutes).
To submit a talk, go to http://act.yapc.eu/gpw2013/newtalk. The deadline is December 13th 2012. You can also contact us via email@example.com or at #dpw2013 on irc.perl.org.
We thank the $foo-Magazin for being our first sponsor.
I've been publishing simple web service wrappers on CPAN for other people's web services for years, but for some reason I never got around to writing a wrapper for my own web services until now. I'm pleased to announce TheGameCrafter::Client. It is just a light-weight wrapper around The Game Crafter's web service API so that you can get down to the business of writing your app and not worrying about how to make requests and serialize/deserialize data.
How do I determine what the content-encoding of a web page is? A simple question which after doing a little searching did not turn up a simple answer. A stackoverflow question lead me to the solution but did not answer the question directly so here I am writing it up. We will need to install these modules first:
cpan Compress::Zlib LWP::UserAgent
In A Simple Mojolicious/DBI Example Joel Berger demonstrates how to build a very simple CRUD web app (well, a CR one anyway) using Mojolicious and DBI. I was impressed at how concise it was, and wondered how my preferred technology stack would compare.
I'm not a fan of template languages, preferring DOM manipulation. And rather than Mojo, I'm using Plack here. Anyway, this is what I came up with...
A friend of mine is learning database administration, but for the first time needs to connect it to a webapp. Having done most of his work in MS Access, he has no idea what a web framework is, nor how one would connect a database to it. To help him learn I wrote up a little application using Mojolicious and SQLite.