Rose and Mojolicious run-time information

24 views
Skip to first unread message

henq

unread,
Apr 27, 2016, 3:27:08 PM4/27/16
to Rose::DB::Object

Hello, I try to use Rose::db::object in a Mojolicious app.  Rose is just functioning fine, but I’d like to integrate it more with Mojo, but don’t know how. 
Rose does not know about all the initialisations and setup that happened runtime in Mojo.  I ran into this as I wanted to use the Mojo::Plugin::Config  from Mojo. This plugin works automagically (the plugin finds the default config file from within the Mojo app, no path setup) , but not so in Rose classes. 

I know we separate the concerns in MVC fashion, but some things I like to share between the C end the M , like are we running development, staging or deployment. So I like to get some runtime info into Rose. The fundamental question then becomes: does Rose pull the info in or do we push the info from Mojo into Rose?

Now I tried several approaches
- use %ENV as a global variable
- use an our var as a global variable
- Make the Rose::DB::Object factory an object instead of a class, and call ->new() on that object (instead of a class method)
- pass runtime info at each object creation 
   my $car = MyApp::Model::Car->new($mojo_app);    #not DRY ;-(

I could not find a satisfactory way to couple the Rose world with the Mojo/app/controller world.

I am not very confident with perl’s scoping/namespacing mechanisms, so maybe there’s just an easy solution I don’t see.

Anyways, I’d like to hear any suggestion to merge the Mojo runtime environment with the Rose class hierarchy.
Kind regards,
~Henq


Reply all
Reply to author
Forward
0 new messages