So it turns out I'm not really good at this blogging thing. It's not that I feel I have nothing worth writing about, but that my time is usually better spent on other things. Instead of pretending to myself that I will eventually write long rants (and then effectively writing nothing), I'll try to post occasional bits of code that I found useful and not particularly obvious. I've been writing a lot of XS lately and the somewhat incomplete or at least inaccessible XS / perl API documentation could do with a little more cookbook style. Furthermore, when writing C/XS code that uses the perl API, I find myself trying to do the same things that are trivial in Perl and taking much, much longer to actually succeed. Thus, I'll start out with a bit of perl API.
Today's Not-So-Frequently-Encountered-XS-Problem: Which class is this object blessed into?
Jesse Vincent uploaded the perl-5.12.0-RC3 release to the CPAN. It's important that that this release is tested to flag any potential release blockers. If none are found it'll be released as 5.12 on April 9.
Here's how you can do that:
All tests should have been successful. To install it (without touching your existing perl!) do:
Now you have an installed perl-5.12.0-RC3 in ~/perl5-rc3/installed/bin/perl. Now just configure CPAN to install modules without nagging:
And then maybe try installing your favorite CPAN modules, or bundles that suck down a lot of them (using sudo here because my ~/.cpan is owned by root):
Of course the most useful think you can do is test it on your own in-house code. All the code on the CPAN has probably been tested with 5.12 already.
Testing is, in some sense, a mess. Part of the problem is similar to the dynamic/static schism: nobody seems to agree on what those terms mean. Case in point: what's "integration testing"? Here's the definition from the excellent Code Complete 2:
Integration testing is the combined execution of two or more classes, packages, components, or subsystems that have been created by multiple programmers or programming teams. This kind of testing typically starts as soon as there are two classes to test and continues until the entire system is complete.
A Stackoverflow answer that encourages the questioner to use Moose has a long code example because it has a lot of code and formatting since there is a lot of repeated typing:
As the second talk in a series of talks on form handling, Bryan Beeley will be presenting a talk on the HTML::FormHandler, a Moose based form rendering and validation framework, on April 27th, 2010 at Six Apart World Headquarters.
HTML::FormHandler is an object oriented framework for form-specific data model, HTML rendering and data validation code. Simple forms can be rendered, parameters can be parsed, data can be validated, and validated data can be submitted to your database with a minimal amount of code using built-in input field types. Leveraging the power of Moose, HTML::FormHandler allows more complicated forms to override some or all of the built-in functionality while maintaining a common interface.
This meeting will take place on Tuesday, April 27rd at 7pm at Six Apart World Headquarters.
Enlightened perl programmers often complain about how outdated most online perl manuals. Truth is, some of the official documentation is quite outdated too. Perl ships with a lot of documentation, some of it is old and badly needing some maintenance.
For example, a quick ack through the documentation showed about 250 cases of open used with a glob as its first argument (e.g. open FOO;), even one in perlstyle! I think everyone agrees that in 2010 that's no longer a good example. I don't think it has a place outside of perlfunc and perlopentut. The same argument goes for two argument open and use vars. I'm sure there are plenty of other issues that I can't think of right now.
That's not hard to fix, in fact you could almost write a program for it. It may be a lot of work though to fix all of them, but not so much to fix them one by one.
CPAN is a very good system to distribute libraries we call packages or modules. What about applications? There is a section on CPAN that was supposed to distribute scripts but it never took off. Is CPAN ready to be used to distribute applications? If not, what is missing?
Padre
For
Padre
, which is a
desktop application
, we
use CPAN
as our primary way of distributing the source code. You can install it by just typing
cpan Padre
That's OK, but we also know that in order to provide a better user experience and to have better control on what is used in the application we need to distribute a packaged version of it, batteries inside, in binary format. That's why we have the various stand-alone versions of Padre, that's why we ask the downstream Linux/BSD distributions to include it and that's why Padre is going to be part of
Strawberry Perl Professional for Windows
system seems like such a simple thing to use. You tell it which command to run, and it runs it. When it's done, you continue with your program, or so you think. I recently ran into a problem with this. I was creating a lot of zombies, but Dread Pirate Fenwick to the rescue (and this is not his first time to rescue me).
As part of my DPAN work, I'm indexing every distribution in BackPAN. I collect loads of data on every distribution so I can make a searchable catalog of it. When you want to use DPAN to create private CPAN repositories, you shouldn't have to re-index distributions where we already know the answer. I can provide most of the answers pre-cataloged so you focus on only the novel distributions in your repository. I have a tarball of sample results for 16,000 distributions.
Adam Kennedy has declared a contest between Dancer and Mojolicious. Seems to me like a great idea. We'll both get a chance to learn from each other, show our strengths and try to work on our exposed weaknesses.
One major issue about Mojolicious is that they decided to do everything in core (at least from perl 5.10.1), without any additional dependencies that aren't in Perl core (while, we at Dancer, try to keep the dependencies to a minimum). This has many disadvantages (reinventing the wheel, handling the same issues over and over, needing a lot of knowledge on how to implement everything) and a lot of advantages (easier deployment, easier packaging for vendors, more control). This post is about one of those advantages.
I've always liked Prolog as a programming language. Something about the way the language works (like the built-in backtracking) appeals to my nature, much like Perl's proclivity for linguistic floridity. Thus, I've decided to try my hand at writing a Prolog compiler for the Parrot VM.
To try to suppress my natural tendency to move from subject to subject (being a fox and not a hedgehog) I'm going to keep a development diary here. Also, I've found that the documentation on implementing HLLs with Parrot is either thin on the ground or a bit dated. So hopefully some of my scribblings turn out to be useful to someone else.
I upset a lot of people with my Perl 5 is Dying post. In fact, that is far and away one of the most heavily cited posts I have. I made people mad at me. I made a lot of people talk. While I'm sorry I made people mad (and I've had some blunt comments directed at me in pubs as a result), I'm very proud of that post. It got a lot of people arguing and thinking and I like to believe it spurred a few people (well, me at least) to do something about it. Here are just a few things which have been happening to turn things around (I am not taking credit for this. Many of these things would have happened any way and I was simply one of many people pointing out the problem).
I just saw this posting about the best Perl development firm. There is an entry on Online PR news and some kind of a listing on the website of "Best Web Design Agencies".
Does anyone know any of these companies or is this just pure SEO and I just gave them more ranking?
If this patch gets applied doing killall onion on 5.14 will get you a dead process instead of onion: no process found, the same goes for ps(1) and top(1) which read the legacy process name by default. Before this patch the behavior of $0 assignment on Linux hadn't changed since perl 4.000 came out.
It appears that there was a touch of confusion and I have been accepted as a speaker at OSCON. I'll be giving the roles talk, but with some adjustments for bits that were a touch confusing. No matter how perfect the example is, using the B:: hierarchy to show multiple inheritance problems just distracts. Not only will this allow me to focus on easier examples, it will also leave more time for questions.
I used to encourage people to help CPAN Increase its Schwartz by making the ratio of the byte size of just the latest versions to all versions as high as possible. It's time to increase the schwartz again. Think of it as Spring cleaning (Autumn for you southern folks) for your CPAN directory.
Many people are arguing on the CPAN workers mailing list about who's opinion about rsyncing mirrors is the most worthy. While they huff and puff, you can help with just a couple minutes of your time.
Infinoid's svn-bisect, now at 1.0, provides a 'run' option, just like git bisect. This is the only feature I had that he did not, and he provides many more, including a nicer API (based on git's), and smarter binary search (only searching those revisions involved in the folder you're working in.)
If you're using subversion, I highly recommend giving his tool a try.
DynaLoader is a portable high-level interface around you OS's dynamic library loading. It's the code that's loading your XS modules. It's actually doing a pretty good job at that. You may wonder then why I consider its use harmful.
If all you want to do is load the XS part of your module, it's the wrong tool for the job. Most of all because it has a truly awful interface. It requires you to inherit your module from it. It's common knowledge that public inheritance from an implementation detail is a really bad idea. It breaks not only encapsulation rather badly, but also violates separation of concerns.
This would be as bad as it is if DynaLoader didn't use AutoLoader. Because of this, when you call some undefined method on an instance of a class that derives from DynaLoader you don't get this error:
Can't locate object method "undefined_method" via package "Foo"
Today having Internet access has become more of a necessity than a luxe. Internet is so common nowadays that we all have it at home and use it with all computers and even our home appliances: tv, mp3 players, tablets and game consoles. It's no sercert that Internet is everywhere and is here to stay
I remember when I had my first Internet connection at home that it was meant to be used for a single computer in the house. Using a router was not allowed by my ISP. Today not only is it allowed but most ISP even provide a modem/router with WIFI to all their clients!