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

No comments: