The web in a box - a next generation web framework for the Perl programming language

IRC log for #mojo, 2015-07-23

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:00 jontaylor joined #mojo
00:21 disputin joined #mojo
00:25 disputin joined #mojo
00:28 disputin joined #mojo
00:38 mattastrophe joined #mojo
00:52 Averna joined #mojo
00:59 kaare joined #mojo
01:53 davido__ joined #mojo
01:55 Skylos_ joined #mojo
01:55 Skylos_ I am lost in a maze of twisty little mojolicious guides, all different.
01:55 Skylos_ I need to provide some context to a mojolicious::lite app that I wrote, from another application that already is loaded and has an object ready for it to use.
01:56 Skylos_ there's something about a config you can set.
01:56 Skylos_ but its unclear how it work.
02:00 genio Skylos_: forgive me, but I'm not quite understanding what your question is.  Are you asking how to create and make use of a config file?
02:01 noganex_ joined #mojo
02:01 genio I feel like it's either that or how to make a plugin, but I'm not certain.
02:05 Skylos_ not quite
02:05 Skylos_ lets say I am using Mojo::Serve rand I"m loading the app
02:05 Skylos_ I want to hand some configuration information to the app after I load it, before I start it.
02:06 bpmedley Skylos_: http://mojolicio.us/perldoc/Mojolicious/Plugin/Config <-- Something like this?
02:06 Skylos_ this is the stuff that drives me crazy about the docs.  The example refers to '$app' without showing where it comes from.
02:07 bpmedley Skylos_: Are you using Mojolicious::Lite or a full app?
02:07 Skylos_ Its ... loading from a file that is a perl hash?
02:07 Skylos_ bpmedley - Lite.
02:07 bpmedley Moment
02:07 Skylos_ no, I have an app running with live complex moose objects that my app needs to use to retrieve its information.
02:09 Skylos_ I used app twice there to refer to two different things.  :[
02:09 mst Skylos_: $controller->app works, no?
02:09 Skylos_ mst - ... $controller?  I get that in my handlers, yes, when I have a controller context to reference?
02:09 Skylos_ (I'm sure there's something fundamental I'm missing about mojolicious and controllers here)
02:10 mst routes are method calls on the controller
02:11 Skylos_ in my lite app a route is just 'get' as a subroutine call into the namespace
02:11 Skylos_ get '/:domain/:name/:version/:window/:key' => {
02:11 Skylos_ like so
02:11 mst which calls ->get on the route object for the implicit app object
02:11 bpmedley https://bitbucket.org/snippets/bpmedley/7R887 <-- Skylos_, does this help?
02:11 mst yeah, well, if you're using the version that means you can't see the architecture
02:11 mst you can't see the architecture
02:12 mst maybe the Growing guide would help?
02:12 Skylos_ I should understand this architecture. Is there a perspective that makes the architecture more obvious?
02:12 mst maybe the Growing guide would help <-- read that?
02:12 Skylos_ I've read it a couple times and partially again this evening.  Growin gconfuses me.  This is a simple app, it doesn't have much of anything but two methods that translate to my application methods.
02:12 bpmedley Skylos_: In your Lite app, where do you use app and where do you use a controller object?
02:13 Skylos_ It talks about all these directories and stuff and i know that's not relevant to my task here.
02:13 Skylos_ pbmedley - app->stash to set up the default stash stuff, and app->start.
02:13 Skylos_ bpmedley - the controller is the first parameter to the callback subroutine get .... => sub { my $c = shift
02:14 bpmedley Skylos_: Ok, so the app object is imported from the Lite.pm and a controller is used in your routes.  That will take you a long way.
02:14 disputin joined #mojo
02:14 bpmedley Did my example help with the config file?
02:15 Skylos_ bpmedley - okay, I think, I'm not sure what do do with the app import information
02:16 Skylos_ bpmedley as for the clip, not really, no.  the problem being Config appears, in this context, to be... where is joy defined?
02:16 bpmedley Skylos_: Line 29
02:16 Skylos_ bpmedley - oh, in a conf file.
02:16 Skylos_ bpmedley - so I have a live object, with like a connection to a database already established.
02:16 Skylos_ bpmedley - its not a static bit of config, its actually an object I need to hand to the mojo app.
02:17 bpmedley Wow.  I'm not sure I'd share an object that way.
02:17 bpmedley Are you using DBI?
02:17 Skylos_ bpmedley - I'd like to not have to program this mojo lite implimentation to initialize the whole app, there's a lot of configuration stuff to do.  I'd rather have my big app be able to spin up a daemon when told.
02:18 Skylos_ bpmedley - after two or three layers its.... actually, its using the filesystem in this particular case.  Its modular though, there are api layers between the report retriever and the logic that actually stores it.
02:18 bpmedley What is your big app written in?
02:18 Skylos_ bpmedley - but 'this case' is just 'my test case'
02:18 Skylos_ bpmedley - its a moose app
02:19 bpmedley Is the moose app a CLI program?
02:20 Skylos_ bpmedley - no, its noninteractive.  There's some launcher (that's actually out of scope for hte package of my engines) that loads all the relevant config and launches different parts of the application depending on what worker mode its in.
02:20 Skylos_ bpmedley - its an event based finite state machine report generator.
02:21 Skylos_ bpmedley - this is the fifth distinct worker type I've created.  The first one that provides external services though.
02:23 bpmedley_ joined #mojo
02:23 Skylos_ bpmedley - i've defined a role that specs an interface with 'retrieve' 'current', and 'subkeys' methods it can call.
02:24 Skylos_ bpmedley_ - this is the only interface the mojolite app actually uses.
02:24 Skylos_ bpmedley - so its not like I'm opening a db to direct query paths or anything.  well de-tainted before it gets anywhere that's capable of modifying of accessing anything.
02:25 bpmedley_ Skylos_: So, Moose app is a daemon?
02:25 Skylos_ bpmedley_- Effectively.  it uses EV loop as its main dwell system.
02:25 disputin joined #mojo
02:25 Skylos_ bpmedley - event based and all.  :)
02:26 Skylos_ bpmedley_ - multiple cooperating worker processes are launched, they all work together, each scaled potentially to different group sizes.
02:26 bpmedley_ Interesting.  Hrmm.  So, you want one of your routes to interface with the EV app.
02:27 Skylos_ not exactly.
02:27 Skylos_ there isn't any EV set up on this worker.
02:27 Skylos_ there could be - if I turned open an event queue listen.  And that's probably desirable.  But I'll work around its lack for the moment.
02:28 bpmedley_ I'm not sure I understand the flow of data.
02:28 Skylos_ that's complicated in the whole system.
02:28 Skylos_ But in this case, which is relevant, we have a configured object which is a ReportEngine interface
02:28 bpmedley_ Hrmm, perhaps from the perspective of the route you're creating?
02:28 Skylos_ you can call retrieve current or subkeys on this engine object.
02:29 Skylos_ I want to start up, create my report engine object with relevant configuration, then insert it as a config accessible object in the mojolite app
02:30 Skylos_ The mojo app will do its ->run or ->start as the cas emay be, and do its own event watching for request.s  When a request comes in it will parse out the parameters from the url, create an identity object with which it will call the methods on the report engine to fulfill its requests.
02:31 bpmedley_ Hrmm.  Does your object support a TO_JSON method?
02:31 Skylos_ actually I have it tested working (self initializing) with content handshaking
02:33 Skylos_ http://ubuntu-virtualbox.skylosian.com:3000/replay/reports/yoyo
02:33 Skylos_ Looks like this right now.
02:33 bpmedley_ ERR_NAME_NOT_RESOLVED
02:34 Skylos_ if you go to the very deepest report 00053 and click data, then change your content constraints to json, it'll deliver json
02:34 Skylos_ uh, you need to use Ipv6 to access that server actually
02:35 Skylos_ I hadn't even thought about ipv4 being needed during testing.  :/
02:35 Skylos_ But the configuration is... it was json at one time, yes.  Its stored in Config::Locale somewhere I think in its actual utilization.
02:36 Skylos_ It could be serialized out to json.  But that's kind of an end run.  shouldn't I be able to, like, load the app and set a helper on it?
02:36 bpmedley_ Where would the helper retrieve the object contents?
02:37 Skylos I can load the app without starting it, can't I?
02:37 bpmedley_ I'm confused.  Let me think.
02:38 Skylos I'm thinking like $app = require 'restapp.pl'; app->....($reportengine); app->run
02:40 bpmedley_ How is that better than using JSON?
02:40 Skylos because this is in my general launcher program which has a live $reportengine interface ready to go.
02:41 Skylos This way the app doesn't have to know about the details of constructing big-app objects.
02:41 Skylos reportengine itself requires several OTHER objects, which have a big of a dependency tree before they get back down to pure config.
02:42 bpmedley_ You would need one of these per worker process, correct?
02:42 Skylos Yup.  But the launcher program is run once per process and resolves through the locale/environment and dependency tree already.
02:42 Skylos solved problem.  Don't want to reimpliment it.
02:44 Skylos The matter of multiple/forked listeners on the report retriever... is a scaling issue for later that hopefully won't be too perilous.
02:44 bpmedley_ I see, so perhaps put an "our $obj = require 'restapp.pl';" at the top of your Lite app and try running as daemon and then via hypnotoad?
02:45 Skylos *lookin gup hypnotoad* I've heard of this before.
02:45 bpmedley_ I wonder if someone else has a better approach?
02:46 Skylos $hypnotoad->run('/home/sri/myapp.pl'); <-- this won't return, right?
02:49 Skylos so I'd be like launcher --start-rest , and launcher would be like, ... $bigapp->ReplayREST( reportengine => $re )... and ReplayRest would go ...
02:49 Skylos no, I lost the chain.
02:49 bpmedley_ Skylos: you can just run your app via hypnotoad: "$ hypnotoad config.pl"
02:49 Skylos there doesn't seem to be a slot to insert between the 'read the app from the file' and 'listen for requests'
02:49 Skylos bpmedley - ... it won't know how to initialiize all the objects
02:50 bpmedley_ So, you want to defer listening for requests until some condition is set?
02:51 Skylos bpmedley_ - its fine if its listening as long as I can immediately set context for it to use when answering the requests.
02:51 Skylos bpmedley_ - maybe it cna take it from the angle of... what does hypnotoad expect out of the file you give it?
02:52 bpmedley_ I would need a concrete example at this point.  Can you show a smallish example?
02:52 Skylos bpmedley_ - that it will return a particular value?
02:52 Skylos contemplating how to illustrate.
02:52 bpmedley_ A Lite app can be ran via hypnotoad without any changes.
02:52 Skylos (but if ->run doesn't return, I won't be able to set context)
02:53 bpmedley_ What context do you need to set?
02:53 Skylos the context is my locale-configured report engine object.
02:53 hshong joined #mojo
02:53 bpmedley_ I'd need to see a smallish example.
02:53 Skylos scribbling...
02:58 Skylos still scribbling...
02:58 bpmedley_ No worries
02:59 noganex joined #mojo
03:01 Skylos what was that sharing code thing you used
03:01 bpmedley_ https://bitbucket.org/snippets/new
03:02 bpmedley_ http://pastie.org/  <-- easier
03:02 Skylos dammit
03:02 Skylos why is bigbucket saying something went wrong
03:03 bpmedley_ Hrmm, that sux.  Might try pastie.org?
03:04 Skylos http://pastie.org/10307203
03:04 Skylos This is some similitude of the pattern I'm trying for.
03:05 Skylos the code at the top is the launcher which snarfs the context, which initializes the bigapp which uses that context to load things and build objects, then subsequent things you call with that $ba do more things, in this case, get the RESTApp and run it.
03:06 Skylos naturlaly in the actual launcher that's selected based on command line options from amongst other things.
03:06 bpmedley_ So, what do you need to share with the Lite app?  BigApp::context?
03:07 Skylos $reportEngine actually.
03:07 Skylos you notice line 43
03:07 Skylos I handed reportEngine to the class that presumably initalized the routes and such.
03:07 bpmedley_ Gotcha.
03:08 Skylos But structuring the mojolite app like a moose object is... unobvious.  I'm not sure how to handle that or if using Lite is just way too simplistic for it
03:08 Skylos and I instead need some kind of mild full application handling subscription.
03:08 bpmedley_ Just a sec
03:10 Skylos do I need to do like, a Mojo::Server::Daemon->on
03:10 Skylos because if I did, then it'd be clear enough how to handle it along, it'd just be in scope.
03:11 bpmedley_ Do you ned to read in the reportEngine per request?
03:14 Skylos nope.
03:14 Skylos it persists.
03:14 Skylos makes calls as it needs to to filesystems/whatever backend the module is using.
03:15 bpmedley_ So, why not put the object in an "our $object = ...;" line at the top of the script?
03:16 Skylos how will the mojo app script now what $object is?
03:16 Skylos won't it be unknown identifier out of scope?
03:16 bpmedley_ Lets try it.. one sec.
03:17 Skylos I get this image of if you try to run the REST app not from the launcher getting undeclared variable warnings.
03:17 Skylos or, errors even.
03:18 Skylos oif, its late.  in a couple I got to go to bed.  Have interview in morning.
03:18 bpmedley_ Understood.  Perhaps we can, or someone in the channel, can resume later.
03:19 Skylos thank you so much fo ryour help bpmedley.
03:19 Skylos I'm sure there's a way to do this. just gotta spot it.
03:19 Skylos goodnight1
03:19 Skylos !
03:28 bpmedley joined #mojo
03:30 jontaylor_ joined #mojo
03:43 Vandal joined #mojo
04:27 jberger marcus: give me back my cookies!
04:28 dotandimet joined #mojo
05:11 buu_ joined #mojo
05:13 absolut__ joined #mojo
05:48 buu_ Oh good
05:48 buu Code that was working has stopped working and now I'm confused how it ever worked.
05:49 melo joined #mojo
06:01 avenj that's the best
06:07 jontaylor joined #mojo
06:09 Dave joined #mojo
06:49 dotandimet joined #mojo
07:14 AndrewIsh joined #mojo
07:17 dod joined #mojo
07:17 eseyman joined #mojo
07:19 arpadszasz joined #mojo
07:23 trone joined #mojo
07:35 bpmedley joined #mojo
08:00 amon joined #mojo
08:07 berov1 left #mojo
08:43 absolut_todd joined #mojo
08:45 inokenty joined #mojo
08:46 mattastrophe joined #mojo
08:49 berov joined #mojo
08:54 ghandi|work joined #mojo
08:57 ghandi|work Hi There! I've got a big client-app which got problems handling multipart/form-uploads. Submitting the Form succeeds in calling the POST-Method registered in the router, but the parameters are all empty? A small mojo-lite test-app works just perfectly. Anybody got an idea, at which places somebody could accidently mangel/kill the parameters in this case?
09:09 ghandi|work hmm...just like everytime you aks a question about hours of stumbling you code...the next moment you find the solution yourself. :D The app uses the Cookbook-Recipe for "streaming multipart requests" which emit the "request"-event early, before the whole body is parsed... ;)
09:20 Averna joined #mojo
09:52 kyshtynbai joined #mojo
11:28 cpan_mojo MojoX-Tree-0.06 by KOSTYA https://metacpan.org/release/KOSTYA/MojoX-Tree-0.06
11:32 yt7fms joined #mojo
11:35 neilhwatson joined #mojo
11:43 arpadszasz joined #mojo
11:50 kaare joined #mojo
12:07 mattastrophe joined #mojo
12:13 trone_ joined #mojo
12:25 punter joined #mojo
12:32 bpmedley joined #mojo
12:35 dvinciguerra joined #mojo
12:59 doby joined #mojo
13:19 dotan joined #mojo
14:08 nicomen any iea why my app ends up undefined and spews out: Can't call method "build_tx" on an undefined value - when called with ./script/app get /url (but works fine with ./script/app daemon)
14:10 PryMar56 joined #mojo
14:14 lluad joined #mojo
14:15 jberger nicomen: is it a regular app or have you tried to do something crazy with it
14:15 jberger ?
14:16 nicomen pretty regular app, always worked (2 years) and up to some minutes ago
14:16 nicomen disk space is ok too
14:16 nicomen need to dive into the load_class thing I guess, but this is so strange
14:17 nicomen no extra MOJO_ env vars either
14:24 nicomen $server->app is undef, Test::Mojo works, just command-line that fails...
14:24 nicomen wtf
14:24 jberger ./myapp.pl eval -v 'app'
14:24 nicomen aha
14:24 nicomen didn't like my ua attribute
14:25 nicomen even though it should be Mojo::UserAgent compatible
14:25 nicomen but I guess it needs some reference laying around?
14:26 nicomen that didn't help
14:32 nicomen needed to weaken it just like in lib/Mojo.pm
14:45 dod joined #mojo
15:14 gryphon joined #mojo
15:16 plicease joined #mojo
15:16 plicease joined #mojo
15:25 disputin joined #mojo
15:46 disputin joined #mojo
16:10 cpan_mojo Mojolicious-Plugin-Pingen-0.1.0 by OETIKER https://metacpan.org/release/OETIKER/Mojolicious-Plugin-Pingen-0.1.0
16:11 Lucas1 joined #mojo
16:21 Kogurr joined #mojo
16:23 cpan_mojo Mojolicious-Plugin-Pingen-0.1.1 by OETIKER https://metacpan.org/release/OETIKER/Mojolicious-Plugin-Pingen-0.1.1
16:47 thowe Am I getting more on-screen debug messages now with more recent revisions?
16:47 Grinnz_ i dunno, are you?
16:49 thowe Well, I don't recall having any settings that would squelch them...  I have a vew revisions older at home, and when running morbo it is pretty quite, just upgraded at work and started a new project and It's giving me running commentary about routing to controllers, etc.
16:49 thowe I seem to recall a note about not creating a log dir and I wonder if there were logs going to a file that are now defaulting to STDERR or STDOUT?
16:49 Grinnz_ that has always been debug output
16:50 Grinnz_ yes, it goes to STDERR if there is no log dir
16:50 thowe OK, so other project at home has a log dir, this one doesn't.  Makes sense.
16:51 thowe Not complaining, actually kind of like it at the moment.
16:55 mib_qel03j joined #mojo
17:05 mattastrophe joined #mojo
17:15 thowe I apparently need to use a SOAP API for some data validation...  What do people use for that these days in Perl?  Our other guy used a Ruby lib.
17:15 mst there's an mstpan for that
17:16 thowe mstpan?
17:16 mst http://shadow.cat/blog/matt-s-trout/mstpan-13/
17:17 thowe "Now everything is made of urine and you can't even find the cat."  awesome
17:17 Grinnz oh, you did one for SOAP, nice
17:18 mst it's shorter than usual, because there's not many positive things to say ;)
17:18 Grinnz pretty much
17:18 Grinnz also, i'm still WTB links go to next/previous mstpan :P
17:19 mst yes, there should be such things, but that would be boring
17:19 mst so I keep putting it off
17:19 Grinnz also a cute little "here's all the mstpans" page
17:23 thowe why oh why a SOAP API in this day and age?
17:23 Grinnz the eternal question
17:27 mst thowe: because enterprise, so they keep giving it another five year mission
17:50 berov1 joined #mojo
17:59 trone joined #mojo
18:02 marcusr because ms visual studio let's you do point and click soap apis
18:03 marcusr a moment to make, an eternity of suffering to use.
18:03 Grinnz oh god
18:04 Grinnz it all makes so much more sense now
18:22 jontaylor joined #mojo
18:38 Dave lol you guys
18:38 purl lol you guys are hilarious
18:40 Dave mst: ever thought about going into stand-up comedy? :)
18:40 jb360 joined #mojo
18:40 mst Dave: all my 40-min talks are basically two 17-min talks joined by 3-4 mins of jokes ;)
18:41 Dave do non-geeks get your jokes?
18:44 Dave Axiom 1: Every IT professional either has a large sense of humor or an aneurysm.
18:59 trone_ joined #mojo
19:12 trone joined #mojo
19:13 trone joined #mojo
19:15 trone joined #mojo
19:16 mattastrophe joined #mojo
19:30 hernan605 joined #mojo
19:40 mattastrophe joined #mojo
20:16 Grinnz_ jberger: do you have any forkcall tests which send objects back?
20:17 jberger Grinnz_: probably not
20:17 jberger but if you are using storable it should "Just Work" (TM)
20:17 Grinnz_ i want to try using it with Sereal as the serializer/deserializer, i think it should work
20:19 jberger it should
20:28 Grinnz_ "The code reference will be passed a single array reference. The first argument will be any error or undef if no error occured. If there was no error, the remaining elements of the array will be the values returned by the job (evaluated in list context)."
20:28 Grinnz_ this isn't important to the serialization right? it should just serialize the whole arrayref?
20:34 jberger right
20:40 Grinnz_ https://github.com/Grinnz/maverick/commit/908cd5bd685e25223d25a6e07493d9258dba51b8
20:40 Grinnz_ seems to work
20:41 Grinnz_ (the function_with_object functions are supposed to be the most efficient way to use it)
20:44 jberger Grinnz_++
20:44 Grinnz_ i might swap it over at $work too, we're already using Sereal for something else
20:45 Grinnz_ it's teh awesome :)
20:55 inokenty joined #mojo
20:55 inokenty left #mojo
21:00 jb360 joined #mojo
21:18 inokenty joined #mojo
21:28 ans1 joined #mojo
21:31 jberger joined #mojo
21:49 disputin joined #mojo
22:03 trone joined #mojo
22:03 Onigiri joined #mojo
22:04 kaare joined #mojo
22:10 gryphon joined #mojo
22:32 Dave Since Mojo::Pg::Database inherits events from Mojo::EventEmitter, can I assume that the 'error' event will be emitted on a query that isn't non-blocking?
22:32 disputin joined #mojo
22:33 Grinnz_ no, non-blocking query errors are returned in the callback, as the docs say
22:34 Dave that I understand, but what about a blocking query?
22:34 Grinnz_ a blocking query will just die
22:35 Dave ah ok, thanks
22:35 Grinnz_ oops, i missed the double-negative initially :)
22:35 Dave :)
23:00 stuart joined #mojo
23:02 stuart_ joined #mojo

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary