Caleb Cushing's Blog Also known as XenoTerraCide
Posts with the tag perl:

Annoucing Template::Plugin::Haml

A few months ago we had an assignment in Web Server Admin to create a CGI page, of course the perl was just to print text not actually do anything more, but I decided to use CGI.pmjust because I never had. The whole thing was nothing more than hello world.#!/usr/bin/env perluse 5.012;use CGI qw(:standard);say header,start_html(‘hello world’),h1(‘hello world’),end_html;and I thought, wow I can write all that html with just that? why can’t I use that syntax as a templating language.

A page for Perl WebHosts?

We need a page linked from that says ‘Get Hosted’ (or something like that). The page will have a list of the top 10 Perl friendly web hosts on it. The top 10 will be determined by people with CPAN ID’s voting it up or down (the use of CPAN ID’s should prevent spammers from gaming the system like digg get’s gamed). It could have in the listing, rank, # of positive votes, business name, site uri, technologies supported (e.

I wish my would go away

I been thinking about it for a few days, and of course consider I know nothing about grammar parsing or how any of this works. I wish the my $var; syntax would go away… or at least be less necessary. In almost all cases you want a lexical variable and use strict; doesn’t allow you to use $var anyways. So what’d I’d like to see is my become a mostly unnecessary reserved word, make $var a lexical variable by default, e.

Announcing Dist::Zilla::Plugin::Catalyst

So I just recently finished reading Restful Web Services and decided I wanted to go back and play with Catalyst and REST some. The original way to create a Catalyst skeleton is to run This creates a lot of nice files to get you started. dzil new basically does the same thing for a generic cpan module. Honestly, without any plugins dzil new isn’t that useful. However, once you add Git::Init , you remove several steps from the creation of a new module and repository.

Solving code generation problems in dzil

Firstly I want to clarify a bit on my opinions of PluginBundle::USERNAME modules, as some comments there have inspired this post. I don’t think you should use them because it makes it harder to disableplugins, and I think Robin Smidsrød put it best: Mostly it is because the Dist::Zilla::PluginBundle::USERNAME doesn’t actually say anything about its intention. It only says use Dist::Zilla as this person does, but what does that actually mean?

please don't use Dist::Zilla::PluginBundle::USERNAME

or create them. Here’s the problem…. (short version is Don’t put PodSpellingTests in them)normally you’d have[pluginA][pluginB][pluginC][pluginXTests][pluginYTests][pluginZTests]and one of them doesn’t work on your system (for whatever reason), well you can just do this.[pluginA][pluginB][pluginC];[pluginXTests][pluginYTests][pluginZTests]the ;is a comment in ini, now dzil won’t use that plugin. But people will say well you don’t want to do that of course I want that plugin enabled. Here’s why you may not temporarily. Casual user X has a bug in /your/ module that’s using dzil, they code up a patch, and they want to run your test suite.

Test Perl 5.12 on Arch Linux

Perl 5.12 has been languishing in the testing repo for a while, there are now several packages that have been rebuilt in testing and community testing. All of the rebuilds I reported have been fixed. If you use arch please make sure you’re using their rebuilt packages (and not one you rebuilt because it took like 2 months to do this) if you have any problems file a bug. If you aren’t sure which package is really the problem feel free to drop me a line and I’ll see if I can help you tack it down.

Using ref to fix 5 year old bug

So I haven’t been hacking perl for 5 (or more) years but I forked Template::ShowStartStop from Template::Timer which is that old. since I forked it this test has bugged me since I didn’t really understand the test, the section of code it referred to or the actual problem. This is an approximation of the error you’d get. Couldn’t render template “undef error - Can’t call method “name” on unblessed reference at /usr/lib/perl5/site_perl/5.

Testing TT Template's

So the poorly made patch the other day converted my Test::More test to use Template::Testwhich removed quite a bit of code from the test itself. I hadn’t seen Template::Test beforehand.Here’s a very simple example of a test you could write to make sure a template is being output ok.#!perluse strict;use warnings;use Template::Test;my $tt = Template->new();my $vars = {var => ‘world’,};test_expect(*DATA, $tt, $vars);DATA–test–hello [% var %]–expect–hello worldIf you want more examples I now have quite a few for Template::ShowStartStopwhich you can see in the Test directory of the master branch.

GPL 3 and Artistic 2.0 Software::License

As of right now Software::Licensehas no way to combine licenses on the fly. To be honest this deficiency might not be a bug in SL, it could be in Pod::Weaveror Dist::Zillathis is a know deficiency and RJBS plans on fixing it at some point. In the mean time we can implement dual licenses (and multi-licenses) in much the same way the Perl5 license is implemented.I was probably in legal violation (I am not a lawyer) with Template::ShowStartStopversion 0.