Created
June 6, 2016 21:02
-
-
Save brianmed/358911826baa2451ec84a4991a05a84a to your computer and use it in GitHub Desktop.
Mojolicious plugin with shared data structure
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
#!/usr/bin/env perl | |
package Blah; | |
our $domain = { | |
template => "Joy", | |
}; | |
package main; | |
use Mojolicious::Lite; | |
plugin Config => { file => "hostA" }; | |
get '/' => sub { | |
my $c = shift; | |
$c->render(text => $c->app->config->{text}); | |
}; | |
app->start; |
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
{ | |
text => $Blah::domain->{template} . " yellow", | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment