Mensa plan
I often check what our canteen offer for lunch before we leave our building. The website that presents this portfolio is one of the worst I’ve ever seen and meanwhile I noticed that my private walking Mensa planer has still some bugs, so I had to think about an alternative solution and developed a little Perl script…
My initial idea was to read the website, parse the XML code and print the meals. Not a bit of it! The code of this site is nothing like valid! They invent new tags I’ve never heard about, they close nowhere opened paragraphs or table cells, I do not find the html-closing tag (the document ends with closing it’s body) and so on… It’s to much to mention all it’s unique features, but let me blame the producer: Peinhardt IT Systeme. Seems to be professionals… (A notice has left my mailbox, looking forward to their answer)
How ever, XML parsing fails, solving the bugs also fails, to much of it… So I’m now just grabbing the HTML-code, to extract the interesting content, with a more or less ugly regex, and print them to console… Here is the code:
So if somebody is also joining the Mensa Weinberg, you can copy this code or download it.
The other canteens are also available, just change the value of the variable $mensa
to your preferred one. The numbers can be found in the source code of this stupid website. Ok, to save you from trouble here are the numbers:
- Cafeteria Brandbergweg
- 11
- Cafeteria Burg
- 12
- Mensa Bernburg
- 8
- Mensa Dessau
- 13
- Mensa Franckesche Stiftungen
- 14
- Mensa Harz
- 3
- Mensa Köthen
- 7
- Mensa Neuwerk
- 9
- Mensa Tulpe
- 10
- Mensa Weinberg
- 5
Well, that’s it! Now you can decide within seconds whether it’s worthy to go to lunch or better stay hungry ;)
Leave a comment
There are multiple options to leave a comment: