shift or die

yapb — yet another perl blog

[LOGO] alech's blog. Perl, Security, Curiosities, Links, Rants, Photos, yadayada

Navigation

Home | Articles

Tags

  • 2009challenge
  • 202c
  • angerwhale
  • chaosradio
  • darmstadt
  • deutsch
  • dns
  • dpw9
  • english
  • ffm
  • firefox
  • funny
  • gpw9
  • kite
  • md5
  • mifare
  • mrmcd
  • mrmcd111b
  • muenchen
  • music
  • nexenta
  • openbc
  • openxpki
  • osx
  • perl
  • ph-neutral
  • photos
  • rant
  • security
  • snowboarding
  • spaces
  • unicode
  • vbscript
  • vegetarisch
  • virtuedesktops
  • vorratsdatenspeicherung
  • xing

Login

Not logged in. Log in.

I am so going to hell ...

Tags: english openxpki perl [+]

Posted on 2007-5-12 (土) at 12:05 pm

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{
        OpenXPKI::Debug::debug({
            MESSAGE    => sub { $msg },
            LINE       => \$line,
            SUBROUTINE => \$subroutine,
            LEVEL      => q{$level},
            COLOR      => q{$color}
        });
    };
    if (\$\@) {
        print STDERR 'Invalid DEBUG statement: ' . q{$msg} . ': ' . \$\@ . "\n";
    }
}
XEOF
                    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«.


Last modified: 2007-5-12 (土) at 12:10 pm

Comments on I am so going to hell ... | no comments | Post a comment

[YAML] [XML]


Page generated by Angerwhale version 0.03 (390 ) on 2010-7-31 (土) at 7:02 pm.

Valid XHTML. Valid CSS. Valid SVG. (If you're seeing this, though, you need a better browser so you can actually see them!)