I've written my first Perl 6 module! I wanted to start contributing modules, but it took a while to find one that wasn't already done, but was simple enough to tackle as my first one. I also wanted to make a proper distribution for it, which was something I hadn't done before even in Perl 5, so it took a while to get everything in order. I'm sure there are still mistakes, but I'm still working on it, and it should go much better on future modules.
The distribution is at my GitLab repository. So far, it's just a simple wrapper around the 'ssh' command-line tool, which runs a command on a remote server and returns the output as an array of lines. I borrowed some of the code from the Perl 5 module Net::SSH, and Perl 6-ified it. It's not ready for panda or anything, but I hope to get it there once I make it more capable and add more error-checking and testing. A few observations:
I released GitPrep 1.11. You can install portable GitHub system into Unix / Linux easily. It is second major release.
Because you can install GitPrep into your own server, you can create users and repositories without limit. You can use GitPrep freely because GitPrep is free software. You can also install GitPrep into shared rental server.
Recently I have been working on this cool idea: using B::Deparse to help me figure out exactly where a program is stopped. This can be used in a backtrace such as when a program crashes from Carp::Confess or in a debugger like Devel::Trepan.
To motivate the idea a little bit, suppose my program has either of these lines:
$x = $a/$b + $c/$d;
($y, $z) = ($e/$f, $g/$h);
I might want to know which division in the line is giving me an illegal division by zero.
Or suppose you see are stopped in a Perl statement like this:
my @x = grep {$_ =~ /^M/} @list;
where exactly are you stopped? And would the places you are stopped at be different if this were written:
(Moved from reddit.com/r/perl now that blogs.perl.org seems to be behaving itself).
Over the past year or so I've had to deal with PPI for parsing and rewriting perl code a handful of times. Refactoring scripts are generally one-shot single purpose. Like any data mangling activity refactoring scripts can get messy because they're generally disposable, so architecture tends to be an afterthought at best. You can kind of tell this if you go and read Perl::Critic policies. They're plagued by boilerplate and repetitive code, and that's for code that is extensively reused. The problem multiplies in the case where you're writing throwaway code against PPI. In this post I'm going to show off PPIx::Refactor, which is a minimal interface to contain a small but annoying part of the mess.
I have started to create a list of programming exercises. Mostly extracted from my Perl beginner course. Some of them already have "Tools" that help solve the exercise. Some of them even have links to a solution in Perl 5.
My plan is to add many more exercises and to provides "Tools" and "Solutions" in Perl 6 and other programming languages as well. (Currently Ruby, Python and JavaScript are on the short list.)
If you have ideas for exercises I'd be happy to hear about them.
Do you use Dancer? Even if you don't, want to help one of the most awesome projects in the Perl community grow and reach a wider audience? You can, and you can get a copy of the book we're writing for helping us out.
Help the Dancer devs bring Dancer to a larger community, and help us get this book done. It will be a great resource for new and experienced developers alike.
I'm pleased to be sponsoring again this year as http://perl.careers/, but a reminder that the deadline for talks is end of this week, Friday the 6th of November!
If you'll just be attending but not speaking, by signing up early you'll make sure there's enough coffee and beer for you...
After this was written I received feedback from several respected members of the community alerting me to the problems that could be caused by is() *guessing* if it should be comparing numbers or strings. After hearing this feedback I agreed that the behavior constituted a bug, and one serious enough to alter the behavior post release. Test::Stream was marked *stable* recently enough that the change should not impact very many people, if in fact any.
The latest version of Test::Stream on CPAN no longer guesses if it is given a number vs a string.
In the very near future cmp_ok, and a 'Classic' bundle which provides just the functionality of Test::More, including classic 'is' and 'is_deeply' will be released, and will be the recommended bundle for people moving from Test::More. Branches and pull requests for both of these have been written, I am giving them some time for review before proceeding with their release.
[This is a post in a new, probably long-ass, series. You may want to begin at the beginning. I do not promise that the next post in the series will be next week. Just that I will eventually finish it, someday. Unless I get hit by a bus.]
Last time I went into more details about how I might go about creating a new date module, and what I would expect it to achieve. This time we clear out some housekeeping and try to nail down a design strategy.
The is_success() method which HTTP::Response provides is not necessarily a full indicator of success. This has bitten me before, so I thought it was worth writing about. Perhaps it may save you some heartache down the line.
Test-Stream, the intended successor of Test-Simple (Test::Builder, Test::More), is moving out of the experimental phase. The experimental notice has been removed from all but a couple modules in the distribution. Now is a good time to start writing new testing tools using Test-Streams capabilities.
What does this mean for Test::More, Test::Builder or my existing test tools?
At the moment it means very little. Test::Builder is still around, and not going anywhere any time soon. At the moment Test::Builder based tools and Test::Stream based tools will not work together in a single test script, though they can both be used in different files in a single test suite.
Task::Dancer2 0.04 and Dancer2::Plugin::Queue 0.005 are on their way to CPAN. D22::P::Queue had test failures preventing it from installing. Task::Dancer2 re-enabled Queue in the bundle, and also the REST plugin.
The web is slow. Between overloaded pages, overloaded servers, bloated browsers, and ISP throttling, it's not unusual for even simple pages to take a couple seconds to load. But you get used to it, so I was struck by how fast the Internet can actually be when I fired up a gopher client recently.
Yes, gopher still exists, barely. For those who are unfamiliar with it, gopher is a sort of text-based hypertext system that predates the web -- think the web minus graphics, fonts, and interactive scripting, just files and directories and links between them, though you can also offer a few other things like search services. I miss those specialized services like gopher, IRC, and Usenet, that did one thing very well before they were overwhelmed by the web.