Posted by brian d foy on October 8, 2014
In The double diamond, a more secure <>, I showed how the diamond operator treated some characters as special when it tried to open the filenames in
@ARGV. I used a file name that ended with a
| to read the output for an external command.
Thinking about it more, I realized the problem is even worse. Opening an external command to read the output might even be useful. What if I start the filename with
> to open a file for writing, but not only writing, to truncate it to? » Read more…
Posted by brian d foy on October 6, 2014
We’ve had the three argument
open since Perl 5.6. This allows us to separate the way we want to interact with the file from the filename. There’s a place where we don’t get to choose, but Perl 5.22 might introduce a new operator to handle that. » Read more…
Posted by brian d foy on October 1, 2014
Problems with data serializers was a major change to Mastering Perl. The Storable issue with malformed inputs was known for a long time but nobody much cared about it. Now it’s Data::Dumper‘s turn. » Read more…
Posted by brian d foy on August 26, 2014
If you’ve enjoyed this website, you have the chance to show your support and to help the global Perl community.
The organizers of the 2014 Swiss Perl Workshop are also trying to organize the Perl community in Switzerland. As part of that, we are running a Kickstarter campaign to fund a Mastering Perl class while I’m there. » Read more…
Posted by brian d foy on July 17, 2014
Earlier this year, Emma Howson posted a nice explanation of how Perl sorts a list. In short, Perl used to use quicksort and now uses mergesort. She then shows how each of those works.
I’ve never bothered to explain those in the Learning Perl class. I don’t even mention that there are different sort types or that the sort module lets you control which one you want to use. But, as someone on the path to mastery, you need to think deeply about things that you normally take for granted (and Perl lets us do some much of that). » Read more…
Posted by brian d foy on February 23, 2014
I didn’t mention Sub::Install in the “Dynamic Subroutines” (or maybe the Symbol Table chapter. It was worth a mention (but only that). I show readers how to define subroutines in other packages (or even the current one, I guess) by assigning to a type glob: » Read more…
Posted by brian d foy on February 22, 2014
The Mastering Perl Downloads page now has the named programs I’ve extracted from the book sources. This comprises most of the programs that you can run to do something, rather than all the code segments—many of which are fragments.
I wrote the book as Pod, then converted to DocBook. Despite all the advice we give people about parsing XML properly, I did the thing we tend to tell people not to do: » Read more…
Posted by brian d foy on February 19, 2014
In the “Dynamic Subroutines” chapter, I considered adding the undocumented
__ANON__ trick to give anonymous subroutines names. ysth described this in Permonks in 2003 in Named anonymous subs and later showed up in Perl Hacks #57. Although it’s undocumented, several modules use the trick. » Read more…
Posted by brian d foy on February 2, 2014
Catalin Ciurea (CATALIN on CPAN) sent in some pictures to show what Mastering Perl looks like on a Kindle, although he doesn’t specify which device it is. It’s one of the less sophisticated ones, but I’m surprised that it looks as good as it does. I knew the body text would be find, but it looks like the code comes out nicely too. Curiously, the book is measured in time, and it looks like he’s taking longer and longer to get through it as he progresses! » Read more…
Posted by brian d foy on January 17, 2014
You can read Mastering Perl on your Kindle now. The print edition should be in the warehouses in a couple of weeks.
I don’t have a Kindle so I don’t know how the book looks in it. I don’t have much hope for the older Kindles, but what about the new Fires? Send me a screenshot if you’d like me to see what you see!