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

IRC log for #mojo, 2015-04-29

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

All times shown according to UTC.

Time Nick Message
00:08 mattastrophe joined #mojo
00:46 hshong joined #mojo
00:48 Zoffix joined #mojo
01:07 vmbrasseur joined #mojo
01:16 mattastrophe joined #mojo
01:20 klapperl_ joined #mojo
02:04 mattastrophe joined #mojo
02:15 jberger argh, I just got the sasl thing again (way off topic I know)
02:18 mst jberger: people try and brute force accounts all the time
02:19 mst jberger: being annoyed because for once you get told seems silly to me
02:20 jberger k
02:21 jberger he's being rather persistent now though
02:21 mst freenode k-line one every so often
02:21 jberger now I'm more annoyed at the notifications ;-)
02:22 mst but of course that often doesn't help much
02:36 Grinnz jberger, i would advise not setting up fail2ban to email you when people try to login to your server as root
02:37 mst Grinnz: this is freenode's sasl auth problem
02:38 Grinnz i know i'm just saying... if you don't want a lot of notifications about just how many people try to bruteforce stuff ;)
02:50 mst true
02:50 mst part of the problem is atheme dev is getting really flaky
02:53 noganex_ joined #mojo
03:00 avenj atheme crew? flaky?  no!
03:00 * avenj whistles
03:01 inokenty-w joined #mojo
03:10 jberger Grinnz: I use something similar on my servers
03:13 Grinnz atheme is what freenode uses?
03:31 absolut__ joined #mojo
03:31 melo joined #mojo
03:35 diegok joined #mojo
03:42 irq joined #mojo
03:56 basic6 joined #mojo
04:00 damaya joined #mojo
04:00 damaya Hi all, I want my mojo app to take command line options
04:01 damaya e.g., myapp --generate, which does not start the daemon but rather outputs some stuff at the command line
04:01 damaya is there a guide on how to accomplish this?
04:13 preaction i usually use environment variables
04:27 Grinnz damaya, https://metacpan.org/pod/Mojolicious::Command and https://metacpan.org/pod/Mojolicious::Commands
04:27 Grinnz https://metacpan.org/pod/Mojolicious::Guides::Cookbook#Adding-commands-to-Mojolicious
04:31 zivester joined #mojo
04:37 damaya Grinnz: I followed the guide, but I'm still getting the error: Can't locate Mojolicious/Command.pm in @INC
04:37 damaya I created MyApp::Command::command, put in the content, added the namespace in sub startup { }
04:38 asarch joined #mojo
04:40 damaya Does it specify what the myapp.pl should look like? All I have is script/myapp
04:41 damaya And I can
04:41 damaya I can't run ./myapp from script/, because it looks for lib in the cwd, and lib is up one directory
04:43 damaya E.g., with these directions (https://metacpan.org/pod/Mojolicious::Guides::Cookbook#Adding-a-configuration-file) what really is the point of touch myapp.pl; chmod 744 myapp.pl
04:44 damaya nowhere in there do you put content in this file... you just have an empty executable
04:51 kaare joined #mojo
04:54 dotandimet joined #mojo
04:57 damaya *facepalm*
05:48 jwang joined #mojo
05:55 dod joined #mojo
06:00 dod joined #mojo
06:13 damaya joined #mojo
06:13 damaya in the under example here: http://mojolicio.us/perldoc/Mojolicious/Guides/Routing#Under
06:14 damaya if I do that, will all routes be protected by auth?
06:14 damaya err, by the condition I mean
06:14 damaya the problem I am having, I have no routes outside of $auth-> routes, and it's not rendering text "You're not bender"
06:15 damaya So, if I hit www.domain.com/ and X-Bender is not in the headers, I want it to render "You're not bender."
06:15 damaya I.e., there are no routes for people not bender, no matter what they hit it will render "You're not bender."
06:22 bramirez joined #mojo
06:47 Lee damaya has gone?
06:51 McA joined #mojo
06:51 augensalat First of all I want to say that Mojolicious is a really well engeneered software, imo one of the most valuable in the perl universe and I think we all owe sri a lot for his work
06:52 augensalat sri: it is neither my decission nor my aim to be blocked by you. If you feel so then go ahead, this is your kingdom.
06:53 augensalat I have written a few Mojolicious plugin for my own use. I released them on CPAN on the assumption that they might be usefull. Two of them have been concerned by recent changes in core Mojolicious.
06:54 augensalat Even though I previously decided not to get involved in any discussion in IRC or ML, I tried to discuss the srand issue for M:P::OnFork without success as usual. So I just documented that situation in my plugin.
06:54 augensalat I decided not to discuss that _method parameter with sri based on my previous bad experiences, and again just documented the current situation.
06:55 augensalat sri: If you find something wrong here, then please tell what exactly.
06:56 augensalat sri: I was never informed that you blocked me on Github too, same with the unblocking (unless you just did it yesterday evening).
07:03 eseyman joined #mojo
07:19 wariat joined #mojo
07:19 kaare joined #mojo
07:25 AndrewIsh joined #mojo
07:31 chansen joined #mojo
07:32 trone joined #mojo
07:37 sri augensalat: the problem is the constant passive agressiveness every time a decision didn't go the way you wanted it to
07:37 sri augensalat: just stop doing that and we won't have a problem again
07:41 Vandal joined #mojo
08:01 bramirez joined #mojo
08:02 depesz joined #mojo
08:03 depesz hi. this is probably somethingf simple, but can't figure it out - how can I make the whole app work under given prefix, without redoing routes to use this prefix?
08:10 depesz perldoc for Mojolicious::Controller suggests, in part for url_for(), that it should be possible to set actual app path, but I can't figure it out how/where to set it.
08:11 sri http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Rewriting
08:16 depesz reading...
08:16 purl reading is over-rated
08:16 depesz sri: so I just have to change "base" of the req?
08:21 gatitskiy joined #mojo
08:32 melo joined #mojo
08:36 depesz ok. i tried to write it, but I failed. Added hook, but am still getting errors. what am I doing wrong? here is code and config -> https://depesz.privatepaste.com/251fe31bbe
08:38 irq joined #mojo
08:56 fhelmber_ joined #mojo
09:11 wariat_ joined #mojo
09:16 memowe joined #mojo
09:42 marcus anyone tried running mojolicious directly in nginx with the http_perl_module?
09:45 kaare joined #mojo
10:02 punter joined #mojo
10:29 mishanti1 marcus: I haven't, but I am very curious as to which benefits there might be in doing so. IS it better performance, scalability, or something else that makes you want to try it out?
10:31 marcus mishantil: I just need a very simple authentication service on a nginx proxy, and it seemed like a simple way to implement it.
10:33 mishanti1 Ah. Seems reasonable yes.
10:44 bramirez joined #mojo
11:00 ryozi joined #mojo
11:15 meshl joined #mojo
11:19 neilhwatson joined #mojo
11:23 mattastrophe joined #mojo
12:07 dod joined #mojo
12:10 dotan1 joined #mojo
12:35 bramirez joined #mojo
12:42 memowe joined #mojo
12:43 btyler I asked for some advice on a delays talk about a week ago -- if anyone has a moment, I'd appreciate an idiot-check on the code: https://github.com/kanatohodets/delays-talk
12:44 btyler slides probably won't mean much, since they're mostly just highlighting different pieces of the code
12:46 btyler gist is basically "async is cool, but callbacks are terrible and promote really tightly coupled code: delays are a great way to stay sane while writing non-blocking apps"
12:47 btyler I don't get into nested delays or 'step factories', and only mention multiple concurrent async actions in a single step at the end as a teaser
12:47 memowe joined #mojo
12:47 wariat joined #mojo
12:48 ryozi_ joined #mojo
12:50 gryphon joined #mojo
12:52 memowe joined #mojo
12:53 ajr_ joined #mojo
12:57 mst btyler: delays are nice if you don't have a proper promises/future system
12:59 Grinnz btyler, i thought this catch was in the wrong place at first but the indenting is just weird https://github.com/kanatohodets/delays-talk/blob/master/delay.pl#L53
13:00 btyler mst: yeah, its only a 30 minute talk, and I'm not really expert enough to know about pros/cons of promises vs futures vs delays
13:01 Grinnz btyler, looks nice
13:01 btyler Grinnz: thanks for the note, I'll make sure to point it out carefully (too lazy to go reindent all the slides)
13:02 mst btyler: delays are sort of a way to do callback style but with an object threaded through them to keep them together
13:02 mst btyler: promises/futures are a way to do an object style that then sets up callbacks
13:02 mst btyler: so one's kinda inside out from the other, if you see what I mean
13:03 Grinnz btyler, i think that nicely covers most of what confused me about delays, just looking at the code; the one other thing i'd make sure to mention is how the arguments make it from the begin call to the next step
13:04 btyler yeah, I think I do. I've used promises in js a bit, not yet in perl
13:04 btyler Grinnz: cool, thanks, will do
13:06 nf joined #mojo
13:15 Grinnz if you had more time maybe you could show a "make your own" async function like a timer, and then how the arguments it calls the callback with get spliced; but thats probably too much for 30 minutes
13:27 neilhwatson joined #mojo
13:33 Grinnz so far i haven't come across anything in web apps or my irc bot that delays couldn't handle simply, once i figured them out; to me they feel like a way to write async code that flows like sync code
13:37 jberger Grinnz: I've had the same experience
13:40 Grinnz two of my more complex examples: https://github.com/Grinnz/zircbot/blob/master/lib/Bot/ZIRC/Plugin/Translate.pm#L165 and https://github.com/Grinnz/zircbot/blob/master/lib/Bot/ZIRC/Plugin/Weather.pm#L45
13:41 Grinnz both cases just need to do a series of steps, one of which may not need to wait for anything and thus just passes a value
13:42 Grinnz and the async functions use inner delays for catching exceptions so there will always be a reply to the channel
13:47 odin22 joined #mojo
13:58 jberger Grinnz++
13:58 jberger looks similar to what I have in my codebase at $work that I wish I could show off but I can't
13:59 jberger except mine has a lot more "die $err if $err" flying around
14:00 jberger not quite sure how you've avoided that, but I don't have time to poke around
14:00 sri jberger: you might want to take a look at your mail :(
14:00 jberger sri: saw it
14:00 mattastrophe joined #mojo
14:01 jberger Grinnz: what are all those extra catches?
14:08 asarch joined #mojo
14:21 Kripton joined #mojo
14:42 mattastrophe joined #mojo
14:45 meshl joined #mojo
14:46 Grinnz_ jberger: the async functions return the delay, so i can catch it where i have the object to send a reply with
14:48 Grinnz_ jberger: i think i might need to add more of the "die $err if $err", because just catching an inner delay error doesn't "unload" the outer delay
14:48 Grinnz_ unless i can come up with a better way to handle that
14:48 jberger Grinnz_: that's an interesting pattern
14:48 jberger a little closer to futures actually
14:50 jberger the way I have done this, when each layer has its own self-contained delay and each of those delays has a catch that calls the passed in callback with the first argument as error
14:50 Grinnz_ right
14:50 jberger and everything calls "die $err if $err" it all bubbles out
14:51 jberger does make the code a little "boiler-plate" filled though
14:51 btyler jberger: heh, I bumped into the same pattern for a personal project
14:51 Grinnz_ i wonder if theres a way there could be a method on the delay that just does the error handling part of _step
14:51 Grinnz_ i.e. ->remaining([])->emit(error => blah)
14:52 Grinnz_ i mean i could just write taht
14:52 Grinnz_ lol
14:52 Grinnz_ i dont really need to re-emit the error in this case though
14:52 Grinnz_ i just need to clean up the delay
14:57 Grinnz_ jberger: the reason i have it separate is that errors from the inner delays i want to send in the reply specifically, and errors in the outer delay i want to just say "Internal error" and log the error
14:57 Grinnz_ because the inner delay errors are things like API errors
14:59 jberger sounds like a case for error objects
14:59 Grinnz_ yeah, i considered that... it may be something i add
14:59 jberger and maybe some reusable handlers
15:02 sh4 joined #mojo
15:22 disputin joined #mojo
15:24 disputin joined #mojo
15:29 amon joined #mojo
15:40 melo joined #mojo
15:56 ajr_ joined #mojo
15:58 lluad joined #mojo
15:59 ajr_ I'm getting a server error message. It's happening somewhere in a chain of module calls. I don't recognise the message or the code it's showing me. How can I find out who's complaining?
16:02 dod joined #mojo
16:03 Grinnz_ what is the error message?
16:10 Grinnz_ mmmm beta version of sphinx search uses "preforked" threads instead of creating them on demand... should work nicely
16:10 ajr_ "Invalid input profile: keys not recognised &c" - it's from somewhere below Data::FormValidator
16:11 Grinnz_ especialyl since we get like 100 queries a second
16:11 genio joined #mojo
16:12 Grinnz_ ajr_: odd.. do you know where it's being triggered in your code?
16:13 ajr_ Yes, in the sense I know the where the top of the call is
16:14 ajr_ but that calls a module which calls D::F::V
16:15 Grinnz_ you could try Carp::Always or something like that
16:16 ajr_ I'll take a look at that.
16:17 ToApolytoXaos joined #mojo
16:30 ajr_ Didn't seem to make any difference; still no stack trace
16:38 mattastrophe joined #mojo
16:39 disputin joined #mojo
16:47 dod joined #mojo
16:54 jberger question for the peanut gallery
16:54 jberger if I'm designing a site that is likely to need multiple services over websocket
16:55 jberger do people think it's better to have one socket and design a JSON protocol to direct traffic to different consumers (inside the client app)
16:55 jberger or open multiple websockets to different routes which are single purpose
16:56 mattastrophe joined #mojo
16:56 Grinnz_ i dont know if there's one general answer, but it's certainly doable over one websocket and that saves connections
16:56 Grinnz_ i think it would depend how different the services are
16:58 Grinnz_ also remember you'll have to manage that on the javascript side too
16:58 jberger one is long-lived, mostly idle, server push
16:58 jberger one is high traffic for a short time, client initiated (could really have been an AJAX but we want lowest latency)
16:59 ajr_ joined #mojo
16:59 Grinnz_ one benefit of keeping them separate is that they can get served by different workers which means they could block at the same time
16:59 Grinnz_ potentially
16:59 Grinnz_ but once you scale up enough users that doesnt matter much
17:00 jberger its a good point, but neither service is going to block much
17:02 Grinnz_ otherwise; there's probably less overhead if you can combine them
17:08 storskegg joined #mojo
17:12 jberger storskegg: o/
17:13 storskegg o/
17:13 kaare joined #mojo
17:14 wariat joined #mojo
17:14 wsirc_433 joined #mojo
17:15 wsirc_433 hello every body
17:15 purl Hello Dr. Nick!
17:17 wsirc_433 anybody have some small and functional example of embed applications in mojolicious? i cant understand from mojolicio.us/perldoc/Mojolicious/Guides/Routing #embed applications
17:18 wsirc_433 :)
17:22 jberger wsirc_433: perhaps batman does?
17:22 jberger the problem is that the most common use of embed is not a single app, but multiple apps
17:22 jberger which isn't usually how people publish their apps
17:24 wsirc_433 for example the one that is in the web page of mojo from " from mojolicio.us/perldoc/Mojolicious/Guides/Routing"  to see how it work
17:24 wsirc_433 :)
17:25 Grinnz_ i'm not sure what you're asking; you can run it yourself?
17:28 jberger wsirc_433: did you see http://mojolicio.us/perldoc/Mojolicious/Plugin/Mount
17:28 lb (don't do that)
17:28 jberger wsirc_433: it is documented right above #embed http://mojolicio.us/perldoc/Mojolicious/Guides/Routing#Mount-applications
17:29 jberger lb: why not?
17:29 lb i just can't see what you gain, but of course that's mho :)
17:29 lb also, it feels hacky
17:30 jberger monitoring console that you want in multiple applications?
17:31 lb but is a monitoring console a seperate app or a plugin?
17:31 jberger could be either
17:31 jberger maybe you want to embed a blog app into your company's page
17:32 jberger mycompany.com/blog
17:32 lb as i said, mho, i'd prefer the agility of having seperate processes, and have nginx or whatever proxy them
17:32 jberger lb: perhaps
17:33 lb less moving parts, fsvo parts, and easier to pinpoint issues
17:33 jberger its the same number of moving parts, just attached at a different joint
17:33 wsirc_433 mount is the same of embed applications?
17:33 jberger wsirc_433: yes
17:34 lb except for Mojo::Server->new :)
17:34 jberger the mount plugin is just a shinier packaging
17:34 romel hi. i'm on my way of integrating search::elasticsearch into my mojolicious app. and i noticed that actually i need async client only for public part of website. how do you guys think, is it reasonably to have two client connections: one blocking for internal purposes such as creating new indices, re-mapping, etc and non-blocking for public search?
17:36 Grinnz_ romel: you could maybe use minion or something for that
17:36 Grinnz_ the slow blocking processes
17:36 Grinnz_ personally with our sphinx saerch, i have a completely separate daemon that does reindexing continuously
17:37 lb never do "long" computations in a web-app, that's just wasteful or painful
17:38 Grinnz_ right, minion lets you initiate them from the web app though
17:38 lb yes
17:38 lb do that, have the use be updated by js holding a websocket or polling or whatever, but don't block
17:38 lb the user
17:39 Grinnz_ as our sphinxsearch is a realtime index, updating a single entry on demand is relatively fast so i'm currently just doing that as a blcoking operation
17:40 lb sure, "long" is relative
17:40 Grinnz_ but in the past i had a job queue like system to pass it off to the daemon
17:40 lb for some a db-query is wasteful
17:41 romel yes, i'm going to perform routine tasks with minion but the main problem at the moment is that each method call on async client object returns promise. so my code looks like $es->indices->exists_type()->then(sub { $es->indices->get_field_mapping->then()}) and so on :)
17:41 lb ungh
17:41 lb node.pl
17:41 romel it's called callback hell or something like that, right?
17:42 Grinnz_ arent promises supposed to be a way to avoid that :)
17:42 Grinnz_ romel: if you were here earlier i was discussing usage of delays, you could certainly use one to make that more readable
17:44 Grinnz_ btyler even had a handy set of slides about it!
17:44 lb https://github.com/kanatohodets/delays-talk
17:45 romel Grinnz_: earlier today?
17:46 Grinnz_ around 9 am my time, 5 hrs ago
17:46 romel coll, will take a look
17:46 romel *cool
17:46 romel thanks
17:47 lb (those were the slides)
17:47 frudas joined #mojo
17:47 romel thank you lb
17:48 frudas joined #mojo
17:54 Kundun joined #mojo
18:04 disputin joined #mojo
18:16 storskeg_ joined #mojo
18:21 storskeg_ @jberger o/
18:34 cpan_mojo Mojolicious-Plugin-SizeLimit-0.002 by GRAF https://metacpan.org/release/GRAF/Mojolicious-Plugin-SizeLimit-0.002
18:49 jb360 joined #mojo
18:49 berov joined #mojo
18:57 odin23 joined #mojo
19:08 irq joined #mojo
19:15 storskeg_ joined #mojo
19:40 ajr_ joined #mojo
19:54 wariat joined #mojo
20:01 disputin joined #mojo
20:23 jb360 joined #mojo
20:26 irq joined #mojo
21:01 dotandimet joined #mojo
21:07 mattastrophe joined #mojo
21:30 jb360 joined #mojo
22:00 Grinnz_ joined #mojo
22:24 mattastrophe joined #mojo
23:25 asarch joined #mojo
23:44 lluad If I'm reading the changelog correctly, I can't use Mojo::Pg to do sequential async queries inside a delay(). Is that right? Any workaround?
23:45 Zoffix joined #mojo

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