Sanity checking mason

I have found myself doing quite a bit of mason at work lately, both maintaining old legacy stuff and as the view in a catalyst app.

While doing this I found myself missing the old ‘perl -c’ to quickly sanity check code, however naturally that won’t work on Mason – as mason is essentially HTML with inline perl, not the other way around. As such I wrote a quick script that emulates ‘perl -c’ by loading the file using mason inside eval then printing any errors. The script itself is pretty simple, though it doesn’t have any support for printing useful line numbers – but at least it gives an idea of what/where the problem is. The script also declares $c and $m, as at least for Catalyst – those will be available.

You can clone the gist, or just copy+paste the code:

3 Responses to “Sanity checking mason”

  1. [...] original post here: Sanity checking mason By admin | category: Script??????? | tags: mario, missing-the-old, myself-doing, [...]

  2. Rich says:

    I was looking for exactly this kind of tool. What happened to the code?

Leave a Reply