More WordPress grepping

I got quite a bit off my blogging to-do list once I created WordPress::Grep to crawl through my WordPress database. With that stuff done, I had time to expand the module to get even more done.

I added stuff to search categories and tags, which are mixed together in this odd notion of WordPress "relationships". One of my issues has been the evolving set of categories. I create a new category realizing that I'm writing stuff that I want to group, but I don't go back to add the new category to old posts. Or, I need to do something to every post in a particular category (say, change links to use MetaCPAN). Or, all sorts of things.

After that, I had fun thinking about how I should report the results. I've been interested in Bart Lateur's String::Sprintf, so I could define my own handlers for the field specifiers:

 % wpgrep ... --template '%i %t'

I know I have a good tool when not only to I clear off my to do list, but I start doing work I never thought possible or tractable.

Now I'm considering how I would pipe matching records to the next thing in the chain. For instance, I want to make a link checker. I could go several ways here. I could have wpgrep output the IDs of posts that the next tool can use. I could have wpgrep output the content of all posts, separate the rows with something like a form feed or null byte, then have the next tool read that per row with the right record separator. I could also do it in wpgrep as I discover rows by allowing for a callback, which I haven't fully implemented.

Leave a comment

About brian d foy

user-pic I'm the author of Mastering Perl, and the co-author of Learning Perl (6th Edition), Intermediate Perl, Programming Perl (4th Edition) and Effective Perl Programming (2nd Edition).