Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

Ovid
  (email not shown publicly)
http://publius-ovidius.livejournal.com/
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Tuesday December 05, 2006
11:14 AM

Fun code problem of the day!

[ #31810 ]

No one who works here would ever write such a monstrosity and we're not sure exactly where this code originated, but somehow it wound up on a server and a co-worker asked me to take a look and figure out what was up. I knew things were bad when I saw the beginning of it:

die "\nArguments:\n
-a | -p | -x\t\tServers: all / production / eXclude production
\t\t\tDefault: exclude production
-d<days> [-h<hours>] | -m <month, 1-12>\t\tMANDATORY
-n<num servers | all>\t\t\t\tMANDATORY
[-i<ipaddress>]\t\t\t\t\toptional, specify host
[-s<500|5000>]\t\t\t\t\toptional for HTMLified output.
\t\t\t\t\t\tSize limit in MB.
[-z]\t\t\t\t\t\toptional, HTMLify output
[-t <1-12>]\t\t\t\t\tExclusive option - get totals for month <n>
\t\t\t\t\tUse in conjunction with either -a, -p, -x
\n\n"
  unless (($opt_a || $opt_p || $opt_x || $opt_i)
    &&
    (((($opt_d || $opt_h) && !$opt_m)
                ||
                (!$opt_d && !$opt_h && $opt_m))
    &&
    (($opt_n && !$opt_i) || $opt_i)) || $opt_t);

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • You owe me new eyes!
  • I've not actually run the code, but at first look, it dies with a "usage" message if not an acceptable combination of command line switches, probably originating from Getopt::Std or Getopt::Long, is set.

    die $usage unless some_combination_of_opts_set;
    • found this while googling rentrak... now i'm sick.
      • Given your response to another journal entry, I expect you might be considering a job with them. I used to work for them and I'm quite happy with them. If they offer you a job, jump at the chance. They have great programmers working for them and you'll learn a ton.