Python's decorators in Perl

Python's decorator is some syntax sugar for wrapping functions by another functions:

def bold(func):
    def wrapper(str):
        return '<b>' + func(str) + '</b>'
    return wrapper

def div_id(id):
def decorator(func):
def wrapper(str):
return (('<div id="%s">' % id) + func(str) + '</div>')
return wrapper
return decorator

@div_id("testid")
@bold
def p(str):
return '<p>' + str + '</p>'

print p("test")

I hate Dist::Zilla and missing Makefile.PL

It is f* annoying to clone the repository with only dist.ini and missing Makefile.PL or Build.PL.

It is more annoying to run dzil build and see

Required plugin bundle [@YETANOTHER] isn't installed.

I don’t want to install 300 more packages only because I need this only one small module which I cloned from git repository. I can’t install 300 more packages for Dzil because I do it on Android where there is no Dzill because I need to fix some modules which I can’t fix because of missing Dzil. Damn it.

Dist::Zilla: real Catch-22

Fortunately usually I can prepare tiny stub with Makefile.PL:


# Very simple stub because of damn Dist::Zilla
use ExtUtils::MakeMaker;
WriteMakefile( 'PL_FILES' => {}, 'VERSION' => '0.01', 'EXE_FILES' => [] );

Stupid? If it’s stupid and it works, it’s not stupid. ExtUtils::MakeMaker beats Dist::Zilla.

Plack server with threads

There was no non-single threaded Plack server for Windows. It is because current implementations use preforking which is completly broken on this system. But wait, Perl already has threads which works better on Windows.

So I wrote Thrall: multithreaded Plack server for Windows. To be strict - it is hacked Starlet server with preforking removed, so now works with Perl on Windows correctly.

Threads on Perl?

Well, I've noticed that threads are really stable and useful and its API is…