Created
May 4, 2011 10:52
-
-
Save memowe/955067 to your computer and use it in GitHub Desktop.
Local changes to the config data from Mojolicious::Plugin::Config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# symbol table voodoo to add the TestPlugin configuration. OMFG. | |
{ | |
no strict 'refs'; | |
no warnings 'redefine'; | |
# parse method backup | |
my $parse = *Mojolicious::Plugin::Config::parse{CODE}; | |
# redefine configuration file parse method | |
*{'Mojolicious::Plugin::Config::parse'} = sub { | |
# parse with the original parse method | |
my $config = $parse->(@_); | |
# add/change configuration | |
$config->{plugins} = {test_plugin => {foo => 42}}; | |
$config->{articles_dir} = "$Bin/articles"; | |
$config->{pages_dir} = "$Bin/pages"; | |
# return updated configuration | |
return $config; | |
}; | |
} # end of symbol table voodoo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment