Slash Boxes
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

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • That is real, actual, in production code?

    I'm sorry you have to deal with it. That looks even worse than the PHP I have to maintain at $work.
    • I swear this is real, actual, in production code. My problem here will be to understand that code, and rewrite it from scratch in standard Perl. The next two months will be fun...

      Close the world. txEn eht nepO
      • Pfoouh. my head still hurts from looking at one line. Must have been some kind of generated code, even writing that would be painful.

        Maybe it's worth to try to write some preprocessor to transform the code into something a bit more decent. Also can Perl::Tidy do something? if not, send to the author some tests ;)

        cheers --stephan p.s seems to me you'll be cleaning "les écuries d'Augias", but don't use brute force ;)
        • I don't think it's generated code. It's just handwritten code with cargo-cult gone wrong and too much copy&paste.

          I've tried Perl::Tidy and PPI, but they're not helpful in such case. I've also looked at how I could preprocess this, but didn't find a way, so I'm doing this by hand. I'll post the result soon for the fun of comparison.

          Close the world. txEn eht nepO
  • I think you can send this to DailyWTF for their “representative line” feature. Just this line would be enough:

    %{${${${$PCSSDUMP{CSSS}}{$css}}{OWNERS}}{$owner}}=%{${${${$CSSDUMP{CSSS}}{$css}} {OWNERS}}{$owner}} if ( eval { $owner =~ /$var/i } );

    As an exercise, consider what it might say about the rest of the system that a mere pattern match is wrapped in an eval.

    • No need to shout too widely about such code. I've heard people already know how bad Perl is ;-)

      All the eval { $value =~ /$var/i } bits are because they use Perl regexps to find elements. Yes, it means $var comes straight from user input, but it's an internal program, not accessible outside our network. I'll just remove these eval and replace them with one $regexp = eval { qr/$var/i } and return early if eval fails.

      Close the world. txEn eht nepO