Skip to content

Instantly share code, notes, and snippets.

@memowe
Created May 4, 2011 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save memowe/955067 to your computer and use it in GitHub Desktop.
Save memowe/955067 to your computer and use it in GitHub Desktop.
Local changes to the config data from Mojolicious::Plugin::Config
# 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