Camelia, the Perl 6 bug

IRC log for #mojo, 2011-01-02

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

All times shown according to UTC.

Time Nick Message
00:11 marcus hurrgh
00:12 marcus sri: HALP
00:12 marcus OAuth plugin works in async ways
00:14 marcus and now my login action renders a 404 rather than waiting for the call
00:14 marcus guess I need to pause it or something
00:17 marcus uhm, seems there is no way to pause anything anymore.
00:20 sri because everything is automatically paused
00:21 marcus sri: I am trying to do         $self->redirect_to('/new_event'); in a callback.. but it has already rendered a 404 because of no template file
00:21 sri then you triggered automatic rendering
00:22 GitHub198 joined #mojo
00:22 GitHub198 mojo: master Sebastian Riedel * 725083e (1 files in 1 dirs): added tests - http://bit.ly/gSOghm
00:22 GitHub198 left #mojo
00:22 sri that test might answer it for you
00:23 sri you likely named your action, not knowing it would trigger auto rendering
00:23 sri response code turns it off again
00:24 marcus aha
00:24 marcus so I should probably do that in my plugin (setting the response code)
00:24 marcus I named the action so that it would be easier to redirect to :)
00:25 sri oh wait, possible bug found
00:25 marcus hmm
00:25 marcus if I set the code, it seems to have trouble with redirects
00:26 sri this is highly experimental territory
00:26 sri mixing blocking and async is really fucking hard
00:26 marcus doh, of course it has problems with redirects if I put the code *after* the redirect.
00:26 marcus sri: yepp
00:26 marcus sri: still triggering autorendering
00:26 sri thats why i said "oh wait"
00:27 marcus :)
00:28 MojoGuest39 joined #mojo
00:28 MojoGuest39 From: http://news.ycombinator.com/item?id=1277067 (136 hits)
00:28 MojoGuest39 left #mojo
00:31 MojoGuest191 left #mojo
00:32 marcus oh well. Good luck with the gruffalo hunt, sri. I am going to bed. Guess I'll be woken up in like 5 hours by a little terrrrist
00:32 sri :)
00:32 sri gonna add $self->delayed
00:32 marcus sounds good
00:33 marcus guess I can't release my plugin until the next mojo is out anyways then :)
00:33 sri yea
00:33 marcus sri: btw, do you have the url for the twitter access token url as well as the authorize one?
00:33 sri nope
00:34 marcus k
00:39 sri ok, commit inc
00:41 GitHub37 joined #mojo
00:41 GitHub37 mojo: master Sebastian Riedel * 70a1233 (4 files in 4 dirs): added experimental delayed method to Mojolicious::Controller - http://bit.ly/higPRk
00:41 GitHub37 left #mojo
00:41 sri maybe a longer name like delayed_rendering would be a good idea
00:45 marcus sri: yeah
00:45 sri $self->render_later
00:46 sri $self->delay_rendering
00:46 sri render_later feels in line somehow
00:46 sri $self->render_delayed
00:46 marcus be_cool
00:47 sri $self->have_a_drink
00:47 sri $self->lay_back
00:47 sri $self->relax
00:48 sri relax would be kinda cool
00:52 GitHub175 joined #mojo
00:52 GitHub175 mojo: master Sebastian Riedel * be769ae (3 files in 3 dirs): renamed delayed method to render_later - http://bit.ly/heKM7X
00:52 GitHub175 left #mojo
00:53 curt left #mojo
00:54 GitHub43 joined #mojo
00:54 GitHub43 mojo: master Sebastian Riedel * 4c1970c (1 files in 1 dirs): pod cleanup - http://bit.ly/fnomvM
00:54 GitHub43 left #mojo
01:05 sri i actually thought about the render_later case above about a week ago, but got distracted before i could write a test :)
01:11 perlrocks Twitter: "Having people actually learn #perl because of #mojolicious is really amazing and very motivating. :)" --kraih http://twitter.com/kraih/status/21372945611886592
01:12 perlrocks Twitter: "Wonder which beginner tutorials and books to link to from the #mojolicious documentation. #perl" --kraih http://twitter.com/kraih/status/21373299992825856
01:24 ispy_ left #mojo
01:28 alnewkirk left #mojo
01:51 tempire sri: How to access ioloop from within a plugin?
01:55 GitHub55 joined #mojo
01:55 GitHub55 mojo: master Sebastian Riedel * 98183b5 (1 files in 1 dirs): test cleanup - http://bit.ly/dGl4lk
01:55 GitHub55 left #mojo
01:55 sri tempire: that should answer the question
01:56 sri the async client will always try to grab the right loop
01:56 tempire huh
01:56 tempire too easy
01:56 sri you just check if it is running
01:56 sri then you know if async is possible
01:58 sri or $tx->connection might not even exist for most blocking environments
02:02 tempire I'm using the following at the top of a test file with an embedded Mojolicious::Lite app:
02:02 tempire http://pastie.org/1422419
02:02 tempire But I'm guessing it's not that simple, 'cause the test doesn't seem to be using IO::Socket::SSL
02:03 tempire just INET
02:03 perlrocks Twitter: "Test:: Mojo If you look properly decode I was I started wondering. Then move on and you look a little strange, Mojolicious charset is noticed that no output. Now." (ja) --kuusou_kyokusen http://twitter.com/kuusou_kyok​usen/status/21386052056911872
02:04 sri tempire: didn't you look the the ioloop test case?
02:04 tempire maybe not closely enough...
02:04 sri https://github.com/kraih/mojo/b​lob/master/t/mojo/ioloop_tls.t
02:04 sri the exact test case you need
02:05 tempire Yeah, I have all that tested.  Now I'm trying to test an ssl_auth plugin, so I want access to the Test::Mojo stuff.
02:05 perlrocks Twitter: "The default charset = utf-8 Deta convinced that I'm supposed to like. Mojolicious:: Plugin:: Charset, but although you can specify or use, charset Did not it be better and I was always given me the security? What is XSS familiar." (ja) --kuusou_kyokusen http://twitter.com/kuusou_kyok​usen/status/21386590358077440
02:05 * sri doesn't follow
02:07 sri the translations are really bad, but i have a feeling that guy might be poisonous
02:08 sri tempire: https://github.com/kraih/mojo/blob/master/t​/mojolicious/websocket_tls_proxy_lite_app.t
02:08 sri that test should have everything you need
02:09 sri if you ignore the proxy stuff
02:09 tempire ah
02:09 tempire now I see what you were saying before
02:09 * tempire follows
02:09 sri :)
02:10 mattastrophe left #mojo
02:10 mattastrophe joined #mojo
02:20 MojoGuest956 joined #mojo
02:20 MojoGuest956 From: http://news.ycombinator.com/item?id=1277067 (137 hits)
02:21 MojoGuest956 left #mojo
02:40 curt joined #mojo
02:48 josh left #mojo
02:49 josh joined #mojo
02:59 perlrocks Twitter: "Mojolicious:: Renderer should have default charset. Because Mojolicious:: Renderer already has default encoding # Mojolicious" (ja) --kuusou_kyokusen http://twitter.com/kuusou_kyok​usen/status/21400041956577280
03:00 perlrocks Twitter: "Mojolicious:: Renderer:: render properly in "; charset = $ charset" I'm think of adding a right." (ja) --kuusou_kyokusen http://twitter.com/kuusou_kyok​usen/status/21400450024611840
03:18 GitHub109 joined #mojo
03:18 GitHub109 mojo: master Sebastian Riedel * fc641e3 (4 files in 4 dirs): improved charset handling in Mojolicious slightly - http://bit.ly/f4dWqC
03:18 GitHub109 left #mojo
03:19 mxey joined #mojo
03:26 ispy_ joined #mojo
03:26 mxey Hi. I started developing using Mojolicious and I really like it. I am wondering what you recommend to use for form validation?
03:27 * sri waves
03:27 * sri has no preference yet
03:27 mxey Do you a list of options perhaps? :)
03:28 mxey I need nothing fancy, I just have a user registration form.
03:28 sri MojoX::Validator is rather popular from what i gathered
03:29 mxey Looks good.
03:29 mxey Thanks.
03:54 curt left #mojo
04:03 tholen42 joined #mojo
04:05 tl left #mojo
04:06 GeJ joined #mojo
04:06 GeJ Good morning.
04:24 tempire morning
04:55 perlrocks Twitter: "@kraih I've enjoyed learning MORE perl and web development from the ground up because of #mojolicious and props for the help in #mojo" --ericrost http://twitter.com/ericros​t/status/21429345696354306
07:36 kaare joined #mojo
07:41 su-bzero[A] is now known as su-bzero
07:42 verrens joined #mojo
07:47 tempire I suppose I'm overlooking something simple.
07:47 tempire http://pastie.org/1422876
07:47 tempire $loop is not the current ioloop.
07:47 tempire it's just an empty blessed object
07:52 perlrocks Twitter: "Mojo:: DOM I wonder what I used, was going to help test and useful. $ T-> tx-> res-> dom to take in, you can change the dynamic behavior of the test from the display of the current page. Convenient. # Mojolicious" (ja) --kuusou_kyokusen http://twitter.com/kuusou_kyok​usen/status/21473823274569728
07:55 ispy_ left #mojo
08:46 perlrocks Twitter: "MojoX:: Validator not you all. inflate, deflate feature is implemented you! From there, which I do not need to fork myself though I was lying implemented. # Mojolicious" (ja) --kuusou_kyokusen http://twitter.com/kuusou_kyok​usen/status/21487602787950592
09:21 Alias_ left #mojo
10:02 su-bzero_ joined #mojo
10:04 su-bzero_ sri: What about community? Forum or something like that with voting for new features, plan for year,..
10:06 su-bzero_ People could help to improve mojolicious.
10:07 su-bzero_ Now mojo doesn't have any community. maillist + irc are not enough.
10:09 su-bzero_ And what will we do when you die?
10:09 su-bzero_ Cause of beer and pizza. ;))
10:12 su-bzero_ Anyway community is very good for opensource software.
10:13 su-bzero_ Only you will be able to commit, but allow people vote for features and etc.
10:13 su-bzero_ Need more interactively framework. ;)
10:15 * su-bzero_ .oO (Stop!)
10:15 su-bzero_ ;) Sorry. Just thoughts.
10:18 lee7 methinks irc is Google Wave done right ;-P
10:19 lee7 and perl culture always was irc-centric
10:20 su-bzero_ It's so hard to read logs.
10:20 su-bzero_ You should ask some questions again and again...
10:23 lee7 then you stop asking, find an answer yourself and add it to Wiki :)
10:27 su-bzero_ lee7: Yes, I know. No problems with questions. Problem is nobody could help to improve mojo, only sri could do it (as he thinks).
10:29 lee7 benevolent dictatorship model has many advantages ;-|
10:29 su-bzero_ Mojo is nice, sri did a good work. But this model could be improved too. ;)
10:30 su-bzero_ What about voting for features?
10:30 su-bzero_ It will be very usefull for project.
10:30 lee7 what about voting for physical laws? it could be very useful too
10:30 su-bzero_ Deputates vote.
10:31 su-bzero_ People elect deputates.
10:32 su-bzero_ No problems with current mojo model, but it will be better to do it better. ;))
10:32 lee7 with github you actually live in everett's multiverse, you CAN fork it :)
10:33 su-bzero_ It's so hard to maintain this code. You should know. ;)
10:33 su-bzero_ Only for sri's mind it's available.
10:34 yko su-bzero_: using mojolicious you already elected sri as maintainer, so he voting for physical laws for you
10:34 yko i'm sincerely as you to stop, really
10:35 su-bzero_ Ok.
10:35 lee7 acually, sri's code is shaping my mind, so far :)
10:35 yko thank you
10:35 su-bzero_ yko: Thank you for stopping me.
10:35 su-bzero_ yko: You have two faces. ;))
10:35 su-bzero_ It were my thought, nothing else.
10:35 su-bzero_ About mojo.
10:36 su-bzero_ left #mojo
10:42 rhaen moin
10:42 rhaen happy new year!
10:43 * rhaen just woke up.
10:43 rhaen Oh, what a party!
10:43 yko yeah!
10:43 rhaen where are my pants?
10:43 * rhaen looks around.
10:44 rhaen time for a shower.
10:44 yko lol. here's somebody pants, not sure it's yours, but whatever
10:44 * yko takes pants hanging from chandelier.
11:14 kaare left #mojo
11:14 kaare joined #mojo
11:16 daviddelikat joined #mojo
11:30 verrens left #mojo
11:56 perlrocks Twitter: "Blogs written - http://bit.ly/e5OSY5 - Mojolicious:: Lite in Data:: Model tried to use the" (ja) --nqounet http://twitter.com/nqounet​/status/21535177729646593
11:58 verrens joined #mojo
12:04 Alias_ joined #mojo
12:13 verrens left #mojo
12:20 su-bzero_ joined #mojo
12:29 bloonix left #mojo
12:31 verrens joined #mojo
12:39 verrens left #mojo
12:45 s0va joined #mojo
12:46 s0va buena nova! :)
12:46 s0va question: i'd like to integrate mojo webapps into anyevent event framework...
12:46 s0va i was reading source code
12:47 s0va and i think that porting should be quite easy - some parts of ioloop should use anyevent infrastructure
12:48 s0va i've seen AnyEvent::Mojo on cpan but it looks that is not working with current versions (>= 0.99936) of mojolicious
12:50 s0va so my question is: if i port ioloop's functionality to use AnyEvent loop, would mojo work without any major changes?
13:18 marcus sri: Added render_later and depends on 1.01 to OAuth plugin.
13:20 marcus s0va:
13:20 marcus x'
13:58 curt joined #mojo
14:06 daviddelikat left #mojo
14:39 kvorg left #mojo
14:52 ispy_ joined #mojo
15:04 s0va marcus: ?
15:06 yko he must be fall asleep right on the keyboard :)
15:10 s0va :)
15:11 s0va main motivation for porting mojo to anyevent is performance :)
15:11 s0va simple mojo application using io::epoll does ~ 1100 simple req/s using keepalive...
15:12 s0va simple anyevent::httpd based application does ~ 3100 reqs/s using keepalive
15:13 s0va + it seems that EV module implementation uses different approach by scheduling events. if you strace mojo process it does epol_something() + gettimeofday() every 0.25 seconds, EV's implementation does basically nothing just calls epoll_wait
15:13 s0va nothing is called until something actually happens.
15:14 daviddelikat joined #mojo
15:14 s0va and by using anyevent you get full eventloop for free too :)
15:19 yko i had a dream tonight that i found a way to decrease mojolicious memory consumption ~twice
15:20 s0va yko: did you notice any leaks ...
15:20 s0va becouse my mojo app grows over time...
15:20 s0va i need to restart it once per week
15:20 yko that should be your leaks, not mojolicious
15:21 s0va yeah ...
15:21 s0va if i strace process or inspect it using lsof...
15:21 s0va there is nothing weird to see
15:21 s0va i'm not allocating any buffers
15:21 yko s0va : why don;t you try hypnotoad: it uses pool of daemons and shut down each after it serves n requests. (1000 by default)
15:21 s0va i want singleprocess daemon...
15:22 yko ah. i understand you
15:22 s0va the only weird thing that could leak memory...
15:22 s0va is using eval on read string...
15:22 yko usually cross-links is what causes memory leaks
15:23 s0va i get hashref in string and using eval i convert it into perl hashref...
15:23 s0va is there any tool to inspect perl's memory heap?
15:23 s0va something like jprofiler for java...
15:24 yko Devel::Cycle is what i'm use to find leaks
15:24 s0va i'll look into that.
15:24 s0va i'd like to connect somehow to running process and inspect it's heap...
15:25 yko i never go so deep. Devel::Cycle is quite enough for me
15:44 marcus s0va: why do you want a singleprocess daemon?
15:44 marcus s0va: hypnotoad is great for long running requests.
15:46 bloonix joined #mojo
15:48 perlrocks Twitter: "Started a pet project with Mojolicious, It's so easy to use and I was productive within a few minutes  . Very cool #mojolicious" --mkirank http://twitter.com/mkirank​/status/21593623036428288
16:04 dotan joined #mojo
16:11 s0va marcus: i *need* minimal memory footprint and i don't want to use multiple cache instances :)
16:12 s0va plus i don't want to use some kind of ipc shared memory data sharing
16:12 s0va my code is completely non-blocking therefore i don't see any advantage in using preforked server :)
16:24 marcus s0va: what about 0 downtime code upgrades?
16:25 marcus s0va: and are you running your stuff on a single-core cpu?
16:37 sri s0va: you might be misunderstanding a few things
16:38 sri s0va: how did you test AnyEvent::HTTPD with mojolicious?
16:39 sri assuming it will just magically increase req/s by over 200% is bullshit
16:40 sri for micro benchmarks use examples/microhttpd.pl
16:40 sri 1100 req/s is a lready an unrealistic number for any serious application
16:43 sri s0va: using multiple processes has many advantages... or why dod you think nginx does it too?
16:43 sri *-d
16:44 sri s0va: bottom line, if all you're after is "performance", don't even start with an interpreted language
16:45 sri you either optimize for programmers or cpu, not both
16:45 marcus unless your programmers are cpus...
16:45 marcus :)
16:45 sri *mind blown*
16:48 sri to put things in perspective, reddit handles 80 req/s per server during peek hours, and thats pretty damn good for a real world app
16:50 sri *peak
16:54 sri for the record, examples/microhttpd.pl does 25k req/s
16:55 sri surely it has to be the best production http server... or maybe not ;p
16:56 marcus sri: the best production server for my awesome upcoming site helloworld.com
16:56 sri !
16:56 perlrocks Twitter: "Mojolicious - Web framework for Perl http://www.findbestopensour​ce.com/product/mojolicious # opensource" (id) --bestopensource http://twitter.com/bestopenso​urce/status/21610904839782400
16:57 marcus findbestopensource seems pretty spammy
16:58 sri su-bzero: this is a meritocracy, if you want to decide you have to contribute
16:59 sri su-bzero: take rhaen for example, he is the most qualified to maintain the wiki, so he has taken it over
16:59 perlrocks Twitter: "Mojolicious - Web framework for Perl http://www.findbestopensour​ce.com/product/mojolicious # opensource http://bit.ly/dQLmwy" (id) --FOSSwiki http://twitter.com/FOSSwik​i/status/21611618555133953
17:17 tempire sri: Alright, so I've got my tests for specifying an ssl cert & running it through my Mojolicious::Plugin::SslAuth, which I gleaned from the https://github.com/kraih/mojo/blob/master/t​/mojolicious/websocket_tls_proxy_lite_app.t you showed me.
17:18 tempire My problem is that I can't seem to access the current ioloop from within the plugin.  I've tried $self->client->async->ioloop & $self->client->ioloop, like the other test files you mentioned.
17:18 tempire halp!
17:19 * tempire waits patiently
17:23 tempire Also, I'm trying to think of a simple way to specify certificates with Mojo::Client.  I suppose print $client->get("http://kraih.com:$port:$cert:$key"') could work, to keep it consistent with --listen
17:26 tempire Seems clunky to me, since ":$cert:$key" aren't actually part of location, which invalidates the concept of a urL
17:27 tempire hmm, I wonder if $client->get("http://cert:key@kraih.com") would make sense.  The client could detect that cert:key were files and operate accordingly.
17:27 tempire That's kind of clunky as well.
17:28 moritz would that still do a normal HTTP request?
17:28 moritz if not, I don't see why it should be doen with ->get("http://...")
17:28 moritz if it's not the standard action, don't use the standard method
17:29 tempire you're right.
17:30 tempire ->get('http://kraih.com' => {Connection => 'close'} => 'Hi!' => "cert:key" => sub {...})  I guess
17:30 marcus what about adding a separate method for it?
17:30 marcus or setting the certificate on the client before the get...
17:31 tempire ->cert($cert)->key($key)->get(...) ?
17:31 tempire or ->ssl("$cert:$key")->get(...)
17:32 marcus I like the first one better.
17:32 marcus but sri probably has some opinions once he's done recharging or whatever
17:33 tempire ah, I meant ->get("https://cert:key@kraigh.com"), earlier
17:33 tempire but the ->cert->key->get is a much better idea
17:33 yko async get() should return client itself
17:34 yko what ->cert() will return?
17:34 tempire $self (the client)
17:35 tempire Same with ->key
17:35 yko so, after get() any other requests with that client will use same certificate?
17:35 tempire You would have to clear those values
17:35 yko oh...
17:36 tempire $self->cert($cert)->key($key)->get​(...)->cert("")->key("")->get(...)
17:36 tempire But in that case, it seems like you'd be better off making another client object
17:36 yko i think there should be a sub that will prepare tx
17:36 * sri likes
17:36 yko but i'm not familar with specs though :(
17:36 * sri suggests cert_file and key_file though
17:37 sri since some day support for in memory certs might be added
17:37 tempire I was going to make ioloop recognize that shortly
17:38 tempire tls_key & tls_cert can easily detect pem format or file
17:38 tempire ->cert & ->key would just be passed to ioloop, and could thereby take either a file or pem string
17:38 tempire you could interchange as well
17:39 sri sounds good, don't have to worry about that yet anyway
17:40 sri IO::Socket::SSL only supported files last i checked
17:40 tempire it supports strings as well
17:40 sri :o
17:40 tempire I haven't tested it, but the docs imply as such
17:41 tempire SSL_key vs SSL_key_file
17:41 sri hmm
17:42 sri can you clean up the code for the built in certs while you are at it anyway? :)
17:42 sri they are still written to files
17:42 tempire that's the plan
17:42 * tempire bows in service
17:42 sri \o/
17:43 tempire but back to my question about ioloop earlier
17:43 tempire halp!
17:43 sri ?
17:43 tempire tempire: sri: Alright, so I've got my tests for specifying an ssl cert & running it through my Mojolicious::Plugin::SslAuth, which I gleaned from the https://github.com/kraih/mojo/blob/master/t​/mojolicious/websocket_tls_proxy_lite_app.t you showed me.
17:43 tempire tempire: My problem is that I can't seem to access the current ioloop from within the plugin.  I've tried $self->client->async->ioloop & $self->client->ioloop, like the other test files you mentioned.
17:44 sri that would be quite weird
17:44 sri considering there are tests doing exactly that
17:46 sri whole longpolling file is full of them
17:47 tempire I'm using ioloop->connect to connect to the server, as opposed to Mojo::Client, maybe that's why ioloop isn't available
17:49 tempire http://pastie.org/1423724
17:49 tempire does anything look inherently wrong in that?
17:49 curt left #mojo
17:49 sri oh, that changes everything
17:50 curt joined #mojo
17:50 sri new client instance is not using the ioloop singleton
17:50 sri you would need an outer ioloop in that case
17:50 tempire ah
17:50 sri you have to manually make sure they are all in the same ioloop
17:52 tempire so Mojo::IOLoop->new->connect(...)
17:53 sri Mojo::IOLoop->singleton
17:53 sri then $self->client->async->ioloop should work
17:54 sri your problem is that you were setting up too much manually
17:57 tempire The point is to use the same ioloop for both the server & client request, right?
17:58 tempire hence the use of the singleton
18:03 tempire so then this should work: http://pastie.org/1423758
18:04 yko maybe, at line 3 should be $ioloop?
18:06 sri thats exactly the point
18:06 sri but $self->client usually starts with a random ioloop
18:07 sri so you rely on $self->client->async to detect the outer loop
18:07 yko also client may need to have app defined, no?
18:07 dku joined #mojo
18:07 sri which in turn usually relies on Mojo::IOLoop->singleton
18:08 sri yko: unrelated here i think
18:08 tempire yko: in this case, there is no client, I'm only using it to generate an ioloop
18:08 tempire (no Mojo::Client, I mean)
18:08 dotan left #mojo
18:08 sri tempire: that paste makes no sense though
18:09 sri my $loop = Mojo::Client->new->ioloop; $loop = Mojo::IOLoop->singleton;
18:09 sri makes no sense at all
18:09 sri the point is to have them all use the same
18:10 tempire agreed.  tried that, I'm just trying different variations based on your comments.
18:11 tempire although it seems to me the use of $loop = Mojo::IOLoop->singleton be the same thing as not having that statement at all.
18:11 * sri doesn't follow
18:12 * tempire is awaiting the outcome of this, wherein he will be an IOLoop master
18:12 sri well, this is not everyday ioloop stuff
18:15 tempire so http://pastie.org/1423787 , combined with $self->client->async->ioloop (http://pastie.org/1423790) should give me the ioloop I'm looking for.
18:16 sri no
18:16 sri still totally wrong
18:16 tempire awesome!
18:16 sri ;p
18:16 sri my $loop = Mojo::IOLoop->singleton;
18:16 sri thats how you start
18:17 tempire well
18:17 tempire freaking eh
18:17 tempire it's like magic.
18:17 sri singleton is the one magic loop
18:18 tempire Ah, I was thinking incorrectly.  I was assuming that Mojo::Client->new->ioloop would be recognized by singleton all throughout, because it was the only ioloop within the application.
18:18 tempire But that was too much assumption.
18:18 sri ye
18:19 sri client always starts blocking with a fresh anonymous ioloop
18:19 tempire it's so obvious looking at IOLoop.pm now
18:19 tempire :s
18:20 * tempire declares himself a master of all things
18:20 sri the downside of defaulting to blocking, makes the hard test cases a little harder
18:21 sri but this is about as hard as it gets
18:22 yko btw, sri thank you again for pointing me on client.t for nested requests.
18:22 sri sure thing
18:23 yko i was fighting with windmills, because problem was not on my side, not on mojo side but on aspx side :s
18:25 tempire Ha!
18:25 tempire "Construct a new Mojo::IOLoop object. Multiple of these will block each other, so use singleton instead if possible."
18:25 tempire everything falls into place
18:25 sri \o/
18:25 yko or chain each against other :)
18:26 tempire I want to add a $loop->connection($id) to get the contents of $loop->{_cs}
18:26 tempire or $loop->handle($id) to get the IO::Socket:* would do as well
18:26 sri $loop->handle sounds ok
18:27 tempire I suppose that is more consistent with the other calls
18:29 sri or wait
18:29 sri tempire: do you really need the socket?
18:30 sri how about $loop->remote_info($id) adding the cert too?
18:31 tempire There are several IO::Socket::SSL calls I can foresee people needing.
18:31 sri :S
18:31 tempire I know, I know
18:31 tempire actually, I may be misunderstanding IO::Socket::SSL docs
18:32 tempire hold on...
18:33 tempire Ok, the problem is there's more than peer_certificate
18:33 tempire There's get_cipher & verify_hostname
18:34 sri guess ->handle it is then
18:34 tempire I guess those can be added to remote_info, though.
18:35 tempire What's your main concern about exposing the handle?
18:36 sri many unknowns
18:37 sri people will depend on IO::Socket::SSL
18:37 tempire Which could change at any time
18:37 tempire And then you get blamed.
18:37 * sri is still hoping for a more sane tls module to come along
18:38 sri but that migth just be wishful thinking
18:38 sri we might also have to use some ipv6 socket module
18:38 sri which would change normal handles
18:39 tempire The alternative is to include calls to ::SSL in remote_info, which still couples it tightly to mojolicious.
18:39 sri maybe i'm overthinking it
18:39 tempire But in that case, you'd have to change the whole TLS implementation anyway.
18:39 sri just go with handle
18:41 sri if you want to be nice you can add an ->isa check to your plugin
18:41 tempire yeah
18:41 tempire fail if not SSL
18:41 tempire ::SSL
18:41 sri ye
18:41 tempire It doesn't seem like {_cs} gets populated in ioloop.t.  I'm guessing you have to have a listen & connection to get it.
18:42 tempire ah, connect
18:42 sri connections might require a tick
18:43 tempire ->one_tick?
18:43 tempire That doesn't touch {_cs}
18:43 sri you shouldn't have to do anything manually though
18:44 sri dns lookup delays the actual connect i think
18:44 sri by one tick with a 0 timer
18:44 sri not sure why you worry about that though
18:44 tempire I'm looking for the best way to test ->handle, which means I need something in {_cs}
18:45 sri use a real test
18:45 tempire I can test it in the tls tests, but it seems to make more sense to do it in ioloop.t
18:45 sri ioloop.t doesn't do anything besides timers ;p
18:45 sri ioloop_tls.t
18:46 tempire k
18:46 sri you could add a new test to ioloop.t though
18:46 sri removing the tls parts
18:48 tempire so...to be clear, you don't want the handle test in ioloop.t
18:48 tempire but rather in ioloop_tls.t
18:49 tempire seems inconsistent for tracking down tests later
18:50 tempire oh, nevermind
18:50 tempire I didn't read those last two statements
18:51 sri :)
18:52 sri i never added a basic socket test to ioloop.t because basically every lite_app test does the same thing already
18:52 sri handle is a good reason to do it now though
18:59 tempire Is there any time there wouldn't be a handle in an {_cs}->{$id}?
19:00 sri if a handle exists it is there
19:01 sri {_cs}->{$id}->{handle} of course, but i guess you mean that
19:01 tempire yes
19:02 tempire I'm just wondering if there's a situation where {_cs}->{$id} is a hashref but {_cs}->{$id}->{handle} does not exist.
19:02 tempire but I'm seeing, no
19:10 perlrocks Twitter: "Blogs written - http://bit.ly/gGuqfA - Mojolicious:: Lite in DBIx:: Skinny tried to use the" (ja) --nqounet http://twitter.com/nqounet​/status/21644574837448704
19:11 tempire wait a second.
19:11 tempire It's just occurring to me that if I provide IO::Socket::SSL in my ssl_auth plugin, I'll have to support that as well.
19:12 * tempire is starting to feel some of sri's pressure
19:12 sri :)
19:17 Akron joined #mojo
19:36 tempire BOOSH!
19:36 tempire ssl plugin working
19:36 tempire and tested
19:36 sri \o/
19:36 tempire now to attack ->cert & ->key
19:37 tempire using $loop->connect manually is painful in comparison
19:38 sri just add a tls_lite_app.t for testing the higher level api
19:40 seb_ hi there, does someboy know a simple working example of websocket for mojolicious? All examples from the site did not function for diverses resons.
19:41 sri how about the echo example on http://mojolicio.us?
19:41 sri doesn't get much simpler
19:41 s0va sri: about anyevent && stuff: i'd like to run mojo apps as part of anyevent webapp...
19:42 sri s0va: thats not what you said before
19:42 sri s0va: but you could write a replacement ioloop using anyevent if you wanted
19:42 s0va sri: my question was: if i port ioloops functionality to use anyevent loop, is there a chance to run mojo apps without major rewrite of mojo?
19:43 s0va as far i see, lots of mojo great stuff depends on ioloop.
19:43 s0va i'm already very pleased with mojo's performance...
19:44 sri $Mojo::IOLoop::LOOP = Mojo::IOLoop::Anyevent->new
19:44 sri you might be able to do something like that
19:44 s0va sri: server::daemon and mojo::client should work out of the box if anyevent compatible ioloop would be available in Mojo::IOLoop?
19:45 sri sure, everything is only using public apis
19:45 s0va i was thinking about something like inet6 glue module, which copies all symbols of IO::Socket::INET6 in place of IO::Socket::INET
19:45 s0va great :)
19:46 s0va anyevent also natively support TLS, DNS async resolution, timers, watchers and even working IPv6!
19:46 sri not much to be gained there
19:47 sri we have all that
19:47 s0va sri: true, but the big gain would be anyevent integration :)
19:47 sri there is also another alternative
19:47 s0va running multiple mojo apps in single perl process etc
19:47 sri we can already do that
19:47 s0va true :)
19:48 sri you could run anyevent next to the normal ioloop with an on_tick event
19:48 s0va anyevent doesn't have one_tick() equivalent
19:48 sri the other way around
19:48 s0va ... this is where we have a problem :)
19:49 s0va sri: i just want to code nice gui for my existing daemon app using mojo
19:49 sri Mojo::IOLoop->singleton->on_tick(sub {EV::loop EV::LOOP_NONBLOCK});
19:49 sri something like that
19:49 s0va omg :)
19:50 sri there is also a poe example in the wiki
19:50 s0va yeah, i saw :)
19:50 s0va fuck poe, and as i said some time ago: POE wheels for some weird reason block the entire process
19:51 seb_ sri: what does the simple echo websocket example do? I have a websocket rocks on my localhost:80 (!), and links /title /echo /clock show me the text value {"list":[0]}
19:51 sri the community around poe is nice
19:52 seb_ (using google chrome)
19:52 s0va sri: i'll try to implement lowlevel stuff you do in ioloop using anyevent; i think that both communities would benefit from it.
19:52 sri seb_: you might want to read up on websockets first
19:52 s0va anyevent's httpd really sucks donkey's balls compared to mojo::server::daemon
19:52 sri they have a special javascript api you need to use
19:53 sri s0va: sure, let me know if there are any small changes needed to make it easier
19:53 s0va sri: in a week or so :)
19:53 sri like $ENV{IOLOPP_CLASS} = 'Mojo::IOLoop::Anyevent' or so
19:53 s0va sri: i also found that anyevent is really not very memory hungry...
19:54 s0va sri: yeah, i was thinking about something like that to...
19:54 s0va plus i found that full ssl/tls support is already written with certificate  verification
19:54 sri s0va: you might want to wait for tempire though, he's making some tls adjustments right now
19:54 s0va without io::socket::ssl stuff
19:55 sri heh, we'll have that soon
19:55 s0va np, i'm regulary pulling git repo
19:56 s0va anyevent also does stuff your way: it's all about closures :)
19:56 * sri is more of a parallel event loop fan though
19:56 sri i'm sure you could do cool things with on_tick, Coro and EV
19:56 sri to increase responsiveness
19:57 s0va i've done lots of poe programming; it's quite nice when you get used to it, but you hit the scaling barrier really fast
19:57 s0va aham... EV's loop doesn't have tick, it doesn't wake up on regular basis...
19:57 s0va and that's good :)
19:58 s0va EV uses libev, which should be even more scalable than libevent
19:59 s0va sri: however, i'll dig into it. i just wanted to be sure if ioloop implementation is core of mojo business :)
20:00 sri "EV uses libev, which should be even more scalable than libevent"
20:00 sri thats a rather weird phrase
20:01 sri what makes it more "scalable" exactly?
20:01 s0va http://libev.schmorp.de/bench.html
20:01 sri ok, what has raw performance to do with scalability?
20:01 s0va handling of more events/fds concurrently
20:01 sri thats performance
20:02 sri it does nto help with scaling
20:03 sri for example the actor model is a solution for scalability
20:04 seb_ I prefer living examples to learn. I will search some more. I do not understand from where come this "websocket test" page (wich is not in the code), who connect who, where do echo.websocket.org intervince.
20:05 sri seb_: you need to undertsand the javascript side first
20:05 sri then it will make sense ;)
20:06 sri websockets are a lower level async message passing layer
20:06 sri relatively unrelated to http
20:07 sri s0va: if it's raw performance you're after then http://search.cpan.org/dist/Nginx-Engine/ might be the new king in town
20:08 tempire Has anyone used that?
20:08 sri it should be pretty much impossible to beat since all io happens in C space
20:08 sri no io handles at all
20:08 curt left #mojo
20:08 sri not used it yet, but like the api
20:09 curt joined #mojo
20:09 sri the node.js comparison is quite correct, since it has no io handle concept either
20:13 seb_ I stay confuse. Do you have some good ressources. Google geve all in it's reverse for websocket. Where should this be on the OSI model?
20:13 sri seb_: https://github.com/kraih/mojo/blob/​master/lib/Mojo/HelloWorld.pm#L293
20:14 sri thats how the javascript code should look like
20:14 sri for a minimal example
20:15 sri the websocket protocol is on the same layer as http
20:15 sri it's an alternative for real time communication
20:15 seb_ thanx I will try this
20:16 sri no need to rush learning websockets though
20:16 sri they will break soon
20:16 seb_ ?
20:16 sri the protocol is not done yet
20:17 sri the next version of the spec is guaranteed to break every implementation
20:20 bloonix left #mojo
20:20 seb_ I will not wait to understand this :). I have tons of ideas to test. And it look like I have some road to walk before
20:24 sri someone should combine nginx with v8 to kick node.js ass :)
20:28 sri oh cool, new alien series this year!
20:28 sri Falling Skies
20:28 sri looks like a mix of walking dead and V
20:29 yko oh ye?
20:29 sri http://www.imdb.com/video/imdb/vi1185651481/
20:29 yko walking dead freaked out with idle for one year
20:30 yko so powerfull start, so cool camera work and such a.... i dont know proper words in english :)
20:32 sri wait, are you saying there will be no new walking dead episodes for a year?
20:32 sri NOOOOOOOOOOOOOOOOOOOOO!!!!
20:33 yko lol, you didn't know?
20:33 * sri cries
20:33 yko they said that they will rest for about a year
20:43 seb_ left #mojo
20:46 kvorg joined #mojo
20:58 curt left #mojo
20:59 curt joined #mojo
21:00 baton8 left #mojo
21:06 tempire ahhh!
21:06 tempire http://planet.perl-magazin.de/
21:06 tempire We can't let the germans take over
21:06 tempire It usually doesn't go well
21:06 tempire vti is the only one who can save us
21:07 * tempire listens for a trolololo
21:12 baton8 joined #mojo
21:14 achromic joined #mojo
21:15 sri trolololo
21:23 baton8 left #mojo
21:23 curt all, I'm working through the routing example on git... https://github.com/kraih/mojo/​wiki/Routes-for-non-lite-apps. I'm having trouble with the new_form portion of the example...
21:24 curt <%= form_for '/cities' => (method => 'post') => begin %> is routing to http://localhost:3000/cities/cities
21:25 curt but changing the example to <%= form_for 'http:///cities' => (method => 'post') => begin %> resolves the problem.
21:28 baton8 joined #mojo
21:32 yko hm
21:34 yko problem lies here: http://bit.ly/i0tZpj
21:34 yko but i'm unsure is it a problem or no. not sure to what this commit http://bit.ly/gpdx5v was related
21:35 sri the wiki entry might be based on a bug
21:35 curt I worked through the example the other day without issue... on 0.999930
21:35 curt and it worked fine
21:35 curt upgrade to 1.00 yesterday and can't make it work
21:36 sri relative paths were handled wrong
21:37 sri it was actually a rather huge bug that broke base tags
21:37 curt so, is the example incorrect?
21:37 sri ye
21:38 curt is htt:///cities the correct syntax?
21:38 sri no
21:38 sri what are you trying to achieve?
21:39 curt I'm just working the example
21:40 * sri did never read it
21:40 yko rendering <%= form_for '/example' %> at 'http://localhost/foo/bar' he want to get form with action 'http://localhost/example' i think
21:40 curt yes
21:41 curt that's the way it worked on  0.999930
21:41 yko ->parse on non-empty Mojo::URL can behave little bit strange
21:41 sri <%= form_for 'example' %>?
21:41 sri yko: it has been aligned with html rules for urls
21:42 curt I've try the following: <%= form_for '/example' %>
21:42 curt <%= form_for 'example' %>
21:42 curt <%= form_for '//example' %>
21:43 curt all route to http://localhost/example/example
21:43 sri ok now i get it
21:43 sri you did in fact rely on broken behavior
21:44 sri where it would generate an absolute path starting with a /
21:44 sri which made apps non portable
21:44 sri <%= base_tag %>
21:44 sri add that to your layout
21:44 sri or head section
21:44 yko or use route names to generate paths
21:44 yko *urls
21:45 sri doesn't work
21:45 sri paths are all portable now
21:45 sri as in relative
21:45 sri the problem is if a path starts with / it is absolute
21:45 yko oh... i was dreaming about that half year ago :)
21:45 sri bound to the current authority
21:46 sri thats non portable when your application is actually based in http://localhost/myapp for example
21:46 yko ye. that was my problem which i solved with tricky stuff
21:47 sri was a very nasty bug
21:47 sri lucky we got it fixed before 1.0
21:47 yko ye
21:48 sri curt: quick solution <%= base_tag %> in your head section
21:51 sri form_for doesn't actually generate "http://localhost/example/example", thats why i got confused
21:51 sri it generates just a relative "example"
21:55 GitHub1 joined #mojo
21:55 GitHub1 mojo: master Sebastian Riedel * c21e164 (3 files in 2 dirs): updated application generators with base tags - http://bit.ly/ekjFKT
21:55 GitHub1 left #mojo
21:58 sri gonna update the examples too to make it more obvious
21:59 jwang joined #mojo
21:59 achromic left #mojo
22:00 curt thanks, that resolved the issue...
22:00 curt once I started calling the default layout
22:03 curt might want to add "% layout 'default';" to the new_form.html.ep example
22:03 sri it's a wiki, feel free
22:05 curt don't have a git account... it might be time
22:05 sri indeed
22:05 achromic joined #mojo
22:10 kvorg left #mojo
22:12 GitHub93 joined #mojo
22:12 GitHub93 mojo: master Sebastian Riedel * 8f21bc2 (1 files in 1 dirs): pod cleanup - http://bit.ly/hKmeUB
22:12 GitHub93 left #mojo
22:12 sri ok, that should help in the future
22:13 marcus hmm, I think it would be easy to extend MojoX::Validator to generate data for jquery validation
22:14 GitHub32 joined #mojo
22:14 GitHub32 mojo: master Sebastian Riedel * d929cf8 (1 files in 1 dirs): pod cleanup - http://bit.ly/h5Ubaw
22:14 GitHub32 left #mojo
22:31 sri marcus: you might not want to put too much effort into it
22:31 sri considering html5 forms
22:33 su-bzero1 joined #mojo
22:38 marcus what about html5 forms?
22:38 su-bzero_ left #mojo
22:38 GitHub169 joined #mojo
22:38 GitHub169 mojo: master Sebastian Riedel * 1af6d84 (1 files in 1 dirs): pod cleanup - http://bit.ly/fVvn03
22:38 GitHub169 left #mojo
22:38 marcus sri: html5 forms seems to be pretty similar to previous versions? Just more types?
22:38 sri built in validation
22:39 marcus just for very simple cases
22:39 sri see "pattern" attribute ;)
22:41 sri http://www.alistapart.com/ar​ticles/get-ready-for-html-5/
22:42 seb_ joined #mojo
22:43 marcus not supported by chrome yet :)
22:44 sri excuses
22:45 marcus anyways, I need this for the project I am doing this week
22:45 marcus and I don't think jquery validation will be obsolete too soon
22:45 marcus the server will still need to validate html5 forms too
22:45 marcus t
22:45 marcus this is a convenient way to have a single defintiion of validation rules
22:45 marcus definition
22:46 marcus can always write some simple js to use the metadata to add attributes to a html form later
22:55 GitHub127 joined #mojo
22:55 GitHub127 mojo: master Sebastian Riedel * 2ed39b9 (1 files in 1 dirs): fixed typo - http://bit.ly/gKktzM
22:55 GitHub127 left #mojo
22:56 perlrocks Twitter: "Mojolicious:: Lite in DBIx:: Skinny've used it - it filtered its programmers Isuzu http://bit.ly/eBUTfh Sunday" (ja) --wPerlnews http://twitter.com/wPerlnew​s/status/21701286609031168
22:56 verrens joined #mojo
22:56 sri hmm, maybe i should encourage async a little less
22:57 sri it's an optimization that comes with a cost
22:57 marcus and the price is YOUR SOUL
22:57 sri marcus: actually i'm not sure anymore your plugin should be async by default
22:58 sri the price is the debug screen
22:58 sri async always moves request handling out of the safety net
22:59 kaare left #mojo
22:59 marcus sri: yeah, it complicates things
22:59 sri i guess plugins should treat it as an optimization as well
22:59 marcus sri: can't you magically put it back into the safety net? :)
22:59 sri and only go async when asked
23:00 sri marcus: i wish :)
23:00 marcus sri: I guess the plugin should still use callbacks tho
23:00 sri ye
23:00 marcus to have a coherent api
23:00 sri you basically just need something like my $client = $async ? $client->async : $client;
23:00 marcus mm
23:01 marcus I guess I shouldn't be calling render_later if it's not async
23:01 sri oh right
23:02 marcus $c->render_later if $args{async};
23:02 * sri nods
23:03 marcus I guess the async version isn't really faster
23:03 marcus it just frees up the daemon from blocking
23:03 sri exactly
23:04 sri actually non blocking is usually a little slower, you can just do something else while waiting
23:06 marcus weird
23:06 marcus automatic rendering triggered even on non-asyn
23:06 marcus async
23:06 marcus without render_later
23:07 marcus ignore me
23:07 * sri ignores marcus
23:07 marcus it hangs instead
23:07 marcus of course
23:07 marcus the test can't work without async :)
23:07 sri Oo
23:08 sri sounds like you did go async
23:08 marcus since it's hitting localhost in a single-thread
23:08 sri oooh
23:08 marcus guess the test gets async on then
23:08 sri actually that shouldn't be a problem
23:09 sri https://github.com/kraih/mojo/blob/m​aster/t/mojolicious/lite_app.t#L384
23:10 sri this one does a "blocking" subrequest too
23:10 sri you just give it a path
23:10 sri it will fire up a second daemon in another ioloop
23:10 marcus yeah, but I'm feeding the client the full url
23:11 marcus token_url => Mojo::URL->new("http://localhost:$port/fake_token"),
23:11 sri don't do that for the blocking test :)
23:11 sri /fake_token to test blocking
23:11 * marcus adds blocking.t
23:16 * marcus gets fails
23:16 * marcus cries
23:17 marcus Mon Jan  3 00:17:07 2011 error Mojo::Client:763 [71960]: Couldn't connect.
23:17 marcus guess it doesn't work if the url is a Mojo::URL object?
23:18 sri don't think it matters
23:21 verrens left #mojo
23:30 marcus sri: "/$fb_url"
23:30 marcus if I do it like this it works
23:30 sri weird
23:30 sri ooooh
23:31 sri relative url of course
23:31 marcus sri: yeah, but I'm not sure the relative handling is sane
23:31 marcus I do Mojo::URL->new("/foo")
23:31 marcus and it stringifies to "foo"
23:32 sri feel free to improve it
23:32 marcus perl -MMojo::URL -le'print Mojo::URL->new("/foo").""'
23:32 marcus I think I'll go to bed instead
23:32 sri :O
23:32 sri slacker
23:33 sri in the old days you have stayed up all night!
23:33 marcus It's already 12:30
23:33 marcus I'm pretty sure I didn't
23:34 marcus I've been married the whole time we've been hacking together :p
23:34 sri bad memory too!
23:34 sri nn pops
23:36 * marcus turns on the booby traps on his lawn and goes to bed.
23:36 kvorg joined #mojo
23:44 sri marcus: actually there might be a better solution

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