Wednesday, October 31, 2012

Dependency Injection and open-sourcing generic parts of apps

using DI in CPAN libs makes them more universal - but DI even more important is when you want to open-source some generic part of your application. Your boss agrees and then you encounter code like this:
sub frobnicate {
#...
my $dbh = MyApp->dbh;
#...
}
# or
sub frobnicate {
#...
my $some_variable = MyApp::OurConstant;
#...
}
# or
sub frobnicate {
#...
my $sql = MyApp::Common::DBConnect(config => 'master');
#...
}
view raw gistfile1.pl hosted with ❤ by GitHub

Saturday, October 06, 2012

A simple quine

I wrote a quine:
my $x = 'my $x = X;
$y = chr(39) . $x . chr(39);
$x =~ s/X/$y/;
print $x;
';
$y = chr(39) . $x . chr(39);
$x =~ s/X/$y/;
print $x;
view raw quine.pl hosted with ❤ by GitHub