Thanks Jan, that was the thing that I wanted to achieve. I started with the
*lite* approach and unfortunately now...my app it's no longer a *lite* one
:(
I'll have to migrate a buch of code into a full Mojo app, but I think that
it worth the effort. Thanks a lot for your suggestion!
On Friday, October 2, 2015 at 9:21:48 AM UTC-3, Jan Henning Thorsen wrote:
>
> In this case, I don't think I would go for a lite app, but rather create
> controller classes and a full app. You can then do things like:
>
> package MyApp::Controller::User;
> use Mojo::Base "Mojolicious::Controller";
> sub some_action {
> my $c = shift;
> $c->render(text => "both apps");
> }
>
> package MyBackOfficeApp::Controller::User;
> use Mojo::Base "MyApp::Controller::User";
> sub more_stuff {
> my $c = shift;
> $c->render(text => "just in this app");
> }
>
> That way, you have isolated the code, which means that it is impossible to
> access "more_stuff()" from the MyApp.
>
>
> On Thursday, October 1, 2015 at 2:23:02 PM UTC+2, Pablo IaCo wrote:
>>
>> Thanks Richard, that was something that I started to work later after
>> creating this post in order to gain some time. I've started to create my
>> modules as usual and include them...but I was unaware of mojos plugins.
>> That's a reflection of how much I've researched the site, that's something
>> that I need to improve.
>>
>> Much appreciated your response!
>>
>>
>> On Thursday, October 1, 2015 at 9:18:57 AM UTC-3, Richard Sugg wrote:
>>>
>>> Mojolicious lets you write plugins for sharing code across controllers,
>>> or in the case of a mojo lite app, callbacks.
>>>
>>> Another solution is to just write plain old perl modules and include
>>> them. This is the approach I have taken -- sometimes I write functionality
>>> in Mojolicious plugins, then realize I need it in something unrelated, so I
>>> end up refactoring to a standard perl module, and include it in my
>>> mojolicious app. In general, I try to make my controllers extremely lite --
>>> check the input parameters, call out to a mojo plugin or perl module to
>>> accomplish what is asked, and in the controller, return an appropriate
>>> response.
>>>
>>> On Wednesday, September 30, 2015 at 5:05:22 PM UTC-4, Pablo IaCo wrote:
>>>>
>>>> Hi Folks,
>>>>
>>>> I just wanted to share with you something that I'm trying to figure out.
>>>>
>>>> I'm currently building a small App for my own and it's build like
>>>> follows
>>>> 1) The App itself (with login and stuff)
>>>> 2) A Back-Office (with login and more stuff and creation of information
>>>> for the main app)
>>>>
>>>> The question that I want to ask is, that currently I've started to
>>>> build the main application.pl file, with Mojolicious::Lite, with most
>>>> of the routes and stuff inside of it.
>>>>
>>>> But my question is, how should I approach to develop the back office? I
>>>> mean, shall I write the whole thing INSIDE the main application.pl or
>>>> is it better to create a sepparated application just to handle the back
>>>> office.
>>>>
>>>> My concern with the second approach is, how to handle those packages
>>>> that are common to each part?
>>>>
>>>> Thanks in advance and I'm just doing my first steps into a bigger
>>>> mojolicious app, so that's why I created this post
>>>> Regards
>>>> Pablo
>>>>
>>>
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.