• DeeKay (unregistered)

    Frist time I see structured Perl

  • Álvaro González (github)

    Something funny about Perl is that I couldn't ever find a script in the wild split in more than one file and I'm sure the language absolutely allowed so. Some scripts were HUGE.

  • (nodebb) in reply to Álvaro González

    as opposed to seeing a script split into exactly one file, which may be oxymoronic. (sorry, couldn't resist. it's time for my medicine.)

  • (nodebb) in reply to DeeKay

    Frist time I see structured Perl

    There are a ton of far better examples of well structured and well formatted Perl code out there. Anyone can also write painfully unreadable code in any other language too.

  • (nodebb) in reply to Álvaro González

    Have a look around metacpan.org and you'll quickly find that a lot of code is in logically separated into reusable classes, in separate modules files.

  • (nodebb) in reply to Álvaro González

    Pffffffft. Where I work, we have an automated test system (it's plenty WTF itself) that has three-quarters of a million lines of Perl across 1654 files.

  • Yazeran (unregistered) in reply to Steve_The_Cynic

    Oh, do tell (or submit a few) :)

  • jonatwabash (unregistered)

    That actually looks like quite nice perl code! We had something similar at <DAYJOB> until just a couple years ago, although it was bigger and split across multiple script files.

    The WTF here is, surprisingly, not the code, but what the code is doing.

  • Duke of New York (unregistered)

    The conspicuous issues I see here are: ragged indentation, intrusive here-documents, and use of the pointless if-not statements (unless). Each is trivial to improve upon. Explicitly putting "m" before match expressions mitigates one of Perl's worst readability problems and always gets a +1 from me. Overall, relatively sane Perl.

    TRWTFs are procrustean tools like Ant and Maven that are flexible in every way except the ones that your build requires.

  • (nodebb) in reply to Yazeran

    It's hard to point out individual illnesses in it, because it's mostly systemic, a system that initially was just cobbled together with a lot of "OK, just kinda sorta make it work", whereupon, over the course of a dozen years or so, it "just growed". That, of course, led to it kinda sorta working. Thanks to the efforts of some of the more recent arrivals in the QA group (over the last six or seven years), people who have taken a more disciplined "I'm a developer of tests" approach (rather than "a tester who programs"), some of it has become progressively better, or at least less awful.

    But it's still in need of more treatment, more "-dependency" option infrastructure, for example, so you can point to that one test there and launch its individual set-up dependencies automatically rather than having to know and/or work out what they are every time you need to run it.

  • Duke of New York (unregistered) in reply to gordonfish

    Yes, but other languages don't make a cultural virtue out of it.

  • (nodebb)

    What a horrid monstrosity (the ListWrapper) ... what happens if you use iterators to delete (or even ListIterators to add?) Or subLists?

    If you're going to wrap collection classes, look at what they're doing in the Collections class (synchronized and unmodifiable collections, e.g.)

    This is not how you do it! SHIVER

  • (nodebb)

    I know a bit of Perl and I still didn't look at that code.

  • (nodebb) in reply to Duke of New York

    Golfing may be a popular thing in Perl, though I have seen worse "professional" and "enterprise" code in other languages that were more difficult to decipher.

Leave a comment on “Classic WTF: An Ant Pushes a Perl”

Log In or post as a guest

Replying to comment #:

« Return to Article