in reply to .vimrc for perl programmers
Here's a small trick to deobfuscate code directly from vim, using B::Deparse. All you have to do is to put this in your vimrc:
Now, whenever you want to deparse a portion of the code, just press _d. For example, this line:" Deparse obfuscated code nnoremap <silent> _d :.!perl -MO=Deparse 2>/dev/null<cr> vnoremap <silent> _d :!perl -MO=Deparse 2>/dev/null<cr>
Magically becomes:--$|&&s|\n|-|;
I find this particularly useful when I have to work with code that abuses Perl's TIMTOWTDIness:s/\n/-/ if --$|;
(Now imagine a three-lines long statement where the attribution comes at the end.) Using B::Deparse, the code becomes more legible:$foo and $bar or $baz = 1;
Unfortunatelly, B::Deparse has it own limitations; but I think this technique can be really useful in some situations.$baz = 1 unless $foo and $bar;
In Section
Meditations