Hacker News new | past | comments | ask | show | jobs | submit login
Higher-Order Perl is available for free as a PDF (plover.com)
115 points by henning on July 12, 2010 | hide | past | favorite | 28 comments



I read this book several years ago when I was still doing a lot of straight-ahead PHP. Was a bit of a mind opener at the time and totally changed my approach and understanding of programming and programming languages. Much of the book is applicable to Javascript, Ruby, and Python. I don't have much use for Perl now, but it's still a great read.


I also read it several years ago too and I frequently pick it up and re-read bits. It's changed my programming style for the better, not just Perl, but related languages. MJD, wherever you are, good work.


Has anyone seen mjd lately? I haven't heard from him and he hasn't updated his blog since January. I'm starting to get worried. (This PDF was put up long before that.)


Sorry you were worried. I lost my job in 09/2009, but got a new one in 12/2009. I am okay, just very busy dealing with having two children instead of one. This is starting to get easier as they get older.

I got out of the habit of blogging while I was unemployed. I hope to get back in the habit again soon, but I don't know when it will happen.

Thanks for being concerned.


hi mjd, i got your book from a used-book bookstore. just wondering if that means that you get any $$ from that, or whether it doesn't benefit you financially?


Presuming you mean this as a genuine question, "no". There is no network that tracks sales of used books, and manages to send royalty payments to the appropriate party. Mark experiences no direct financial benefit when you purchase a used copy from a bookstore. The best possible interpretation would be that he sells more copies new because the existence of a secondary market allows people to buy new copies with greater abandon.

It does sound like an interesting marketing approach though: open a used book store that does make this promise, and without obligation sends $1 per used book to the listed author. Since it's a 'gift', there would be no need to determine legal ownership, assigned rights, etc. I'm not sure that it would confer enough advantage to cover the lost $1 of profit, but I think it would attract a lot of attention and business if you could keep the prices competitive otherwise.


I like this idea :)


Your post suggests a lack of critical thinking on your part.

1. I sell my book to a used book store.

2. You buy the book I sold to the book store.

3. Somehow the author also takes a cut in that sale?


That was my initial thought as well, but reflecting more it's a decent question.

On the surface, would you expect that a network exists for university libraries to pay for articles included in student class packets? Would you expect that the venue is expected to pay when a cover band plays in a bar? That musicians theoretically get paid when their song is played on the radio or streamed on the net?

There's a lot of 'magic' happening, and it wouldn't be that much of a stretch for libraries or used book stores to participate. For all I know, there's even a country somewhere that already does it.


Robertson Davies once discovered that his local library had collected more in fines than he had collected in royalties on one of his books. He started a campaign to pass laws for libraries to pay something back to the authors; I assume it went nowhere.


I have always wondered whether technical books are lucrative for the author. Obviously, a buyer of a book helps the author get a royalty. So that includes library purchases as well... But, if that is the only source of revenue for the author, writing a book would be a thankless task (as far as tech books are concerned, not mega-blockbusters like the DaVinci code that can earn great revenue via book sales and also the movie optioning). So why would a person write a technical book if the financial return is not good?


I've worked for a publisher of technical books and written a small technical book. They are very very rarely lucrative for the author. However, they almost always bring a lot of clout and usually involve learning a subject at a deeper level than you normally would. So, usually it's worthwhile to write at least one if you have the opportunity.

There are a couple of things to keep in mind:

1. Books often challenge an author's discipline and then become extremely painful exercises. With most programming you get regular feedback. Many authors go months without getting any feedback at all. So, be aware, time management is important.

2. In my opinion, longevity of the information you're writing about matters more than anything. The primary benefit of writing a technical book is getting to claim to be an expert for awhile (that and helping people). If you were to write a Javascript book in the O'Reilly cookbook style (how to find the length of an array, etc.) you could expect to be a javascript expert for many years. If you were to write an Android Application Development book, you might only have a year. I published my book (a pocket reference for O'Reilly) in 2003 and landed my biggest client this year because the technical decision maker had a copy on his desk. That's why I'm a believer in evergreen topics.

3. Lucrative means $50-100k. I have a friend who tells a story about how the car he drives came from his first royalty check, $42k. That's a lot, right? Maybe he made $100k on that book for three months of work. But it's not repeatable. The way that it became lucrative for him is that he parlayed that into high dollar consulting and eventually CTO of a well funded database startup. If you're savvy about picking a topic with some interest, you should expect to make $10-20k lifetime. That's less than you'd make in salary.

4. Get co-authors. I think that's the most efficient way to write a book. That way you're not responsible for the entire thing.


I don't get any money, but I'm happy that you bought my book. Thanks very much!


I think he's been busy. Contrary to the other reply, he does have a job. My understanding is that family life has kept him very occupied.


Last I checked, mjd appeared to be out of a job, and was soliciting donations for his (awesome) higher-order perl book. It's a shame he's out of a job, because if mjd cannot get a job, what about the rest of us?


He's working with rjbs over at pobox.com now. I've seen him in #dbix-class swearing at my code a few times.

We tried to get him to YAPC::NA but he has this thing called a family that apparently sometimes intervenes with his ability to gallivant across the country, so I had to get Damian to heckle my "I wanted to be MJD when I grew up" joke instead.


>> I've seen him in #dbix-class swearing at my code a few times.

That sounds about right: http://groups.google.com/group/comp.lang.perl.misc/msg/b2f91...

(Note: I used to have a little program to pick one of these out at random and insert it as a signature for Mutt, but I seem to have lost it. I got some great replies based on some of those.)

Edit - better link - thanks mjd


Getting another job was not actually that difficult, so there is no need to worry on that score.

But if anyone wants to send donations anyway, I will still gratefully accept them.


so is Pobox good work? And how is Perl working for them?


It was really mind-boggling when reading it - but then I did not have much chance to apply the techniques in my work. I've read a lot of positive reviews of this book and how it changed the way people programm - but what was exactly the technique that you picked up from it?

I once copied the crawler using iterators ( http://hop.perl.plover.com/Examples/ALL/ItRobot10.pl ) when we needed a quick script to check our links - and it worked nice for about a 1000 entries and then it suddenly started to be really slow. I tried to find out where that slow down happens and it was after the return statement in traverse - it seems like this code triggers some garbage collector problem. I did not have time to analyze that further - but it happened both in 5.10.1 and 5.12.1.

I've also send a simple bug report to mjd (for the line 'my $html = get($url); - it redeclares $html and so the value becomes invisible from outside of the loop and in particular for the return statement), but I never got any answer from him.


I'm sorry that I didn't get your error report, or that you didn't get my reply to your error report. But I maintain an errata page, and that error has been on it since 2005-05-24. See http://hop.perl.plover.com/errata/errata-p-1.html#p196.


The regex as a value generator in this book is really quite good. I've been dying to see somebody write it up and stick it on CPAN.


Well, go for it then - that'd be awesome! If you tweet @shadowcat_mst when you're ready I'll make sure your PAUSE account gets approved quickly (you're also welcome to bug me about how to build dists etc., I'm always happy to walk people through their first upload).

Note that if you already have an account and uploads, I apologise for not recognising who you are but you're still welcome to bug me if there's anything I can do to help :)


Appreciate the offer. Unfortunately it's item 100 on a to-do list of 100 atm.


It's been a while since I read the book, and I don't remember this use of regexes; but is it by chance covered under Ovid's HOP::Parser module (http://search.cpan.org/~ovid/HOP-Parser), or another in that family (http://search.cpan.org/search?query=HOP)?


I've been looking for such a beast in the wild for quite some time. I've seen a few on CPAN that'll take a regex (or some type of expression, or some limited dialect of regex) and spit out a few random strings. Even Microsoft's REX tool (http://research.microsoft.com/en-us/projects/rex/), which is the best I've seen, gives nondeterministic random results.

Having a tool that would take a PCRE (or some subset of the language), apply some constraints on repetition operators (like *->{0,2}, +->{1,2}) etc., spit out a deterministic list of values (don't care how long so long as it's reasonably finite) would be extremely powerful for software testing. Even the rather limited capabilities in REX have helped me fix some invalid assumptions I was making about valid inputs.

It's always seemed strange to me that regular expressions are described in the literature as string generators, yet I've pretty much only ever seen them used as string acceptors in practice in the form of a predicate (s in set <REGEX>?).


It's section 6.5, "Regex string generation". Page 272: "Given a regex, how can one generate a list of all the strings matched by the regex?"


can't we just let Perl fade gently into that good night? I mean really. Time's up.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: