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

IRC log for #mojo, 2014-02-12

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

All times shown according to UTC.

Time Nick Message
00:01 sri \o\
00:01 sri /o/
00:02 sri i can also make ->next and ->previous jump to the next element (not node)
00:07 jberger_ joined #mojo
00:08 nicomen I was thinking about this earlier when dreaming about this to happen, does it make sense to have a modifier in the next/prev calls to behave in a CSS way or DOM way?
00:09 nicomen or is the *_sibling thing enough?
00:17 sri sooo... ->wrap works too for text nodes :)
00:27 jack joined #mojo
00:34 marty joined #mojo
00:42 stokachu im trying to connect to a secure websocket, I've got IO::Socket::SSL installed along with the following code https://gist.github.com/battlemidget/8947591
00:43 stokachu the error in the comment is what im seeing and im not sure what i could be missing
00:43 stokachu the server supports RFC 6455 of the websocket spec
00:49 jberger joined #mojo
00:53 s1037989_ stokachu: Is $tx = pop right or should it be $tx = $_[1]?
00:54 stokachu s1037989_: i tried that way just now with some error result
00:54 stokachu same*
00:55 buu stokachu: Where are you getting the idea that you should call $tx->send?
00:57 stokachu buu: isnt the websocket a Transaction::WebSocket?
00:58 buu stokachu: Apparently not
00:58 buu stokachu: print $tx->is_websocket
00:59 stokachu hmm its returning a Mojo::Transaction::HTTP object
00:59 stokachu do i have to force upgrade the connection first?
00:59 laouji joined #mojo
00:59 buu Apparently
00:59 stokachu even when I do a Mojo::Transaction::WebSocket->new it still returns the HTTP transaction
01:00 buu The example seems to imply it should happen automatically
01:00 buu stokachu: Can you test a ws:// connection?
01:00 stokachu the server only supports wss unfortunately
01:01 stokachu maybe the client is only meant for browser transactions and not direct rpc calls over the socket
01:02 buu Hrm
01:02 buu 492 The original handshake transaction, defaults to a L<Mojo::Transaction::HTTP>
01:02 stokachu hmm let me force a websocket transaction
01:02 stokachu see if that makes a difference
01:04 * buu casts summon sri
01:05 buu So the actual code is
01:05 buu 141   my $tx = $self->tx(GET => @_);
01:05 buu 149   Mojo::Transaction::WebSocket->new(handshake => $tx)->client_handshake;
01:05 buu 151   return $tx;
01:08 stokachu ok so that probably wont work for doing RPC
01:09 buu Dunno, the cookbook example seems reasonable
01:09 buu If you can figure out how to get an actual Websocket
01:09 stokachu im messing around with the handshake to see if i can get further
01:13 buu http://showmetheco.de/articles/2012/11/testing-websockets-from-console.html
01:14 d4rkie joined #mojo
01:14 buu stokachu: https://metacpan.org/source/KRAIH/Mojolicious-0.999922/lib/Mojo/Client.pm#L257
01:14 stokachu looking
01:15 s1037989_ Mojo::UserAgent->new->websocket('ws://127.0.0.1:17070/' => sub {
01:15 s1037989_ That didn't generate the error for me but the original code did.
01:16 stokachu lemme test that
01:19 s1037989_ Or closer to the original still works Mojo::UserAgent->new->websocket($endpoint => sub {
01:19 stokachu is that only for ws and not wss?
01:20 s1037989_ That could be.  I'm only testing ws.  But ws generated the same error as you for me with your code.
01:20 s1037989_ Just tested wss, no error.
01:21 stokachu ok trying that
01:21 s1037989_ Back to the original yields Mojo::Reactor::EV: Read failed: Can't locate object method "send" via package "Mojo::Transaction::HTTP"
01:21 nicomen 0.999922?
01:22 s1037989_ Mojo::UserAgent->new->websocket yields no response whatsoever and just dies.
01:22 s1037989_ Well, doesn't die... exits.
01:22 stokachu yea im not seeing any activity from the server either
01:22 stokachu i tried this way as well https://gist.github.com/battlemidget/8947999
01:24 stokachu running that wsconsole from Protocol::WebSocket doesnt detect the version the server is running on
01:25 stokachu this is a working example from a python implementation: https://gist.github.com/battlemidget/8948180
01:26 stokachu that library uses the RFC 6455 specification as well
01:27 good_news_everyone joined #mojo
01:27 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/TNtHWA
01:27 good_news_everyone mojo/master 3e9cfa8 Sebastian Riedel: merged Mojo::DOM::Node into Mojo::DOM
01:27 good_news_everyone left #mojo
01:27 sri \o/
01:27 sri so much works now
01:28 sri surprisingly... $text_node->ancestors was one of the hardest to get working :o
01:28 sri and no backcompat breakage at all :)
01:28 nicomen wow ;)
01:29 stokachu sri: when accessing a websocket endpoint over wss https://gist.github.com/battlemidget/8947591 am I missing a forced handshake of Transaction::WebSocket?
01:30 sri no websockets for me today... just Mojo::DOM
01:31 TitanOfOld joined #mojo
01:31 sri this fake element is rather funny... but i couldn't think of a better solution ;p https://github.com/kraih/mojo/blob/master/lib/Mojo/DOM.pm#L272
01:34 nicomen explain?
01:34 sri too burned out
01:39 nicomen np
01:41 jberger Anyone having trouble getting a web socket handshake: http://mojolicio.us/perldoc/Mojolicious/Guides/Routing#WebSockets
01:43 jberger stokachu: ^^
01:43 jberger use the controller
01:44 s1037989_ stokachu: Digging a little deeper, I found that for me my URL in the code client code wasn't point to a websocket route on the server.  Once I updated the URL I now get Mojo::Transaction::WebSocket instead of HTTP.
01:45 jberger Oh nm, you are connecting as a client
01:46 jberger I have had similar messages on the server side, in which case my pointer would be useful
01:46 jberger But nm
01:49 marty joined #mojo
01:49 stokachu s1037989_: so you have control over the server websocket code though?
01:50 stokachu where you can add a route like what jberger mentioned?
01:50 s1037989_ Yeah, I have a websocket server that I've been working on.
01:50 stokachu ok, i dont have access to the server code for the websocket portion
01:51 stokachu just connecting as a standalone client
01:52 mattastrophe joined #mojo
01:52 stokachu so i tried to force the transaction be websocket with this code: https://gist.github.com/battlemidget/8947999
01:53 s1037989_ Can you build yourself up a quick server?  $r->websocket('/server' => sub { my $self = shift; });
01:53 ka2u joined #mojo
01:53 stokachu sure ill start one up and test against it
01:56 s1037989_ stokachu: Also, $tx->send({json => {"RequestId" => 1, "Type" => "Login"}});
01:56 s1037989_ I think the json needs to be a hash reference not an array.
01:57 stokachu ok ill change that
01:57 s1037989_ http://search.cpan.org/~sri/Mojolicious/lib/Mojo/Transaction/WebSocket.pm#send
01:58 good_news_everyone joined #mojo
01:58 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/J38hpg
01:58 good_news_everyone mojo/master dedc64c Sebastian Riedel: fixed XML mode bug in Mojo::DOM
01:58 good_news_everyone left #mojo
02:00 stokachu so that works and if the route is a websocket route it changes the handshake properly
02:01 s1037989_ Yeah, it's all working for me.  The client code gets back a json hash from the server.
02:02 stokachu so it must be how the client is attempting to interact with the server over wss perhaps
02:02 s1037989_ oh yeah lemme try that
02:03 s1037989_ Still good with wss
02:03 stokachu ok so maybe b/c of the lack of a route i need to force the handshake properly
02:04 s1037989_ I wouldn't know how to do it without a route.  Is it not a Mojo server?
02:04 stokachu unfortunately its not
02:04 stokachu its a golang jsonrpc interface over a websocket
02:04 s1037989_ The mojo server needs to understand that it can accept a websocket on a specific path.
02:05 s1037989_ Gotcha.
02:05 s1037989_ Yeah, not sure how that translates.
02:05 stokachu but you helped narrow it down so thank you :)
02:05 stokachu i think i need to do some manual settings of the handshake
02:06 s1037989_ Are you sure you're pointing to a correct URL at :17071/ instead of :17071/some/path?
02:06 s1037989_ Glad I could help a small amount!  :)
02:06 stokachu yea b/c the python code i used works as expected
02:06 s1037989_ Interesting!
02:06 stokachu https://gist.github.com/battlemidget/8948180
02:06 stokachu going to dig through that ws4py library and see what im missing
02:07 s1037989_ Well I see...  it's Stupid().  :D
02:07 stokachu haha, shows my frustration with websockets
02:08 sri http://mojolicio.us/perldoc/Mojo/UserAgent#websocket
02:08 s1037989_ Haha!
02:08 sri http://mojolicio.us/perldoc/Mojo/UserAgent#DEBUGGING
02:08 stokachu yea i ran the debug env and it shows the connection being upgraded to a websocket
02:09 stokachu everything *looks* right but im still not getting a response from server
02:09 sri http://mojolicio.us/perldoc/Mojo/Transaction/WebSocket#DEBUGGING
02:11 s1037989_ My server code is simply: sub websocket { $self->tx->on(json => sub { my ($ws, $json) = @_; say $json; $ws->send({json => $json}); }); }
02:11 mixMonkey joined #mojo
02:12 stokachu i originally tried: https://gist.github.com/battlemidget/8948734
02:13 stokachu using the useragent from the example in the docs
02:14 sri perhaps you should provide more information, such as the output of MOJO_USERAGENT_DEBUG
02:14 klapperl_ joined #mojo
02:15 s1037989_ stokachu: with that last gist I got: WebSocket message: Hello! where my Server on frame ->send("Hello!")
02:15 stokachu sri: it is in that gist i just pasted
02:16 stokachu s1037989_: yea i can get that to work with a mojo server hosting the websocket route
02:16 sri 403 Forbidden
02:17 s1037989_ Stupid() python.  :D
02:21 stokachu yea it returns 403 forbidden but i never see it attempting to access the rpc server
02:22 stokachu also the code uses $tx->is_websocket; but that doesn't exist b/c the transaction is HTTP
02:23 sri what you say makes very little sense
02:23 sri the server tells you 403 forbidden, so you did not send authentication information it expected
02:23 sri 403 forbidden is a failed handshake
02:23 stokachu the server doesn't even log that i made a connection
02:25 stokachu it never makes it to sending the authentication
02:25 stokachu it dies at say 'WebSocket handshake failed' and return unless $tx->is_websocket;
02:25 stokachu $tx->is_websocket isn't a valid method since the Transaction being used is Mojo::Transaction::HTTP
02:26 stokachu https://gist.github.com/battlemidget/8948734#file-websocket3-pl-L11
02:26 stokachu thats where it returns at
02:26 sri that makes no sense at all
02:26 sri ->is_websocket is always a valid method
02:27 sri if it isn't then you really messed up big time
02:27 sri and you're not showing us everything
02:28 s1037989_ stokachu: L11 means ->is_websocket is false, or 0, or $tx isa Mojo::Transaction::HTTP
02:28 s1037989_ Which is happening because the handshake failed because of the 403
02:28 * sri goes back to Mojo::DOM hacking
02:29 stokachu sri: https://gist.github.com/battlemidget/8948917
02:30 stokachu that shows the debug info plus where im seeing the Transaction::HTTP on line 71
02:30 stokachu but it returns at line 72 so the rest of the code isn't accessed
02:31 stokachu s1037989_: ah ok
02:31 s1037989_ Does that make sense?
02:31 stokachu s1037989_: yea that does now
02:31 s1037989_ So if you could pass authorization, perhaps all would be good?
02:32 stokachu so send the authorization at an earlier stage?
02:32 s1037989_ With the connection, yes, I'd think.
02:32 s1037989_ Is the server just expecting a u/p?
02:33 s1037989_ Why is it forbidding you?
02:33 stokachu https://gist.github.com/battlemidget/8948917#file-websocket4-pl-L56-L65
02:33 stokachu so that is what it expects in json format
02:33 stokachu those are the same params i use in the python code that works
02:34 stokachu i was under the impression the connection would be established without a u/p and then you could send your credentials over the socket
02:34 sri so what does the python handshake look like?
02:35 stokachu one sec lemme re-run it
02:42 stokachu bah this library doesn't have great logging capabilities
02:45 stokachu anyway im tired now ill pick this back up tomorrow, thanks all
02:50 good_news_everyone joined #mojo
02:50 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/wn4qgQ
02:50 good_news_everyone mojo/master 9989bd9 Sebastian Riedel: removed workaround that is now obsolete
02:50 good_news_everyone left #mojo
02:52 sri that was a surprisingly successful day :D
02:52 sri like a dozen new Mojo::DOM features, less lines of code than before, and not a single broken test
02:54 s1037989_ Congrats, sri!!  That's fantastic!  It was fun to watch your mind at work thru at all!
02:54 sri so you could see all that smoke coming out of my ears? ;p
02:59 s1037989_ Ha!  Umm... yes.
03:25 rem_lex joined #mojo
03:25 omega joined #mojo
03:47 GabrielVieira joined #mojo
03:49 laouji joined #mojo
04:04 good_news_everyone joined #mojo
04:04 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/nyIWlA
04:04 good_news_everyone mojo/master 94f6cfa Sebastian Riedel: added WebSocket recipe to the user agent section of the cookbook
04:04 good_news_everyone left #mojo
04:08 russum1 joined #mojo
04:21 russum joined #mojo
04:21 Bravo13 joined #mojo
04:26 ka2u joined #mojo
04:32 laouji joined #mojo
04:35 good_news_everyone joined #mojo
04:35 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/RgMMgA
04:35 good_news_everyone mojo/master 8854bca Sebastian Riedel: added last method to Mojo::Collection
04:35 good_news_everyone left #mojo
04:35 sri i know it's cosmetics... but now that we have these hardcore tree walking features, i think ->[-1] would be a common sight
04:38 russum1 joined #mojo
04:57 zM joined #mojo
05:15 Stefan joined #mojo
05:28 zM joined #mojo
05:36 zackiv31 joined #mojo
05:56 good_news_everyone joined #mojo
05:56 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/8V18hw
05:56 good_news_everyone mojo/master d2aaa98 Sebastian Riedel: added a few examples for new Mojo::DOM features
05:56 good_news_everyone left #mojo
05:58 good_news_everyone joined #mojo
05:58 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/kBEcOQ
05:58 good_news_everyone mojo/master 662d7bc Sebastian Riedel: use last method in Mojo::DOM example
05:58 good_news_everyone left #mojo
06:01 hesperaux_ joined #mojo
06:02 tempire \o/
06:04 sri \o\
06:04 sri /o/
06:08 jnbek joined #mojo
06:08 rem_lex joined #mojo
06:14 laouji joined #mojo
06:37 davido_ tempire: Thanks for the proposal. We're excited about it.
06:51 d4rkie joined #mojo
06:57 sri i'll be damned... i can actually change the dom structure already without breaking a test either!
06:58 sri i just have to put the reference to the parent after the content for non tag nodes
07:02 Vandal joined #mojo
07:04 czinczar joined #mojo
07:05 czinczar hows everyone doing?
07:05 jack joined #mojo
07:15 good_news_everyone joined #mojo
07:15 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/xwP72A
07:15 good_news_everyone mojo/master 47a1d32 Sebastian Riedel: store reference to parent with all nodes
07:15 good_news_everyone left #mojo
07:16 entro joined #mojo
07:18 jack joined #mojo
07:22 jack joined #mojo
07:22 good_news_everyone joined #mojo
07:22 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/FPoylg
07:22 good_news_everyone mojo/master b2170e8 Sebastian Riedel: test parent link of text nodes
07:22 good_news_everyone left #mojo
07:22 jack joined #mojo
07:23 jack joined #mojo
07:23 sri i think there might be a tiny performance regression, due to the _node() function overhead
07:24 sri might cancel out the performance gain from the optimization yesterday :/
07:26 jack joined #mojo
07:30 sri haha, twitter has their own sinatra clone now https://github.com/twitter/finatra
07:30 jack joined #mojo
07:30 basiliscos joined #mojo
07:31 czinczar can twittre die soon?
07:31 czinczar I preferred aol chat to twitter, which seems like a ad launcher to me
07:32 czinczar :)
07:32 czinczar I think chat needs to come back
07:33 sri the render chaining is kinda cute... in mojolicious that would look like $self->render->text('Hello Mojo!')->status(201);
07:39 dod joined #mojo
07:44 abra joined #mojo
07:50 czinczar anyone got a mojo site I can see?
07:50 czinczar :)
07:53 batman czinczar: mojolicio.us, grumpify.com, thorsen.pm, getbetsy.com...
07:58 moritz konzertgeek.de
07:59 moritz (German only, sorry)
08:02 czinczar hmmmmmm
08:03 czinczar any open forum kind of site on mojo?
08:03 * moritz should continue to work on meatpan eventually
08:03 czinczar something like politicalforum.org or getbig.com forums?
08:05 moritz czinczar: the wiki on https://github.com/kraih/mojo/wiki somewhere has a link of public mojolicious projects
08:05 moritz I don't know them by heart :-)
08:05 moritz https://github.com/kraih/mojo/wiki/Projects-and-Companies-Using-Mojolicious
08:07 Lee joined #mojo
08:08 Lee_ joined #mojo
08:13 czinczar can the mighty hypnotoad run naked or is it better to have like cherokee in front?
08:17 czinczar http://mojolicio.us/perldoc/Mojo/Server/Hypnotoad read read
08:17 czinczar this is so cool!
08:18 marty czinczar:  we run hypnotoad facing world and it handles 10k+ requests per hour and it has never even burped.
08:19 czinczar how many does that boil down to per second?
08:19 eseyman joined #mojo
08:19 czinczar like if I have a machine 192G ram 24 cpu and 2T radi 5 crapdisks
08:19 czinczar could I handle 900 users?
08:20 czinczar whats the slowest part?
08:20 moritz the database
08:20 purl the database is not btilly's choice.
08:20 moritz purl: forget the database
08:20 purl moritz: I forgot database
08:20 marty per second calculation to easy to explain. others are subjective
08:20 moritz czinczar: the web application itself will easily handle 10k users on such a machine; the question is really how much time you spend in the backend
08:20 czinczar but it can obviously handle heavyduty prod use like any java or .net seteup
08:21 czinczar my current company I think has about 900 actives ata time
08:21 czinczar and I am not even sure thats 900 like pound the db users
08:21 czinczar so much as 900 like make easy read querier or upload a resume kinda users
08:22 czinczar takes them 11 machines
08:22 czinczar sad ass
08:22 czinczar and a 1t RAm db box
08:22 czinczar I am beginning to think thier software stinks
08:23 moritz well, we did a database consulting for a client who runs some pretty heavy online shops
08:24 moritz and their DB slowlog scrolled as fast as the terminal could handle it
08:24 moritz turned out they stored sessions in the DB, and didn't have an index on the session ID
08:24 marty ouch!
08:24 moritz and other such fun
08:24 czinczar lol
08:25 marty full table scans are fun
08:25 mire_ joined #mojo
08:25 moritz like the also logged the requests, about 1k meta data per request
08:25 kwa czinczar: Add sane cache headers, and use a reverse proxy to hypnotoad. You'll handle many more requests.
08:25 czinczar funny my cmopany has a db called seesiondb!
08:25 czinczar lol
08:25 moritz and then ran queries with LIKE over that to find out which browser the visitors used
08:25 czinczar lolz
08:25 czinczar I am not good enuf to recognize like as bad but I bet its a bad move
08:26 moritz it's simply something you don't do in the db
08:26 marty whithout an index, it's as bad as it gets
08:26 czinczar sane cache headers, hm so then what stuff stays in like memcache or varnish or some kinda cache app? redis mabye?
08:26 moritz you let the webserver write the logs, and then run a dedicated log analyzer over it
08:26 czinczar wow
08:26 kwa It depends on the actual usage of like. LIKE 'bla%' isn't terrible with an index.
08:26 czinczar what do you guys cache with ? or let me guess mojo has something?
08:27 marty kwa: that's true
08:27 moritz kwa: well, since they didn't even have a index on the session ID, do you believe they had an index on that column? :-)
08:27 kwa czinczar: nginx/varnish
08:27 czinczar zomg
08:28 kwa moritz: haha
08:28 czinczar varnish I heard is sikkkk
08:28 marty I'm so mongodb oriented these days I almost forget how to write sql
08:28 kwa :)
08:28 czinczar lol they use that a LOT at my work, rs.status() !
08:29 marty goog thing I need a few sql tables for some other stuff.  otherwise, i'd be screwed.  :)
08:29 czinczar and what funny is they just wante install hex or some mongodb indeex suggestion app
08:30 czinczar I mean if I was a developer I would read up a tad on such things b4 putting the bugger in production.
08:30 czinczar call me crzy
08:31 kwa marty: I've read of advantages of using an RDBMS to store the absolute data, and using it to populate elasticsearch or similar for performance gains. Do you use anything like this, or straight up mongo?
08:32 marty kwa:  right now, straight up mongo.  But our data requirements are pretty minimal.
08:32 czinczar 3 node cluster or just 1?
08:32 czinczar mojo + mongo?
08:33 marty 3 node and yes
08:33 czinczar nice!
08:33 jack joined #mojo
08:33 marty mongo is interfaced via mango (the awesome mojo spinoff project)
08:33 trone joined #mojo
08:37 odc joined #mojo
08:47 rawler joined #mojo
08:51 eugen joined #mojo
08:52 czinczar mango lol
08:52 czinczar is there any perl thing that is like redis or mongo ro cassandra? or hek zodb?
08:52 gnephiak joined #mojo
08:53 dod joined #mojo
08:53 moritz there are perl frontends for redis
09:01 fhelmber_ joined #mojo
09:03 Negor joined #mojo
09:07 bowtie_ joined #mojo
09:07 maxhq joined #mojo
09:13 batman czinczar: Mojo::Redis, Mandel, Mango, ...
09:14 eseyman czinczar,  there's a mongodb module on cpan
09:14 batman or do you mean the backend database?
09:14 czinczar yeah
09:14 czinczar like zodb
09:17 bowtie joined #mojo
09:17 czinczar or prevayler
09:17 purl hmmm... prevayler is http://www.prevayler.org/wiki.jsp
09:17 czinczar something to replace sql db completely..
09:22 denis_boyun joined #mojo
09:26 batman why do you want to do that..?
09:26 batman doesn't make any sense
09:31 jack joined #mojo
09:33 bowtie joined #mojo
09:38 bowtie_ joined #mojo
09:41 denisboyun joined #mojo
10:09 GabrielV_ joined #mojo
10:12 Lee joined #mojo
10:15 Stefan joined #mojo
10:15 dvinciguerra joined #mojo
10:20 GabrielVieira joined #mojo
10:26 radixo joined #mojo
11:06 ver joined #mojo
11:21 radixo_ joined #mojo
11:39 GabrielV_ joined #mojo
11:42 denisboyun joined #mojo
12:06 d4rkie joined #mojo
12:16 bowtie joined #mojo
12:17 skullbocks joined #mojo
12:17 bowtie_ joined #mojo
12:24 d4rkie joined #mojo
12:26 GabrielVieira joined #mojo
12:40 bowtie joined #mojo
12:43 dod joined #mojo
12:57 russum joined #mojo
13:01 mire_ joined #mojo
13:13 bowtie joined #mojo
13:13 GabrielV_ joined #mojo
13:20 bowtie joined #mojo
13:21 nicomen joined #mojo
13:34 skullbocks joined #mojo
13:35 bowtie joined #mojo
13:36 dvinciguerra joined #mojo
13:42 mattastrophe joined #mojo
13:43 jberger_ joined #mojo
13:45 cleverfox joined #mojo
13:56 Insane joined #mojo
13:56 Insane hi all, could anyone help with strings encoding in mojo::lite?
13:57 moritz we can try, if you ask an actual question
13:57 sh4 joined #mojo
13:59 Insane so i have this code: http://pastebin.com/FzF9WCYs and this URI (/addcomment) is called from form with one text-field and submit button. if I type text in russian in this field - app craches witj lots of errors: Mojo::Reactor::EV: Write failed: Wide character in syswrite at /usr/lib/perl/5.14/IO/Handle.pm line 218.
14:00 Insane if I type in english - there are no errors and all goes well
14:01 Insane I've tried to google it, and as I understood the problem is somewhere in encoding from Perl unicode to actual utf-8, but what could I do?
14:04 moritz Insane: Dumper is from Data::Dumper, I assume?
14:04 bowtie_ joined #mojo
14:04 Insane yes
14:04 moritz Insane: try adding   $Data::Dumper::Useqq = 1;  and see if the result looks like decoded text strings, or rather like UTF-8
14:06 Insane hm, with this line there is no errors, and russian 'óàóàó' becomes a "\x{443}\x{430}\x{443}\x{430}"
14:06 moritz for example, if you post a Euro sign €, does it come out as \x{20ac} or as \342\202\254 ?
14:06 moritz ok, so decoded string
14:07 meshl joined #mojo
14:07 Insane I'm using Dump here for debugging purposes, in fact I have to call external API with this string as an agrument
14:07 moritz yes, I understand
14:08 moritz let me try something ...
14:08 moritz huh, it works for me here
14:09 moritz Insane: what version of Mojolicious are you using?
14:09 Insane last, I suppose, I've installed it a month ago
14:09 Insane how could I check?
14:09 moritz 'mojo version'
14:09 Insane CORE
14:09 Insane Perl (v5.14.2, linux)
14:09 Insane Mojolicious (4.72, Top Hat)
14:10 nicomen Insane: are you actually getting the write error using the action you pasted in the gist with Dumper($body) ?
14:10 moritz Insane: well, a simple   $self->render(text => "\x{443}\x{430}");  doesnt' exhibit the problem here
14:10 moritz Insane: so I think the error is somewhere else
14:11 nicomen moritz: did you try:  $self->render(text => "foo" . "\x{443}\x{430}");
14:12 Insane hm...
14:12 moritz Insane: maybe start PERL5OPT=-MCarp::Always (install Carp::Always) if necessary to get  a stack trace
14:12 Insane cheked right now
14:12 Insane if I'm not calling API - everything is fine
14:12 trone joined #mojo
14:12 moritz nicomen: no; why should I?
14:12 Insane if I'm passing $body into API request - it falls
14:13 Insane but the error comes from Mojo somehow
14:13 Insane huh... becouse I'm requesting API via http with Mojo::UserAgent
14:14 Insane ok, looks like the problem is somewhere in my Mojo::UserAgent code... I should return to code to investigate it
14:14 radixo joined #mojo
14:16 dvinciguerra joined #mojo
14:17 cleverfox joined #mojo
14:27 jberger_ Insane, is utf8 turned on in your user agent code
14:27 jberger_ ?
14:28 jberger_ Mojo::Base does that for you, but I'm guessing that your ua code only does the traditional strict and warnings (and hopefully it does that much)
14:30 Adura joined #mojo
14:30 bluescreen joined #mojo
14:33 eugen_ joined #mojo
14:50 ka2u joined #mojo
14:53 btyler joined #mojo
15:09 arthas joined #mojo
15:25 skullbocks joined #mojo
15:26 Adurah joined #mojo
15:27 Stefan joined #mojo
15:29 skullbocks joined #mojo
15:39 radixo_ joined #mojo
15:39 * sri is so happy with the new Mojo::DOM o/
15:40 nicomen \o
15:41 marty sri++
15:41 sri a few new features for anyone who might have missed it https://github.com/kraih/mojo/commit/d2aaa98e2f132b543b5b031bdda285a821662898
15:43 mudler sri++ batman++ # i love convos
15:48 kwa Pretty nice!
15:52 gryphon joined #mojo
15:55 Stefan joined #mojo
16:00 sri diegok: the boolean attribute thing is even more complicated btw. <input checked>, <input checked="checked"> and <input checked=""> are all equal
16:00 diegok omg!
16:00 diegok sure... and in my parsing case it's even more complicated...
16:01 diegok the site I'm crawling has <input checked/ name="xxx">
16:01 diegok and it works on the browser!
16:01 diegok :-(
16:01 sri lol, that's just wrong
16:01 diegok sure!
16:01 diegok but I should asume its right :-(
16:02 diegok hate my work some days...
16:02 diegok I don't expect Mojo::DOM to work on that case.. but still think it shuld on the 3 cases you've pointed.
16:03 sri "work" is relative
16:03 diegok sure.. :-/
16:03 diegok work the way I've asked yesterday :)
16:03 sri in my opinion it does "work" for all those cases
16:03 diegok and yes... yesterday is also relative :)
16:04 diegok it works because I can ask for existence of attr->{checked}...
16:04 diegok right
16:04 diegok it works in the xml sense.
16:04 diegok you're right.
16:04 diegok it's predictable...
16:05 sri yes, exists is all you need, since it's boolean
16:05 diegok I think you've convinced me :-o
16:05 sri attr->{checked} = 'false' would be invalid, the only way to set a boolean attribute to false it not to include it at all
16:06 sri if it exists it is true
16:06 diegok you're completely sure there is no other way?
16:06 sri like?
16:07 diegok checked="off", checked="0", something like that...
16:07 diegok I should try instead of ask!
16:07 diegok but it sound to me...
16:07 sri i am because i have the superpower of reading the spec ;p
16:08 sri http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#boolean-attributes
16:08 diegok well... but you know browsers don't need that superpower to win the fight... :-/
16:08 sri ="off" would simply be invalid
16:08 diegok you know, there are very imaginative pple there in redmond :D
16:09 diegok but.. I'll take this as THE TRUE till I can prove it wrong :D
16:09 sri now i want a concrete example for browsers misbehaving
16:10 diegok sure!, me too.
16:10 sri making things up does not contribute to the discussion
16:11 diegok off course... sorry. :-(
16:22 sri parsing reddit 100 times results in 5848742 subroutine calls :o
16:23 sri profiler says the hotspot is CORE::match, i guess that's good
16:25 sri 257ms for Scalar::Util::weaken :S
16:25 nicomen re: <input checked/ foo>; doesn't most browsers implement HTML5 parsing rules, and isn't that what Mojo::DOM uses too?
16:26 batman mudler: sri made mojo, me and marcus made mojo-irc, mojo-redis and convos
16:26 batman sri++ # <3 mojo
16:26 mire_ joined #mojo
16:27 diegok nicomen: it works on last chrome, ff and IE8 (that's all I know) :-(
16:27 batman hm... "made" sounds like we're done... we're not don at all. at least not with convos
16:28 sri Mojo::DOM does not use the html5 parsing rules, just follows them when convenient
16:28 nicomen sri: ah
16:28 nicomen btw. loved the new version ;)
16:28 diegok nicomen: and Mojo::DOM parse it just right... but I need to be aware and check for $dom->attr->{'checked/'} tho
16:29 sri a) Mojo::DOM has to support XML too, b) html5 parsing rules would be slooooooooooow in pure perl, c) they would be at least a few thousand lines of code
16:29 nicomen oh, I would expect 'checked' / just ends a tag ;)
16:29 nicomen sri: understand ;)
16:30 diegok nicomen: I'm scrapping really nasty sites for the last year+ and Mojo::DOM is fucking good for all nasty things I need :-)
16:31 diegok nicomen: and when I say nasty, I mean it :-(
16:33 fhelmber_ joined #mojo
16:36 nicomen javascript:document.body.innerHTML = '<input id="foo" type="checkbox" checked/ lol>'; console.log(document.getElementById("foo").checked); # true ;-)
16:38 ka2u joined #mojo
16:43 Dandre joined #mojo
16:54 sri the html5 rules just say to ignore a / between attributes http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#attribute-name-state
16:55 sri but it's rather inconvenient to support, patches welcome (as long as they don't cost much)
17:04 sri hmm, actually it's pretty easy to make work ;p
17:06 sri just a slightly stricter regex
17:07 Jeff joined #mojo
17:08 andrefs joined #mojo
17:11 purl joined #mojo
17:15 good_news_everyone joined #mojo
17:15 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/NL-uxA
17:15 good_news_everyone mojo/master 551ebfe Sebastian Riedel: improved Mojo::DOM::HTML to handle slash between attributes more gracefully
17:15 good_news_everyone left #mojo
17:15 sri diegok: ^^
17:15 diegok sri++ :)
17:20 drift joined #mojo
17:21 denisboyun joined #mojo
17:28 asarch joined #mojo
17:51 denis_boyun_ joined #mojo
17:57 sri sooo... no ideas how to make nested routes more pretty in the routes command?
17:57 sri perl -Mojo -E 'get "/lalala"; my $foo = app->routes->route("/foo"); $foo->post("/bar")->route("/baz"); $foo->route("/yada"); app->start' routes -v
18:03 tempire someone needs to make a prettier perl debugger with a nicer interface
18:03 good_news_everyone joined #mojo
18:03 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/Cfjo5A
18:03 good_news_everyone mojo/master b2b0be5 Sebastian Riedel: better attribute tests
18:03 good_news_everyone left #mojo
18:07 purl joined #mojo
18:12 mattastrophe joined #mojo
18:42 stokachu is there an equivalent event for websockets for when the socket is initially opened? would that be on connection?
18:42 zM joined #mojo
18:46 good_news_everyone joined #mojo
18:46 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/ZBSS3w
18:46 good_news_everyone mojo/master 84a6c86 Sebastian Riedel: documentation tweaks
18:46 good_news_everyone left #mojo
18:48 beyondcreed joined #mojo
19:06 Stefan joined #mojo
19:09 GabrielVieira joined #mojo
19:10 Stefan joined #mojo
19:15 Stefan joined #mojo
19:18 Stefan joined #mojo
19:20 Stefan joined #mojo
19:22 Stefan joined #mojo
19:34 s1037989__ joined #mojo
19:37 good_news_everyone joined #mojo
19:37 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/25czdA
19:37 good_news_everyone mojo/master f77d4f1 Sebastian Riedel: make append_content and prepend_content work with all node types
19:37 good_news_everyone left #mojo
19:37 Stefan joined #mojo
19:37 sri not important, but consistency is nice
19:40 good_news_everyone joined #mojo
19:40 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/FTNZug
19:40 good_news_everyone mojo/master 9ef5ac4 Sebastian Riedel: fixed typo in Mojo::DOM documentation
19:40 good_news_everyone left #mojo
19:41 sri i was just thinking theoretically append_content/prepend_content could be deprecated... but the fact that it works for empty elements too is quite useful
19:44 good_news_everyone joined #mojo
19:44 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/fn_TwQ
19:44 good_news_everyone mojo/master 534d463 Sebastian Riedel: fixed content example
19:44 good_news_everyone left #mojo
19:47 sri i guess everything else makes no sense for all node types https://github.com/kraih/mojo/blob/master/t/mojo/dom.t#L232
19:51 nicomen sri: how do you actually get the value "foo" out of it?
19:52 sri ->contents->first->content
19:53 nicomen maybe it belongs in the test for clarity?
19:53 sri that already has a dozen test
19:53 nicomen (it would emphasize that ->text won't go even more imho)
19:53 nicomen yeah, I thought you used the tests in an educational matter ;)
19:54 nicomen evermind me, just always suggesting unneccesary stuff
19:54 nicomen +n
20:10 GabrielV_ joined #mojo
20:13 mire_ joined #mojo
20:21 denis_boyun joined #mojo
20:38 lukep joined #mojo
20:42 bpmedley_ joined #mojo
21:02 meshl joined #mojo
21:26 dvinciguerra joined #mojo
21:29 doby tempire: seen -> https://metacpan.org/pod/Devel::hdb ?
21:39 meshl joined #mojo
21:41 skullbocks joined #mojo
21:42 Stefan joined #mojo
21:59 KindOne joined #mojo
22:03 good_news_everyone joined #mojo
22:03 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/MjwjLw
22:03 good_news_everyone mojo/master 8e8ffc2 Sebastian Riedel: more generic method descriptions for Mojo::DOM
22:03 good_news_everyone left #mojo
22:04 purl joined #mojo
22:05 mikegrb joined #mojo
22:06 tardisx joined #mojo
22:06 bluescreen_ joined #mojo
22:08 good_news_everyone joined #mojo
22:08 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/h_f0kA
22:08 good_news_everyone mojo/master db061d9 Sebastian Riedel: another contents example
22:08 good_news_everyone left #mojo
22:12 good_news_everyone joined #mojo
22:12 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/0qN3BA
22:12 good_news_everyone mojo/master 125e7db Sebastian Riedel: append and prepend methods deal only with HTML/XML fragments
22:12 good_news_everyone left #mojo
22:20 good_news_everyone joined #mojo
22:20 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/XdWzjA
22:20 good_news_everyone mojo/master 6264819 Sebastian Riedel: more ridiculous Mojo::DOM test
22:20 good_news_everyone left #mojo
22:34 GabrielVieira joined #mojo
22:43 GabrielV_ joined #mojo
22:50 GabrielVieira joined #mojo
23:03 GabrielV_ joined #mojo
23:22 Stefan joined #mojo
23:23 tempire oh dear
23:24 tempire that's ugly as well
23:25 tempire but at least a step in the right direction
23:53 Gedge joined #mojo

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