Camelia, the Perl 6 bug

IRC log for #mojo, 2012-08-22

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

All times shown according to UTC.

Time Nick Message
00:00 rem_lex| joined #mojo
01:00 laouji joined #mojo
01:19 l3l1p joined #mojo
01:54 bird joined #mojo
01:59 d4rkie joined #mojo
02:13 xaka joined #mojo
02:14 dsteinbrunner joined #mojo
02:17 jeen joined #mojo
02:17 dsteinbrunner hello, playing around with mojolicious and I think I found a spot that could use some attention
02:19 dsteinbrunner I have route that is calling render on a template that does not exist
02:20 dsteinbrunner from the user prospective it takes awhile for the expected page to error out with: Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.
02:20 crab beat it with a stick
02:21 crab that's expected behaviour if the template isn't found, you should have a message in the logs about assuming delayed response"
02:21 crab or similar
02:21 crab it does nothing, then the inactivity timer kills the connection
02:21 buu That seems like a suboptimal response
02:22 dsteinbrunner ok.. I'm seeing this in the logs
02:23 dsteinbrunner yeah, my thought was that it would be handled in a more direct way
02:23 crab how?
02:24 dsteinbrunner if no template is found then the pretty error page tells me as much
02:26 dsteinbrunner I mean, if a page is not found it gives me the route pattern which is supper spiffy
02:28 dsteinbrunner and when I compare that to this error situation it seems like something is not quite right
02:29 crab how can mojo tell that your action doesn't in fact mean to send a delayed response?
02:30 dsteinbrunner would you call render to a non existent template in that situation?
02:32 dsteinbrunner maybe what is currently done is proper.. but just thought it was worth pointing out that it might not be.
02:33 crab it's certainly unfortunate
02:34 crab but once a request has been matched to an action, it's difficult for the framework to decide that something should be a 404
02:36 l3l1p joined #mojo
02:45 noganex_ joined #mojo
03:08 edenc joined #mojo
03:29 buu crab: Surely there's some kind of 'If the action generates no content and there's no automatic rendering happening, then complain'
03:29 buu Heuristic that could reasonably be used
03:45 jeen joined #mojo
03:52 preflex joined #mojo
04:08 jeen joined #mojo
04:09 Leandr joined #mojo
04:15 xaka1 joined #mojo
04:29 l3l1p joined #mojo
05:24 crab how would it account for delayed responses?
05:24 laouji joined #mojo
05:25 crab don't get me wrong, i don't like the behaviour and it obviously causes all sorts of pain to people who don't expect it
05:42 Mikey joined #mojo
05:43 spleenjack joined #mojo
06:04 venkatk_ joined #mojo
07:01 Vandal joined #mojo
07:05 batman_ joined #mojo
07:39 buu crab: I have no idea how the internals work but surely it would be possible to check for code that will somehow trigger later, or even just a flag you set somewhere
07:39 buu Optimize for the common case afterall
07:59 marcus tempire: woot, I think your heroku thing is bork in latest mojo. Seems it has trouble with app detection.
07:59 marcus bateman
08:02 crab what's the best way to handle authentication for an API i have to offer from my mojo app to let a third part snarf some data from my system?
08:03 batman oauth2
08:03 batman :)
08:03 marcus you'd have to write a provider tho
08:03 crab are you serious, or just yanking my chain? i don't know oauth2, so i'd have to go read up on it.
08:04 batman crab: it's sooo easy for clients, so i would do oauth2
08:04 omega even if the spec is crap, hollow and useless now? atleast according to one of the original dudes
08:05 crab batman: so what should i read to understand what to do?
08:05 batman omega: i wouldn't care. i would just look at the source code for one of the provider modules on cpan, and implement it in mojo
08:06 batman crab: https://metacpan.org/module/Ne​t::OAuth2::Profile::WebServer <-- not sure, but looks like a server......
08:07 crab thanks
08:08 taryk joined #mojo
08:10 batman https://github.com/fuel-packages/fuel-​oauth2/blob/master/classes/server.php <-- php example?
08:10 batman når slipper du ny oauth2 på cpan?
08:11 batman arg!
08:11 batman i'm taking a break... typing in the wrong window all the time :P
08:12 crab now i have oauth2 all over my pås
08:16 berov joined #mojo
08:18 marcus batman: never!
08:19 tempire marcus++
08:19 tempire just discovered that myself
08:19 marcus All in all it makes for purtier code anyways :)
08:19 tempire oh sweet.  travis just commented that it passes the build test
08:20 tempire go travis
08:21 batman marcus:)
08:26 judofyr joined #mojo
08:36 Kwa joined #mojo
08:45 arthas joined #mojo
08:47 pau4o joined #mojo
08:48 pau4o joined #mojo
09:00 crab the oauth2 specifications seems to go to enormous lengths to not express a single opinion
09:20 andrefs joined #mojo
09:24 * sri yawns
09:25 sri buu: no, there is no way to know that some code will run later
09:25 sri buu: but you're welcome to work on a solution
09:27 sri crab: same for you, if you think the current solution is not optimal do something about it!
09:27 buu I am doing something! I'm complaining in irc!
09:27 sri that's not gonna change a thing
09:27 buu =[
09:27 buu Well there goes all my hopes and dreams.
09:28 buu sri: In any case surely the common case is 'this was a mistake' rather than 'this was intended let's go with it'
09:28 * buu shrugs
09:28 sri buu: how so?
09:28 buu That seems like it suggests a solution
09:28 buu I'm speculating wildly, do you have any data?
09:29 sri so your suggestion is to break basically every non-blocking app out there?
09:29 buu Sure
09:29 buu How many are there?
09:29 sri many
09:30 sri the cookbook is full of recipes for that
09:31 buu I obviously need to think about it in great detail, unfortunaly now is for sleeping.
09:31 buu and spelling badly.
09:31 sri http://mojolicio.us/perldoc/Mojoli​cious/Guides/Cookbook#REALTIME_WEB
09:32 sri non-blocking apps are very important for us
09:34 sri *if* you want to break all non-blocking apps out there, please defend that stance on the mailing list
09:35 sri there is no way in hell i take responsibility for something like that...
09:36 al sorry to interrupt - what's the most elegant way to pass the controller to an arbitrary method? like __PACKAGE__->_do_internal_stuff_that_shou​ld_only_be_used_from_this_package($self)?
09:36 sri $self->SomeClass::some_method
09:37 al or should i just use a helper instead?
09:37 al oh, ok
09:37 sri helpers are always better
09:38 al but they have no namespace which kind of bothers me
09:38 sri put them i a plugin then
09:38 al yea, i should do that
09:38 al thanks
09:42 judofyr sri: but couldn't $self->render check if the template exists, while auto-rendering could ignore missing templates
09:42 judofyr ?
09:43 sri auto rendering is a ->render call
09:44 sri buu, crab: this is basically the change you're proposing http://hastebin.com/raw/wimafucaki and it breaks 19 tests
09:45 sri auto rendering does actually sometimes result in a 404, when no route has been found
09:46 sri https://github.com/kraih/mojo/blob/m​aster/lib/Mojolicious/Routes.pm#L30
09:46 sri that's the code
09:48 sri judofyrs idea is the closest to something that might be workable
09:53 sri since afair we only test auto rendering not resulting in a response, but not explicit render calls
09:58 crab sri: can't i think the situation is unfortunate but there's not much to do about it? :p
09:59 sri crab: our solution is either optimal or we have to change something
09:59 sri but i don't think you can have both ;p
09:59 rem_lex|pivo joined #mojo
09:59 sri and when i say optimal i mean we've made the right tradeoffs
10:01 rem_lex| joined #mojo
10:06 sri here's a partial patch, if someone wants to work on it, i've lost interest http://hastebin.com/raw/wamugaguca
10:07 sri some parts of mojolicious like he actual 404 and 500 page rendering depend on nothing happening for their template discovery process
10:12 rem_lex joined #mojo
10:19 tinx Hm.  Some advice please.  I'm using Test::Mojo to test a Mojolicious app, and after ~20 Requests the next one results in a "Premature connection close".  It is probably something I did, but how can I debug that?  Not even the first line of my route seems to be executed anymore.  Can I attach the perl debugger to the test server somehow?
10:19 crab sure you can
10:21 crab PERLDB_OPTS=NonStop perl -d ./myapp test
10:21 tinx Thanks!
10:21 crab and set $DB::single = 1 where you want to break
10:29 nic It doesn't seem worth going to great pains to catch mistakes that can be caught via unit tests
10:50 dsteinbrunner joined #mojo
10:51 Lucas1 joined #mojo
10:57 fhelmber_ joined #mojo
11:02 arthas joined #mojo
11:02 spleenjack1 joined #mojo
11:24 marcus awesome, updated TTRenderer
11:24 marcus PLICEASE++
11:48 east joined #mojo
11:56 sri looks like open source is really working out for TM2
12:14 * crab waits impatiently for his new monitor
12:15 jeen joined #mojo
12:16 spleenjack joined #mojo
12:24 geira joined #mojo
12:32 jeen_ joined #mojo
12:41 zpmorgan joined #mojo
12:59 marcus sri: yepp
13:03 jeen joined #mojo
13:11 o_o joined #mojo
13:17 inokenty joined #mojo
13:17 inokenty left #mojo
13:17 inokenty joined #mojo
13:33 sri crab: anyway, why do you think it is desirable that $self->render(template => 'foo') results in a 404 if the template doesn't exist? (in addition to a missing template log message and a expecting delayed response log message)
13:34 bluescreen joined #mojo
13:34 Netfeed i would have expected a 500 if i tried to render a non-existing template
13:35 sri currently you have the option to do $self->render(template => 'bar') unless $self->render(template => 'foo')
13:36 sri we do use that functionality internally for example, to do render('exception') unless render('development.exception')
13:37 sri Netfeed: what is the gain of doing that?
13:37 sri as shown above, not rendering anything gives us an actual feature, why is a 500 page instead better?
13:38 Netfeed i have honestly no idea, that was just the first thing that came to mind that would happen if i tried to render something that didn't exist
13:39 Netfeed i don't say that it's something i want, it's just something that i would have expected, i would probably have been a little bit confused by an empty result
13:39 sri there are log messages explaining everything
13:39 sri and it's not a blank page, it's a 15 second timeout followed by a conenction close
13:41 sri which is also a feature allowing dead simple delayed rendering for event loops
13:41 purl okay, sri.
13:41 Netfeed alright, i guess i would eventually have enough wits with me to check the log :)
13:41 sri buu: maybe you have an answer, what's the gain of rendering a 404 page over the two features mentioned above
13:43 sri if you want to make sure that there's always a response, even if the template is missing you can just do $self->render_not_found unless $self->render
13:45 sri dsteinbrunner: you too
13:48 d4rkie joined #mojo
13:52 gryphon joined #mojo
13:52 dsteinbrunner sri: my point in bringing this up is that being new to mojo my impression is that is full all kinds of automagic and pretty error screens
13:53 dsteinbrunner I ran into this case and it seemed to run counter to that impression
13:53 sri dsteinbrunner: did you discover the non-blocking stuff yet?
13:54 sri http://mojolicio.us/perldoc/Mojoli​cious/Guides/Cookbook#REALTIME_WEB
13:54 dsteinbrunner nope.. just prototyping a simplish web app at the moment
13:54 CromeDome joined #mojo
13:55 sri i see
13:55 sri not rendering something is not something we consider an error
13:56 sri dsteinbrunner: also, do you cann $self->render yourself all the time or do you also use auto rendering?
13:57 sri *call
13:57 dsteinbrunner I'm calling render explicitly
14:00 sri ok, then delayed rendering + auto rendering is a non-issue for your use case
14:01 sri still leaves the render('exception') unless render('development.exception') problem
14:03 sri render_not_found and render_exception would have to be completely redesigned if ->render() generated 404/500 pages
14:05 daniel_ joined #mojo
14:05 eugen joined #mojo
14:07 eugen hello
14:08 eugen I have created a mojolicious::lite app and I want it to serve static files placed in public directory. http://mojolicio.us/perldoc/M​ojolicious/Lite#Static_files says it should do, but it's actually says "page not found".
14:09 eugen How can I fix this issue? (I'm using mojo 3.32)
14:10 sri crab, dsteinbrunner, buu: so, if you really care about this, please research an alternative to the current fallback feature
14:10 * sri waves
14:15 nic eugen: It does indeed work; can you create a minimal Lite app that illustrates your problem?
14:16 nic (if you're lucky, you'll find your minimal example actually works and that'll point you to where the problem lies)
14:16 nic eugen: Is a log being produced (in ./log)?
14:16 eugen nic, the minimal app created with "mojo generate lite_app foobar"  does not serve static content in public actually as far as I can see
14:16 nic If so, it will most likely tell you the path it tried
14:16 Leandr joined #mojo
14:18 nic What platform are you on?
14:18 nic Can the user running the Mojolicious daemon read the contents of ./public?
14:18 eugen nic, sure
14:19 eugen nic, I'm trying to access http://localhost:3000/public/test.html  both test.html and public are accessible for the user. I have tried on Mac os X and FreeBSD 9.0; the latest version of mojolicious.
14:20 nic noooooooooo
14:20 nic surely you want http://localhost:3000/test.html
14:21 nic do have logs?
14:21 eugen nic, oops. my fault.
14:21 nic phew!
14:21 sri \o/
14:21 eugen sorry for the false alarm
14:22 * nic calms down with a cup of camomile tea
14:22 * sri hands nic a beer
14:24 nic btw, you were right that my use case was the same as the one you fixed for session validity period
14:24 nic I didn't think I was using (expires => ...) but I was
14:24 sri :)
14:26 nic so is it the case that if a hop changes session data but returns no body back to the user then the changes are lost?
14:26 nic (just want to check I'm now on the right path)
14:28 crab sri: i think you are attributing a far stronger position to me than i am actually taking.
14:28 sri body is unimportant, as long as headers are sent, so is the session
14:28 nic cool, ta
14:28 sri crab: mkay :/
14:29 crab i certainly didn't think that render(template=>'foo') should generate a 404 if foo doesn't exist.
14:30 crab all i think is: i have seen on irc that many people are confused by the timeout and connection close when a template isn't found. that's unfortunate. but given the circumstances of the implementation, i don't see what we can do other than fiddle with the wording of the "assuming delayed response" warning.
14:30 sri oh, i see
14:31 sri that sounds very doable
14:31 sri got a better wording in mind?
14:32 ryozi joined #mojo
14:32 sri "Nothing has been rendered, waiting for delayed response." maybe?
14:34 marcus sounds better to me
14:34 crab sri: well, dsteinbrunner didn't notice the log message until i told him to expect it, so i'm not sure
14:34 sri or "No reponse, waiting for delayed rendering."
14:34 crab but your proposed change sounds fine
14:35 crab nothing has been rendered is better than no response
14:35 sri dsteinbrunner: thoughts?
14:35 purl i like cheese
14:35 sri botsnack!
14:35 purl :)
14:35 marcus purl: I like cheese too!
14:35 purl marcus: i'm not following you...
14:35 marcus purl: follow me...
14:35 purl marcus: sorry...
14:35 * marcus smack purl
14:35 * marcus smacks purl
14:35 purl hehe! that tickles!
14:36 nic "No reponse, waiting in case of delayed rendering." ?
14:36 crab i like "Nothing has been rendered yet, waiting for delayed response" best.
14:37 marcus or 'assuming delayed response
14:37 nic ah, I actually meant "Nothing has been rendered, waiting in case of delayed response."
14:37 spleenjack joined #mojo
14:38 marcus we're not actually waiting for anything are we?
14:38 good_news_everyone joined #mojo
14:38 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/ips6yQ
14:38 good_news_everyone [mojo/master] better delayed response log message - Sebastian Riedel
14:38 good_news_everyone left #mojo
14:38 sri marcus: we kinda are
14:38 sri but i guess not really :)
14:39 nic "Nothing has been rendered, waiting for Godo."
14:40 nic erm, Godot
14:44 sri crab: there would also be a template "lalal" not found log message though
14:45 crab yeah
14:46 crab as i said, people don't seem to see the messages until they're told about them, so i'm not sure how much good it'll do
14:48 sri maybe "Nothing has been rendered, expecting delayed response."
14:48 sri stronger words
14:50 sri also doesn't imply a blocking wait (which i guess is what marcus was worried about)
14:50 nic and a watcher that catches the timeout, prints out the log, sticks it to their monitor
14:50 marcus Yeah, I like that one
14:51 good_news_everyone joined #mojo
14:51 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/KMrnig
14:51 good_news_everyone [mojo/master] mention that a delayed response is expected - Sebastian Riedel
14:51 good_news_everyone left #mojo
14:57 vel joined #mojo
15:11 labrown joined #mojo
15:12 CromeDome joined #mojo
15:12 vel joined #mojo
15:54 xaka1 joined #mojo
16:42 Kwa Is it possible to use Test::Mojo's element_exists to see if there's a h1 tag with specific text?
16:43 Kwa I was thinking ->element_exists('h1[*=Home]'), but clearly I'm not going down the right thought path.
16:44 batman_ joined #mojo
16:51 Kwa Hmm, looks like I might need to inspect the dom directly.
16:51 sri no, that can't be solved with a selector
16:51 venkatk_ joined #mojo
16:51 sri http://mojolicio.us/perldoc/Test/Mojo#text_is
16:52 Kwa Perfect, thanks.
16:58 o_o joined #mojo
17:09 batman_ joined #mojo
17:17 batman_ joined #mojo
17:34 davido joined #mojo
17:54 rem_lex joined #mojo
17:59 fhelmber_ joined #mojo
18:10 ladnaV joined #mojo
18:15 Vandal joined #mojo
18:23 * sri wonders if it would be a good idea to revamp the cookie jar a little
18:29 sri i would kinda like a limit on the number of cookies it is allowed to store
18:57 nic I want to write a ua script to manipulate my google bookmarks
18:58 nic but the lovers of pain don't provide us with any api
18:58 nic so I'm pondering whether I can 'borrow' the cookie from firefox (after authenticating manually) and use that in ua
19:11 Britzel joined #mojo
19:30 labrown joined #mojo
19:31 sri http://hastebin.com/raw/yogusiriva # this is what i had in mind
19:31 Lucas1 joined #mojo
19:32 sri it's more secure and faster for small numbers of cookies, but gets a lot slower once the number of cookies grows
19:40 good_news_everyone joined #mojo
19:40 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/A47FAg
19:40 good_news_everyone [mojo/master] fixed cookie jar documentation - Sebastian Riedel
19:40 good_news_everyone left #mojo
19:40 sri guess nobody cares about the cookie jar, then it stays the way it is
20:05 xaka1 joined #mojo
21:00 davido joined #mojo
21:15 CromeDome joined #mojo
21:41 buu So uh
21:41 buu What's the sanest way to post json to a uri?
21:41 buu use regular form style?
21:45 rem_lex|pivo joined #mojo
21:50 lukep joined #mojo
21:52 good_news_everyone joined #mojo
21:52 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/IazEdg
21:52 good_news_everyone [mojo/master] better cookie jar tests - Sebastian Riedel
21:52 good_news_everyone left #mojo
21:54 sri buu: http://mojolicio.us/perldo​c/Mojo/UserAgent#post_json
21:54 buu oh
21:55 buu sri: I was asking more for the theory, but I suppose that works.
21:55 buu I mean more, how do you represent it as http
21:56 sri seems silly to double encode the data
21:58 buu huh
21:58 buu Yeah..
21:58 sri erl -Mojo -E 'say Mojo::UserAgent->new->build_json_tx("mojolicio.us" => {foo => "bar"})->req->to_string'
21:58 sri *perl
21:58 sri that's how i do it
21:59 buu Seems reasonable.
22:00 sri perl -Mojo -E 'say Mojo::UserAgent->new->build_form_tx("mojolicio.us" => {json => Mojo::JSON->new->encode({foo => "bar"})})->req->to_string'
22:00 sri that looks silly imo
22:01 buu Yeah
22:03 buu And then just $self->req->json ?
22:03 sri sure, if that's enough for your needs
22:04 buu Uh, what else would I do?
22:04 sri check parser errors
22:04 sri at the ->req->json layer you only know if it failed, but not why
22:04 buu Er, how would I check those?
22:05 sri Mojo::JSON::error
22:05 sri make your own instance
22:05 buu Oh
22:05 buu =[
22:06 buu Hmph.
22:06 sri or if you don't like that make your own helpers and release a plugin ;p
22:09 buu I'll put it on my todo list
22:10 buu Stylistically speaking what's the difference between $self and $c
22:56 gryphon joined #mojo
23:24 CromeDome joined #mojo
23:59 rem_lex joined #mojo

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