Common config for Mojo and nonmojo app

86 views
Skip to first unread message

Ivan Korjavin

unread,
Sep 16, 2013, 2:51:51 AM9/16/13
to mojol...@googlegroups.com
I using config plugin for mojo app

my $config = $self->plugin('Config', {file => 'App.conf'});

and it works fine.

But also I have a lot of small scripts which works wits same data.
Is there any simple way to load config in plain-perl-script ?

Sergey Dmitriev

unread,
Sep 16, 2013, 3:10:31 AM9/16/13
to mojol...@googlegroups.com

If your config is perl hash, just require/eval it. For other means there is Config::Any.

16.09.2013 10:51 пользователь "Ivan Korjavin" <korj...@gmail.com> написал:
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious...@googlegroups.com.
To post to this group, send email to mojol...@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/groups/opt_out.

Ivan Korjavin

unread,
Sep 16, 2013, 3:21:15 AM9/16/13
to mojol...@googlegroups.com
Yes, perl hash.
And I see that all code about load and eval aready exists in Mojolicious/Plugin/Config.pm
Also there error handling and other 

My questions was: how to don't reinvent the wheel and reuse this module in plain-perl-script?



2013/9/16 Sergey Dmitriev <sergey.p...@gmail.com>

--
You received this message because you are subscribed to a topic in the Google Groups "Mojolicious" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mojolicious/SGrNLvrJ_Vw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mojolicious...@googlegroups.com.

Gabriel Vieira

unread,
Sep 16, 2013, 9:58:28 AM9/16/13
to mojol...@googlegroups.com
In some scripts, what I do is load Mojolicious::Lite and
Mojolicious::Plugin::Config...
Gabriel Vieira

Sebastian Riedel

unread,
Sep 16, 2013, 9:59:06 AM9/16/13
to mojol...@googlegroups.com
> My questions was: how to don't reinvent the wheel and reuse this module in plain-perl-script?

http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Application_embedding

--
Sebastian Riedel
http://github.com/kraih
http://twitter.com/kraih
http://mojolicio.us

Ivan Korjavin

unread,
Sep 16, 2013, 11:07:23 AM9/16/13
to mojol...@googlegroups.com
Yes! It works! Thank you!

But another question how "hard" is it for my script? 
Is it overhead a lot of resources?


2013/9/16 Sebastian Riedel <kra...@googlemail.com>
Reply all
Reply to author
Forward
0 new messages