If you're using Dancer, there is already a small plugin someone wrote (as his first CPAN upload) called Dancer::Plugin::SiteMap which provides the same idea by adding:
use Dancer::Plugin::SiteMap;
to your code.
P.S.:
I personally love Catalyst and use it on several large-scale projects. If you don't know it, you should!
A few months ago a client asked if could help them with a "double encoded UTF-8 data problem", they had managed to store several GB of data with "corrupted" UTF-8 (technically it's not corrupt UTF-8 since its well-formed UTF-8). During the process I developed several regexs that I would like to share and may prove useful to you someday.
Due to the UTF-8 encoding usage of prefix codes it's easy to spot a double encoded UTF-8 sequence, the prefix code is within the range of U+00C2 to U+00F4, followed by one or more continuation codes within in the range U+0080 to U+00BF.
So I heard about The Lacuna Expanse http://www.lacunaexpanse.com here on blogs.perl.org the other day when Jesse Thompson posted about it. It's a "massively multiplayer strategic empire simulator" written in Perl.
I started playing last night after work. I choose the rather unimaginative empire name of "Mr. Muskrat's Empire". I renamed my colony "Luas".
The GUI is very polished looking. The graphics are very detailed for a browser-based game. You have multiple zoom levels to choose from. I typically keep it zoomed all the way out unless I want to the see new details of buildings as they are upgraded.
They are running three contests (at last count). I entered the volcano contest and already received my volcano! I won't tell you what it does but you might want to enter fast before all ten are gone. I am entering a second one as I type this up; I want the Kalavian Ruins because they look a lot like the Colosseum (and I really want to know what they do).
I fixed some nasty bugs lately and get these days ready for the next testrelease. Im happy that this release brings also some new features. And I don't mean new for Kephra, but literally unknown to many editors. and in this episode I will highlight just 2 of them.
I already mentioned, that if you select a text by holding the left mouse button and while its still pressed you push the right too, the text gets deleted (opposite of acme). Now i just seperate the direction you selected it. If its from left to right, its cuts, meaning remember in the clipboard. if you do it backwards, its not (function called clear.). In times you still have something in the clipboard, that might come very handy. I found this kind of editing very fast and I like it the more i use that.
Here’s a bitter, but very accurate description of what goes for open community development in the realm of .NET (Thanks, Merlyn!). It’s a pretty sad state of affair, and I can attest for at least some of it, mainly:
”Last year Microsoft released a new web framework called MVC. It’s not new by web standards … Yet people were waiting for it. People were waiting for Microsoft to deliver it to them.”
”Microsoft themselves … are so cleverly changing just fast enough to keep developers from solving problems themselves.”
And this also goes for faulty “standards”. Some half-baked ideas (like the Microsoft .NET remoting framework) are getting implemented into core systems before someone, Microsoft or else, realises that these are the technical equivalent of horse manure that spent several days in the sun, and now, not only that they are stuck with it, but Microsoft is no longer providing support for their festering framework of scum and villainy.
While normally I never play Facebook'y web games like Farmville, clearly an exception should be made for Lacuna Expanse, especially since it's made with Perl and since it's only been running for 2 days, we can set up a nice little Perl posse in the very first week and rule the universe!
(Evil laugh follows, echoing and trailing into the distance)
(I am contactable with the rather unimaginative empire name of "Adam")
This game probably also marks the highest volume and potentially most high profile user of Email::Stuff (one of my favourite little creations) outside of myself and Ricardo who now maintains it.
It's royalty report time, so the mailbox was full of checks this week. I keep close tabs on how well my books do so I can figure out if the time to write the books would have been better spent making fancy coffees at Starbucks. I think I'm slightly ahead, but only slightly.
However, I noticed that the total revenue for Learning Perl, 4th Edition is very close to $1,000,000 for the 20 quarters it has been available. And, curiously, it's getting closer to that number even though the latest edition has been out for 9 quarters. Who's still buying the old edition?
Even better, though, the Fifth Edition is already over $500,000 in total revenue. Now, only a small slice of that gets to the authors, especially on a title with multiple authors, and that only comes four times a year over several years. My cut of Learning Perl, 4th Edition is only 1%, so I'm not buying any Bentleys.
I use the nifty Data::Rmap to "flatten" DateTime objects into strings so they can be exported to JSON and handled outside Perl. But due to circular checking in Data::Rmap, this:
If you want syntax highlighting when viewing docs and source at search.cpan.org, you don't actually need to use Greasemonkey. You can do it with Plack and be up and running in just a few minutes.
Last night I gave a lightning talk about this at Toronto.pm and I've just posted the slides
cd cpan-mangler
plackup -I../Plack-Middleware-HTMLify/lib
---
Once you've got that done, just point your browser at http://localhost:5000 and use search.cpan.org as you normally would. It's the same site, only prettier. Now, it's not perfect, but it's a fun idea. Using the proxy setup you can bend the site to your will and add or remove features as you see fit.
For my recent projects, I've been using Dist::Zilla and enjoying its very advanced features. The reason I've never used it before? I thought it had a silly name. I still do, in fact, just that I managed to ignore the silliness enough to find out it incorporates some major wins.
Another project I overlooked is KiokuDB. I was looking around for a non-relational/Object-based/Document-based Database (aka NoSQL), and kept overlooking KiokuDB for two reasons; first, KiokuDB is a front-end to several different back-ends, including RDBMS like MySQL and Postgresql, making me unsure whether it is a true object-based DB, or just a glorified ORM, and second, it has a silly name.
I knocked off another big chunks of distributions that MyCPAN didn't like. I worked on the 700 or so dists that it couldn't unpack, and that number is now down to about 30. The changes to my method weren't that dramatic, but it clears up a bunch of the problem dists.
First, I was stopping too soon. Many archives unpack just fine even if they give warnings. Now I'll just record the warnings and wait to see if I get a directory with some files in it.
Second, I was using an HFS case-insensitive file system (stupid, but it's the default). Many distributions did not like that. Moving everything to a case-sensitive file system solved many of those problems.
Once I find out why Foo-Bar-0.01.tar.gz doesn't unpack, I usually solve the problem for all Foo-Bar-* series which probably had the same problem.
JT Smith and his crew have created a massively multiplayer online game called the Lacuna Expanse. The game is great, but the coolest part is that the back-end is written entirely with Perl!
I've mentioned this elsewhere, but I thought it was worth mentioning here: my wife and I are moving to Amsterdam next month. After three lovely years with the BBC, I'm giving in to the temptations of Amsterdam and booking.com. Here comes a new adventure!
I knew BBEdit would update open files when they changed on disk, but I never thought to try that with a continually updating file. It works. You just have to have the file open. No big whoop.
During a refactor of a data from array @foo to hash %foo, I used 'each' to iterate over the hash, but forgot to change the 'for' statement with 'while'. So I ended up with something like:
And this is nasty because for(@ary) aliases $_ to each element in @ary, and in this case it modifies $k (quiz #1: and $v too, do you know why?) right under your nose! Thus the result are really messed up:
{ "\$_" => "a x", "k" => "a x", "v" => 1 }
{ "\$_" => "a x x", "k" => "a x", "v" => "a x x" }
Not to mention the loop stops after processing two items (quiz #2: do you know why?) But you might not realize that after you add some pairs to %a and wondering why they don't get processed.
The error message Perl gives is not really helpful, to say the least :)
We'll have another hack session at Quetzal Internet Cafe in the
middle of October. The location is close to Civic Center BART,
and the 38, 47, and 49 bus lines. Come bring you laptop and hack on your
favorite CPAN module, and chat with fellow SF.pm Perl Mongers.
Part of the 3% of the distributions I couldn't index with MyCPAN had encoding issues. YAML is supposed to be UTF-8, but when I don't always get UTF-8 when I generate a META.yml for files that don't have one. I guess I could do the work to poke around in Makemaker, etc, to convert all the values before I generate the META.yml, but um, no. Not only that, not all of the META.yml files already in the dists are UTF-8. Remember, however, this is a very small part of BackPAN: about 700 distributions out of 140,000 (or about 1/7th of my problem cases).
A couple hundred distros have Makefile.PL files encoded as Latin-1 in a way that it matters. If it's not collapsable to ASCII, the META.yml ends up with Latin-1 in it. Some YAML parsers refuse to deal with that.