CLI magic: mmmmm pizza

273

Author: Joe Barr

Let’s see if I can tempt you laggardly louts out of your GUI nest. How about some pizza? There. I knew that would do it. If anything on earth has the kryptonite-like strength required to melt those GUI shackles, it’s pizza. Domino’s pizza in this case, delivered to your door. So welcome back to the command line interface, and enjoy your stay.

In case you missed it, the Pizza Party project was featured in a Slashdot article last week entitled “Pizza From The Command Line”.

Please note the raison d’être given in the README, “This software is written for people who spend so much time at the command-line that they don’t have time to pick up the phone and call Dominos, or even to go thru the many-step process of using Dominos web interface.”

It’s clear that the project was designed for stone-cold, hard core, living on the edge CLI types, not occasional visitors from the land of bloated clicks-and-more-clicks. Why, part of the target audience is bound to be those nearly divine and mystical techno-dweebs known as “System Admins.” But I look out for you noobies, see. So I got special permission to share this program with you.

Installation

The pizza_party script requires Perl be installed, of course, and also the follow six specific Perl modules:

  • LWP::UserAgent
  • HTTP::Request
  • HTTP::Response
  • HTTP::Cookies
  • URI::Escape
  • Getopt::Mixed

Meeting those those six module dependencies on my system was as easy as installing one additional package: perl-GetOpt-Mixed. Your experience may vary depending on what comes installed as standard on your system. The perl-libwww-perl package, already installed on my system, provides the first four, and the perl-URI package provides URI::Escape.

Once you have all those dependencies met, installation is easy. Just decompress the pizza_package tarball and move the script to a directory in your path. On my system, /usr/local/bin is one possibility. Then move the file in the man subdirectory created when you decompressed the tarball into a man1 directory, like /usr/local/man/man1.

One final hurdle

The last hurdle is one you may not be able to get over: noobie or not. I couldn’t. You need to live or work in an area where a Domino Pizza retail outlet takes online orders. Out here in the barrio south of Austin and west of Uhland, we have no pizza delivery available, from Domino’s or anyone else.

You can find out if you have Domino delivery service available to you by visiting this site and entering your zip code. If you do, the next step is to register for an account. When you have, you’re almost ready to use Pizza Party.

Finally, create a .pizza_partyrc file in your home directory with your username and password obtained from the account creation process in it. Something like this:

user=pizzapartyuser
password=pizzapartypassword

Let’s Eat

There are a few key arguments you should know before ordering your first pizza. For the rest of the options, try “man pizza_party”. Here are the essentials:

  • [-o|–onions]
  • [-g|–green-peppers]
  • [-m|–mushrooms]
  • [-v|–olives]
  • [-t|–tomatoes]
  • [-h|–pineapple]
  • [-x|–extra-cheese]
  • [-d|–cheddar-cheese]
  • [-p|–pepperoni]
  • [-s|–sausage]
  • [-w|–ham]
  • [-b|–bacon]
  • [-e|–ground-beef]
  • [-c|–grilled-chicken]
  • [-z|–anchovies]
  • [-u|–extra-sauce]

So to order a medium sausage with mushrooms, green peppers, and extra cheese pizza on a thin crust you would enter the following at the command line:

pizza_party -smgx 1 medium thin

You're done. Should be there in half an hour. Unless, of course, you're like me and don't live in the promised land.

What's the point?

Isn't it kind of silly to go to all this trouble just to be able to order a pizza, when you can do it from the web or by phone? Well, yes and no. It's true that a single vendor solution such as we have here is limited in scope. And perhaps other food groups should be considered as well as just pizza. But that's not really the point.

The point is that this program - silly or not - was written to save time by using the command line instead of the GUI to accomplish a specific task. As much as some would have you believe otherwise, the GUI is not always the best solution. You might be surprised to learn all the things which are quicker and easier from the CLI. Remember, the GUI is an aid, not an end-all and a be-all. When it makes sense to use the CLI, those who know enough to use it, do use it.

And that's the point.