In November we reached the 6 million reports submitted mark. It's quite staggering how many reports are being submitted these days. It's now roughly 1 million reports every 3 months! So expect a 10 million reports post some time in August 2010 :)
If you have uploaded a distribution to CPAN via Pause recently you may have noticed a link to Mike Schilli's blog where he explains how to publish directly from GitHub.
It only works if your git working copy is structured the same way as the tarball that you want to upload to CPAN. So, if you are making heavy use of MANIFEST.SKIP this probably won't work for you (unless you are also git-ignoring those files). You will also have to ensure that the version number in META.yml in incremented (I've generally rely on ExtUtils::MakeMaker to do this when using make dist).
The only problem that I encountered was that the top level directory in the tarball follows GitHub's conventions rather than the usual module name + version directory created by make dist. So for instance you would get something like /jmcnamara-mymodule-ce15c1e instead of /My-Module-0.01.
Anyway, I uploaded a recent distribution using this method and it worked out well. If you are using GitHub as your repo you should try it.
I Love ALL the Perl Advent Calendars!! The Perl6 calendar has got me SO excited for Perl6, I can't wait to finish a couple of my projects so I can get a new version of pugs installed. The last time I installed pugs was 11 months ago and most/many of the examples don't complie on my buildout. :(
I have gradually been drifting towards Python in recent months due to my fright of what will happen to Perl5 when Perl6 comes along. But with the advent of the advent calendars, it's been a rejuvenation or even a renaissance in my interest in Perl and programming all together.
So THANKS to all who have put the time in to prepare all of this wonderful content. It really underscores the quality of people we have in the Perl community.
Here is a compact way of writing a multi-value if statement.
Lets say you have a scalar string variable and need to see if it matches a number of possible values. You want it not case-sensitive and the comparisons must match exactly.
Source code:
#Search word
$pet = "rabbit";
#Regular Expression: / ^=beginning of string, $pet variable, $=end of string / i=ignore case
#Using Anonymous Array: ("cat", "dog", "...as-many-as-you-like...", "horse")
if ( grep /^$pet$/i, ("cat","dog","hamster","RABBIT","Raccoon","Monkey","horse") ) {
printf("A %s is a Mammal.\n", ucfirst($pet) );
}
elsif ( grep /^$pet$/i, ("Alligator", "frog", "salamander", "Snake", "toad") ) {
printf("A %s is an Amphibian.\n", ucfirst($pet) );
}
else {
printf("What is a %s ?\n", ucfirst($pet) );
}
#- - - end - - -
One of the first posts on my old journal (which I still don't know if I want to copy the entries here) was entitled Tests are Heavenly. In that post I wrote about how I started adopting TDD for administration purposes.
Recently I've been getting CPANTS reports (<3 CPANTS!) on my WWW::FMyLife module. At first I thought my tests were off. Yesterday I finally got down to take a closer look at the reports and code. I tried some variable dumps (my favorite debugging method) of the data I was receiving from FMyLife.com in the module. Then I noticed that FMyLife were sending me different data than they are suppose to. They aren't following their API correctly.
I've uploaded the first release of App::Pod2CpanHtml to CPAN. The main purpose of this module is to install a pod2cpanhtml executable for converting Pod to search.cpan style HTML.
pod2cpanhtml SomeModule.pm > some_module.html
I initially wrote the executable in response to a question on PerlMonks. It is just a very thin wrapper around Pod::Simple::HTML combined with the search.cpan CSS.
I find that I use this utility all the time, for generating HTML docs and for proof reading documentation prior to uploading it to CPAN, so I thought that I may as well make a module out of it.
This also serves as an answer to the frequently asked question "How do I create HTML docs like on CPAN".
The main reason that the module produces HTML output that looks like search.cpan is that it uses the same CSS style sheet. I'm not sure who wrote that but they deserve some praise for achieving a clear, uncluttered and appealing layout.
I've been thinking about how to make an application I'm currently designing more REST-like. (You'll forgive me if I avoid the atrocious neologism "RESTful.") The HTML forms specification only supports the GET and POST methods for form submission, but if you've ever designed a web service for other HTTP clients, you've probably had a good reason to use PUT and DELETE as well. PUT is an idempotent create operation; sending the same PUT twice will cause the same resource to be created at the same URI, whereas a duplicate POST could have unknown, possibly disastrous side-effects. And HTML forms have no support at all for anything resembling DELETE -- how often have you designed an application that requires a POST to delete an object? That doesn't make sense.
Sometimes I forget to run Perl base tests for my modules, before committing changes. As to what happens, I end up committing something that doesn't quite compile ;)
Luckily Git has a pre-commit hook one can use to run at least the "compile" tests.
The following aborts the commit if the t/00*.t tests (usually the "do all modules compile?" tests) in the repository don't run correctly; stick it in
.git/hooks/pre-commit
:
#!/usr/bin/perl
# Runs modules' "compiles" tests before committing
# Dies (halting commit) if they don't compile
print "pre-commit => testing..\n";
do {qx{
prove -Ilib t/00*.t
}} or die <<'DIEMSG';
pre-commit => ERRORS:
$@
DIEMSG
print "pre-commit => test OK\n";
This is an example of a 00-load.t file, that can literally be dropped-in the t/ directory:
use strict;
use warnings;
use Test::More;
use File::Find::Rule;
my @files = File::Find::Rule->name('*.pm')->in('lib');
plan tests => ~ ~ @files;
for (@files) {
s/^lib.//;
s/.pm$//;
s{[\\/]}{::}g;
ok(
eval "require $_; 1",
"loaded $_ with no problems",
);
}
File::Find::Rule
is one of the golden gems found on CPAN, rclamp++!
Are you a sysadmin and you're running servers with a lot of Perl code and Perl modules installed? You are a Perl hacker, who wish to access the complete CPAN repository on his notebook even when not connected to the internet?
Why not set-up your own CPAN-Mirror then? It's really easy.
The past year has been work filled, but its about time to finish up work on the Perl 5 core IPv6 functions. The last bits of functions to work on are getaddrinfo() and getnameinfo(). I'll need to play with Inline::C a bit to try out a few things. At a minimum, it getaddrinfo will look at bit like...
my $kablam = POSIX::getaddrinfo('blogs.perl.org', 'www');
I've not decided whether to allow the additional hints in the addrinfo struct as a hashref or as additional parameters. Right now, I'm thinking as a hashref should be enough. I'm working what will get exactly returned from getaddrinfo() yet in what order. Decisions, decisions, decisions.
There does need to be a separate clean up of the content, I'm wondering what the advantage of this site is (now), over say, having more information on say http://learn.perl.org/ about how to do testing.
Anyway, I've got other projects to sort out first, but may come back to this at some point.
This is a script I've wanted to share for a while, but I haven't yet had the chance to figure out how to write App::Highlight (if anybody could give me some pointers in this direction it would be much appreciated!)
highlight.pl is designed to be piped into, like grep or ack, but instead of filtering out lines which don't match it just highlights words which do, similar to "ack --passthru" except that you get different coloured highlights for your different matches.
If you're a sysadmin or if you run a Perl software development environment, you might want to give your users or developers the possibility to install Perl modules from CPAN into their private user-space. This could be helpful for trying out new modules or playing around with modules that might be used in production at a later time. Or, if a developer wants to test a new version of a module without overwriting the system-wide installed version of that module.
Here is a step by step instruction how you could set-up user-space CPAN support.
Gitalist started out as an attempt to port gitweb to Catalyst but ended up as a new piece of software with gitweb URL compatiblity (and stuck with its original transitional name). This first developer release should see a fully functioning Catalyst app with full gitweb URL backwards compatibility and no major bugs, although there are plenty of rough edges.
As it stands the app itself is quite simple internally and externally thanks, in no small part, to Zac and Tom's marvellous work on the model. They stripped it down from a single monolithic Model class and transformed it into a sane and sensible set of domain objects. As for the external bits the frontend consists of HTML5 and CSS (with JavaScript knobs and whistles to come) which is all brought to you by Template Toolkit.