shift or die

security. photography. foobar.

I am so going to hell ...

I am so going to hell ... for this code snippet I wrote last week for the OpenXPKI debugging code:

package OpenXPKI::Debug;

use Filter::Util::Call;

sub filter {
    # [...]
                    $_ = << "XEOF";
    my \$subroutine = (caller(0))[3];
    my \$line       = __LINE__;
    eval q{
            MESSAGE    => sub { $msg },
            LINE       => \$line,
            SUBROUTINE => \$subroutine,
            LEVEL      => q{$level},
            COLOR      => q{$color}
    if (\$\@) {
        print STDERR 'Invalid DEBUG statement: ' . q{$msg} . ': ' . \$\@ . "\n";
                    s/\n/ /g;
                    $_ .= "\n";
    # [...]

Not that source filters as such were not evil enough, we wanted to ensure that they don't do any more damage if someone makes syntax errors in his debug comments. This is what resulted after about an afternoon of »My brain hurts!«. If you can understand how it works and why we did it in exactly this way, you have my respect and may call yourself a real perl hacker. If you don't, you might be interested in reading the version with the 20-odd line comment startwing with »HERE BE DRAGONS«.