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

IRC log for #mojo, 2016-08-19

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

All times shown according to UTC.

Time Nick Message
00:07 Pierre joined #mojo
00:46 mvorg boloi
01:43 Pierre joined #mojo
02:13 noganex joined #mojo
02:26 Pierre joined #mojo
03:32 Pierre joined #mojo
03:42 Pierre joined #mojo
04:05 ivi joined #mojo
05:44 inokenty-w joined #mojo
06:03 Adurah joined #mojo
06:41 trone joined #mojo
07:03 inbioz joined #mojo
07:13 Vandal joined #mojo
07:21 AndrewIsh joined #mojo
07:46 Pierre joined #mojo
07:50 janl joined #mojo
07:50 janl foo
07:50 purl bar
07:51 janl so, way deep in a app I need to make a SNMP connection, so I call my wrapper class App::Model::SNMP->new('somerouter');
07:52 janl in this new I need to access a mojo app->config item
07:52 janl however it escapes me how to obtain the $app handle
07:52 batman $c->app->config("item")
07:52 janl where did $c come from?
07:53 batman janl: have you looked at Mojo::SNMP?
07:53 batman it's the controller object
07:53 batman i thought that was what you meant about "way deep in a app"
07:53 batman you probably want to extract the config(item) first and pass it to the model object
07:54 janl batman: I inherited a mojo app, and it stupidly has SNMP communities hardcoded in several places. so I want to place the communities in the config and then the snmp -> new needs to access it
07:54 janl I can see at startup that the config is read correctly
07:54 batman so where do you call SNMP->new() ? in an action (where you have $c) or...?
07:55 janl good question. I must examine code.
07:55 batman anyway... do _not_ access $c or $app inside App::Model::SNMP
07:56 batman always pass in enough information to App::Model::SNMP
07:56 batman doing App::Model::SNMP->new("router", $c->app->config) is fine though
07:56 janl durn
07:56 batman since config is just a hash and not an application or controller object
07:56 janl hei "igjen" forresten jan henning
07:57 batman the whole point with a model is to abstract the web application from reusable "backend" libraries
07:57 nebg joined #mojo
07:57 nebg hello everyone... i'm reading this... http://mojolicious.org/perldoc/Mojolicious/Guides/Tutorial
07:57 batman hi janl :)
07:57 batman hi nebg
07:57 janl *mumble*
07:57 nebg and i'm already hmore than half... but my question is ... how do i correctly split my applications in more files/directories ?
07:57 nebg i want to have separate html, css, js
07:58 nebg on for example a public directory and all the perl source in an upper directory... or generally which are good rules to split source for web app dev ?
07:58 nebg i need help on this...
07:58 nebg for example what directory structure do you use ?
07:58 batman nebg: you can read more about that here: https://metacpan.org/pod/distribution/Mojolicious/lib/Mojolicious/Guides/Growing.pod
07:59 janl batman: f*** me, this app is way SNMP heavy, I need to change 4711 call paths to incorporate config.
07:59 batman nebg: the file structure is explained under "Differences"
08:00 batman janl: find lib -type f | xargs perl -pi -e's/.../.../g'
08:01 janl batman: the snmp new is easy enough to find and edit, it's all the intermediate calls
08:01 janl stuff that
08:01 purl stuff that is, like, supposed to be semantically identical is often not, in particular with the usage of the with() thing
08:02 nebg ok thanks batman
08:02 janl I am making $app a global in the app class
08:02 batman nebg: you're welcome
08:02 batman janl: then i can't help you. i'm not going there :)
08:03 batman good luck
08:03 purl You'll need it.
08:04 janl batman: well, your distaste is appreciated, but I'm reluctant to find and edit 1337 different intermediate calls
08:04 batman that is your choice entirely :)
08:05 batman should've had me as a colleague: i'm a mean, mean, rewriting machine ;)
08:05 batman or maybe you're best off without me, hehe
08:05 janl well, in this case maybe better with
08:06 janl since I was dropped in the middle of a complex mojo app with no prior experience with mojo
08:06 janl the larger structure of the app is sound
08:06 batman janl: oh! that sounds awful :(
08:07 janl but there are lots of distastefull details, like SNMP communities hardcoded several different places
08:09 janl I will surely manage, but I'm easily mystified by the ways of the app and mojo
08:10 batman sure. all new stuff is like that.
08:10 batman i remember i was mystified by CGI.pm back in the days :)
08:10 batman i think i still am, but not by the same stuff, hehe
08:10 janl not for more than 5 minutes probably.
08:11 janl there just isn't that much complexity in CGI.pm
08:11 janl Mojo is a different kind of framewor
08:11 batman depends on the knowledge base you start with :)
08:14 janl let's see how my test works now
08:16 osfabibisi joined #mojo
08:49 jontaylor joined #mojo
08:56 cuechan joined #mojo
09:30 mvorg joined #mojo
09:36 batman joined #mojo
09:43 jontaylor joined #mojo
09:52 sri batman: can we at least update the docs on mojolicious.org?
09:57 nebg batman, for big applicaitons... how si the structure workflow  ?
09:57 nebg i mean i have an entry scrupt which routes the requests to various 1. other perl scripts who manage page content html, css etc... or 2. html pages directly ?
09:58 nebg and except from the main script which serves as the router... approximately should i have one perl script per html page ?
09:59 sri modules, not scripts
09:59 sri .pl=script, .pm=module
10:09 Lee joined #mojo
10:41 nebg sri, ok so one module per page  ?
10:41 nebg one module per html page
10:41 nebg ?
10:47 sri there's a blog example that might help answer the question https://github.com/kraih/mojo-pg/tree/master/examples/blog
11:06 tchaves joined #mojo
11:35 Kripton joined #mojo
11:45 Pierre joined #mojo
12:38 gizmomathboy joined #mojo
12:42 AirDisa joined #mojo
12:44 neilhwatson joined #mojo
12:52 jontaylor joined #mojo
13:15 mvorg Why this http://paste.scsys.co.uk/532131 is exploding with a "Global symbol "$pg" requires explicit package name at template...."  ??
13:15 cpan_mojo Mojolicious-Plugin-AssetPack-1.20 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/Mojolicious-Plugin-AssetPack-1.20
13:15 batman joined #mojo
13:17 batman sri: i will start working on that now.
13:17 batman thanks for reminding me
13:18 batman nebg: did someone already answer your questions?
13:18 CHYC mvorg: It may be you're missing a semicolon at the end of line 2
13:18 jontaylor joined #mojo
13:23 mpapec joined #mojo
13:28 nebg joined #mojo
13:33 bwf joined #mojo
13:34 mfontani You want: % my $pg = stash 'pg';
13:44 janl mfontani: who did you answer now?
13:45 janl oh, I see now
13:47 mfontani the missing semicolon was mvorg's; I hope he found it
13:47 tchaves joined #mojo
14:09 nebg guys i'm stuck with web dev... i have doubts... on the structure.... i don't understand how to organize code and divide html parts from perl etc...
14:14 mvorg CHYC, mfontani: thanks! I always forget is plain Perl!
14:15 mfontani nebg: https://metacpan.org/pod/distribution/Mojolicious/lib/Mojolicious/Guides/Growing.pod should help you "grow" a one-file app into a many-files (module, templates, etc)
14:22 nic Is there a way (even a temporary hacky way) to stretch out morbo's polling interval?
14:22 mcsnolte joined #mojo
14:22 nic Having it run 'stat' less frequently might help with some debugging
14:26 nebg mfontani, but it doesn't go deeper than one perl script... i wanted to know how to work with more scripts... and multi page websites...
14:26 nebg it just develops a login page...
14:27 nic nebg: Did you look at the blog example sri mentioned?
14:27 nebg nic,  i don't understand anything there
14:31 sri nic: while i wouldn't mind an option, it would be too implementation specific
14:32 nic understood.  This is a very uncommon situation, and I think I solved it by hacking-in a 'sleep'  :D
14:32 nic (something has made morbo explode in a strange way and I'm struggling to track down what caused it)
14:32 pink_mist that's the absolute worst thing to do in an async process
14:33 pink_mist a sleep will stop all async stuff from working while it's sleeping
14:33 nic Pink: you must be missing some context
14:33 pink_mist I read morbo + hacking in sleep
14:34 pink_mist that's enough context I'd think
14:34 nic It riles me when people are so very quick to leap in with "omg you're doing the worst thing" when they haven't even understood what you're doing or why
14:43 * jberger jberger hacks in his sleep
14:48 cafe joined #mojo
15:14 batman joined #mojo
15:32 itaipu joined #mojo
15:35 mvorg how can I get the value of the 'X-Forwarded-For' header from the $tx (I suppose) object?
15:36 Pierre joined #mojo
15:37 jberger mvorg: do you really need it?
15:37 mvorg jberger: yes I do :)
15:37 jberger if you enable the reverse proxy handling it should just transparently do the right thing
15:38 jberger you can access any header from $tx->headers->header
15:38 mvorg mmhh...apache is proxying the connections to my Mojo app...
15:38 mvorg $tx->headers->header('X-Forwarded-For'); ?
15:38 jberger mvorg: see the last items in http://mojolicious.org/perldoc/Mojolicious/Guides/Cookbook#Hypnotoad
15:39 Grinnz_ you would of course only get that header from the proxy, and not while testing
15:48 PryMar56 joined #mojo
15:52 kes joined #mojo
15:56 nic right, found my problem with morbo: turns out perl was just spitting out warnings cos you get undefs when you stat dangling symlinks
15:58 nic I think the worst that could have happened is a log file growing, but even then, 180 lines/min isn't a big problem
16:02 jabberwok1 joined #mojo
16:20 marty joined #mojo
17:03 asarch joined #mojo
17:17 disputin joined #mojo
17:35 Pierre joined #mojo
17:36 itaipu joined #mojo
18:00 batman sri: http://mojolicious.org/perldoc/Mojolicious/Routes/Route#any
18:00 batman updated?
18:01 jabberwok joined #mojo
18:02 itaipu_ joined #mojo
18:47 batman joined #mojo
19:16 jontaylor joined #mojo
19:28 cafe joined #mojo
19:30 sri batman++
19:31 batman yay!
19:31 batman sorry for taking so long... i messed up convos pretty badly earlier, so i fixed that first :/
19:42 dod joined #mojo
19:47 dod joined #mojo
19:56 prajith joined #mojo
19:56 itaipu joined #mojo
20:05 prajith joined #mojo
20:05 prajith_ joined #mojo
20:05 jontaylor joined #mojo
20:16 prajith_ joined #mojo
20:27 jontaylor joined #mojo
21:00 mvorg joined #mojo
21:37 Pierre joined #mojo
22:05 meshl joined #mojo
22:21 jontaylor joined #mojo
22:26 batman joined #mojo
23:18 AirDisa joined #mojo
23:23 jontaylor joined #mojo
23:38 da5id joined #mojo
23:58 meshl joined #mojo

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