April 2012 Archives

Perlbuzz news roundup for 2012-04-30

| No Comments

These links are collected from the Perlbuzz Twitter feed. If you have suggestions for news bits, please mail me at andy@perlbuzz.com.

  • In case you have a burning need to use ಠ_ಠ for warnings/errors: (metacpan.org)
  • Expanded the "More Tools" page of the ack website: (betterthangrep.com) Help your users by including alternatives for them to choose from!
  • YAPC::NA is NOT sold out. Still 30 tickets left. Sign up now! (blog.yapcna.org)
  • Before you send a patch, send an email (petdance.com)
  • For want of a newline (blogs.perl.org)
  • Use the command "perldoc -q whatever" to search the Perl FAQ for "whatever"
  • Perl 5.16.0 is coming soon, probably early May (rjbs.manxome.org)
  • Regexp::Common has regexes for just about everything. Check there first. (search.cpan.org)
  • Is Try::Tiny still the best choice for exception handling? (stackoverflow.com)
  • Using named regexes in ack output (stackoverflow.com)
  • Automating gov't websites w/WWW::Mechanize + HTML::DOM (blogs.perl.org)
  • Using Moose's "lazy" attribute for caching (blogs.perl.org)

Before you write a patch, write an email

| 3 Comments

(Originally posted to my non-Perl blog)

I often get surprise patches in my projects from people I’ve never heard from. I’m not talking about things like fixing typos, or fixing a bug in the bug tracker. I’m talking about new features, handed over fully-formed. Unfortunately, it’s sometimes the case that the patch doesn’t fit the project, or where the project is going. I feel bad turning down these changes, but it’s what I have to do.

Sometimes it feels like they’re trying to do their best to make the patch a surprise, sort of like working hard to buy your mom an awesome birthday present without her knowing about it. But in the case of contributing to a project, surprise isn’t a good thing. Talking to the project first doesn’t take away from the value of what you’re trying to do. This talking up front may even turn up a better way to do what you want.

There’s nothing wrong with collaborating with others to plan work to be done. In our day-to-day jobs, when management, clients and users push us to start construction of a project before requirements are complete, it’s called WISCY, or Why Isn’t Someone Coding Yet? As programmers, it’s our job to push back against this tendency to avoid wasted work. Sometimes this means pushing back against users, and sometimes it means pushing back against ourselves.

I’m not suggesting that would-be contributors go through some sort of annoying process, filling out online forms to justify their wants. I’m just talking about a simple email. I know that we want to get to the fun part of coding, but it makes sense to spend a few minutes to drop a quick note: “Hey, I love project Foo, and I was thinking about adding a switch to do X.” You’re sure to get back a “Sounds great! Love to have it!” or a “No, thanks, we’ve thought about that and decided not to do that”. Maybe you’ll find that what you’re suggesting is already done and ready for the next release. Or maybe you’ll get no reply to your email at all, which tells you your work will probably be ignored anyway.

I’m not suggesting that you shouldn’t modify code for your own purposes. That’s part of the beauty of using open source. If you need to add a feature for yourself, go ahead. But if your goal is to contribute to the project as well as scratching your own itch, it only makes sense to start with communication.

Communication starts with understanding how the project works. The docs probably include something about the development process the project uses. While you’re at it, join the project’s mailing list and read the last few dozen messages in the archive. I can’t tell you how many times I’ve answered a question or patch from someone when I’ve said the same thing to someone else a week earlier.

Next time you have an idea to contribute a change to an open source project, let someone know what you’re thinking first. Find out if your patch is something the project wants. Find out what the preferred process for submitting changes is. Save yourself from wasted time.

We want your collaboration! We want you your help! Just talk to us first.

Perlbuzz news roundup for 2012-04-23

| No Comments

These links are collected from the Perlbuzz Twitter feed. If you have suggestions for news bits, please mail me at andy@perlbuzz.com.

Perlbuzz news roundup for 2012-04-16

| No Comments

These links are collected from the Perlbuzz Twitter feed. If you have suggestions for news bits, please mail me at andy@perlbuzz.com.

  • K=R=P (Kindness = Repeat business = Profit) says @tom_peters. I say that for open source, K=U=G+S, Kindness = Users = Growth+Success.
  • You probably don't want to be using use_ok() (modernperlbooks.com)
  • Interpolate, concatenate or join? (perlmonks.org)
  • Quick-n-dirty tool to send messages to HipChat (blogs.perl.org)
  • Painless RSS processing with Mojo (blogs.perl.org)
  • RT @chromatic_x If you use SQLite for your CPAN distribution's tests, consider an in-memory database. Helps parallelism/Reduces disk IO.
  • Explaining web programming via Plack (blogs.perl.org)
  • Common Perl pitfalls (perlmonks.org)
  • Test::WWW::Mechanize adds scraping functions (perlbuzz.com)

Test::WWW::Mechanize adds scraping functions

| No Comments

The new 1.40 release of Test::WWW::Mechanize adds functions to help scrape text from your HTML as you test it. This should make things much easier for your integration test of your web apps.

For example, if you want to make sure that this shows up:

<h1>My awesome page!</h1>

then you can add an id attribute to the <h1>

<h1 id="pagetitle">My awesome page!</h1>

and your test can check for it:

$mech->scraped_id_is( 'pagetitle', 'My Awesome Page!' );

Two other functions are added to help in your text extraction: ->scrape_text_by_id() and ->scrape_text_by_attr().

Will these functions help your testing? Do you have other methods that you use to aid testing? As always, I welcome your feedback.

Perlbuzz news roundup for 2012-04-09

| No Comments

These links are collected from the Perlbuzz Twitter feed. If you have suggestions for news bits, please mail me at andy@perlbuzz.com.

  • The Perl Unicode cookbook (perl.com)
  • bdfoy's got some ideas for code (blogs.perl.org)
  • How @rjbs spent his Perl QA Hackathon (rjbs.manxome.org)
  • The homepage for ack is completely redesigned. Hooray for open source, making up for my lack of design skillz. (betterthangrep.com)
  • Tricks to compiling mod_perl 2 to OS X Lion (blogs.perl.org)
  • Have you seen perl-reversion? (blogs.perl.org)
  • Using WWW::Mechanize and mech-dump to get my scratchy 45s (perlbuzz.com)
  • DBD::Firebird releases v1.0 (firebirdnews.org)
  • Recap of the Perl QA Hackathon (dagolden.com)
  • Reading about what people are working on = happy. (blogs.perl.org)
  • Whatever task you have, it's probably already on CPAN (blogs.perl.org)
  • The Perl Foundation wants to give you money to work on Perl (news.perlfoundation.org)
  • More niche modules, "incredibly useful for about 5 people on earth": (github.com)
  • Did you know prove has --shuffle to run tests in random order? Has randomizing tests uncovered bugs for you?
  • MetaCPAN has a new logo (perlnews.org)
  • RT @dukeleto This is a huge step forward in #perl dependency management: "carton bundle" support! (github.com)
  • RT @aaronlerch Some devs think "I'll just copy and paste this code block." Now you have two problems. Now you have two problems.
  • Would love to see this Perl::Critic talk (blogs.perl.org)
  • "The Python site talks about the value the reader gets out of Python, while the Perl site talks about Perl" (modernperlbooks.com)
  • How to get ahead in open source: Wear sunscreen. (blog.nerdchic.net)
  • Help Open Source Bridge select session proposals (plus.google.com)
  • MetaCPAN at the QA hackathon (blogs.perl.org)
  • Perl Foundation helps fund critical Perl 5 dev (news.perlfoundation.org)

Using WWW::Mechanize to get my scratchy 45s

| 3 Comments

I'm a big fan of WFMU's Beware of the Blog. So much music geekery and arcana in one handy source!

Sometimes there will be a post with lots of MP3s for download, like this one today with long-forgotten 45s of songs paying tribute to Merle Haggard. I don't want to listen to the mp3s in my browser, and I don't want to manually do the Save As dance in the browser.

Perl and WWW::Mechanize to the rescue! If you have WWW::Mechanize installed, you also have the mech-dump utility. mech-dump started as a tool to make it easier to create WWW::Mechanize programs by showing what form fields exist, but it does more than that. By default, mech-dump will fetch a page and display the forms and fields on the web page. If you call it with --links, you'll only get back the links, like so:

alester:~ $ mech-dump --links http://blog.wfmu.org/freeform/2012/04/a-tribute-to-the-hag-mp3s.html 
http://blog.wfmu.org/freeform/styles.css?v=6

http://static.typepad.com/.shared:v20120403.02-0-g1ba1fe9:typepad:en_us/themes/common/print.css

http://blog.wfmu.org/freeform/2012/04/you-cant-put-your-arm-around-a-memory.html?no_prefetch=1
... etc ...

Filter that output through grep and pass it to xargs and wget, and you've got a handy MP3-only downloader.

alester:~ $ mech-dump --links [big URL] | grep mp3$ | xargs wget

--2012-04-04 09:27:32--  http://blogfiles.wfmu.org/GG/Skeeter_Harmon_-_A_Tribute_To_The_Hag.mp3

100%[=======================================================>] 4,935,323   4.08M/s   in 1.2s

... etc ...

I suspect very few Mech users are aware of mech-dump, and how handy it can be from the command line. I wish I'd done a better job of publicizing it.

Perlbuzz news roundup for 2012-04-02

| No Comments

These links are collected from the Perlbuzz Twitter feed. If you have suggestions for news bits, please mail me at andy@perlbuzz.com.

  • "The measure of a civilization is how it treats its weakest members." So too it is with how an open source project treats its newbies.
  • A recap of the Israeli Perl Workshop 2012 (blogs.perl.org)
  • Who is a contributor to Perl? (perlmonks.org)
  • RT @OvidPerl Perl version 5.15.9 has 521,047 tests all of which just passed. #software #testing #tdd #perl
  • Perl-based search engine DuckDuckGo is taking off: (duckduckgo.com)
  • Discounts on bulk orders of Modern Perl for user groups (modernperlbooks.com)
  • New beta version of HTML::Lint validates HTML entities (perlbuzz.com)
  • The two most premature optimizations: Optimization of non-working code, and of unmeasured code. (perlmonks.org)
  • Devel::Cover reports in vim (blogs.perl.org)
  • Syntax coloring in the debugger (blogs.perl.org)
  • How to install BerkeleyDB (blogs.perl.org)
  • What I learned teaching Perl for advocacy (blogs.perl.org)
« March 2012 | Main Index | Archives | May 2012 »