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

IRC log for #mojo, 2014-07-23

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

All times shown according to UTC.

Time Nick Message
00:49 laouji joined #mojo
00:53 sjn joined #mojo
01:03 meshl joined #mojo
01:04 mattastrophe joined #mojo
01:25 jberger what do you all think is the best way to pass a large data structure from an app to a javascript function?
01:25 jberger is it safe just jsonify it and use it as a literal in the template
01:25 jberger ?
01:25 sjn jberger: SOAP+WSDL? :)</justkidding>
01:27 * jberger runs screaming
01:39 firnsy jberger: that's what I do for my spa's, jsonify and use it directly in the template
01:40 firnsy i place it on the window scope initially and then when my angularjs code intialises i pull it off the window scope and into my angular components
01:47 klapperl joined #mojo
01:49 Kundun joined #mojo
01:51 KCL_ joined #mojo
01:51 dexteruk joined #mojo
01:51 laouji_ joined #mojo
01:52 Bravo13 joined #mojo
01:54 mr-fooba_ joined #mojo
01:54 LordVorp joined #mojo
01:57 bayashi joined #mojo
01:57 klapperl joined #mojo
01:57 inokenty joined #mojo
01:57 basic6 joined #mojo
01:57 odc joined #mojo
01:57 jnbek joined #mojo
02:00 d4rkie_ joined #mojo
02:18 hesperaux_ joined #mojo
02:29 Kundun joined #mojo
02:47 basic6 joined #mojo
02:48 Kundun joined #mojo
02:50 jnbek joined #mojo
02:50 bayashi joined #mojo
02:50 klapperl joined #mojo
02:50 inokenty joined #mojo
02:50 odc joined #mojo
02:50 LordVorp joined #mojo
02:50 woz joined #mojo
02:50 jberger_ joined #mojo
02:50 alnewkirk joined #mojo
02:50 KindOne joined #mojo
02:50 R0b0t1 joined #mojo
02:50 Jonis joined #mojo
02:50 shadowpaste joined #mojo
03:08 jb360 joined #mojo
03:08 LordVorp joined #mojo
03:12 jnbek joined #mojo
03:12 bayashi joined #mojo
03:12 klapperl joined #mojo
03:12 inokenty joined #mojo
03:12 odc joined #mojo
03:12 Jonis_ joined #mojo
03:12 woz joined #mojo
03:12 jberger_ joined #mojo
03:12 alnewkirk joined #mojo
03:12 KindOne joined #mojo
03:12 R0b0t1 joined #mojo
03:12 shadowpaste joined #mojo
03:20 hesperaux joined #mojo
03:55 sujithm joined #mojo
03:57 basic6_ joined #mojo
04:05 hesperaux joined #mojo
04:30 batman jberger: what's the alternative?
04:32 batman I do that, but I make sure it doesn contain any HTML tags.
04:32 batman At least most of the time...
04:52 KCL joined #mojo
04:57 D4RK-PH0ENiX joined #mojo
05:22 sujithm_ joined #mojo
05:26 odc joined #mojo
05:27 jnbek joined #mojo
05:27 bayashi joined #mojo
05:27 klapperl joined #mojo
05:27 inokenty joined #mojo
05:29 hesperaux joined #mojo
05:32 jnbek joined #mojo
05:32 Jonis joined #mojo
05:32 D4RK-PH0ENiX joined #mojo
05:32 woz joined #mojo
05:32 jberger_ joined #mojo
05:32 alnewkirk joined #mojo
05:32 KindOne joined #mojo
05:32 R0b0t1 joined #mojo
05:32 shadowpaste joined #mojo
05:34 bayashi joined #mojo
05:34 klapperl joined #mojo
05:35 inokenty joined #mojo
05:45 laouji joined #mojo
05:52 batman go perl tidy: http://p.thorsen.pm/2360ecf39bcc :(
05:52 batman any idea if there's some trick to make that format better? ^
05:53 WildPikachu wow, hurts to look at that batman!
05:53 batman i know...
05:57 batman i tried -nbot and -bot, but it doesn't seem to change anything...
06:02 batman it got a bit better with () around the lists
06:10 Vandal joined #mojo
06:10 denis_boyun joined #mojo
06:41 WildPIkachu_ joined #mojo
06:46 sujithm joined #mojo
06:56 rem_lex joined #mojo
07:11 dp_ joined #mojo
07:15 rem_lex|pivo joined #mojo
07:17 * sri yawns
07:22 neyasov______ joined #mojo
07:28 trone joined #mojo
07:30 neyasov______ joined #mojo
07:44 rawler joined #mojo
07:52 basiliscos joined #mojo
07:55 mire joined #mojo
08:01 avkhozov joined #mojo
08:06 sri hmmm... only thing i hate about the new react based editor in atom is that the buffer jumps when i perltidy :/
08:16 fhelmber_ joined #mojo
08:39 edestler joined #mojo
08:40 dod joined #mojo
08:47 mdom joined #mojo
08:47 laouji joined #mojo
08:49 mdom Hi! I'm trying for hours now to set the maximum message size for uploads with a post handler by setting MOJO_MAX_MESSAGE_SIZE
08:49 mdom It works with hypnotoad but not when i deploy the script as cgi under apache
08:49 mdom Is that to be expected?
08:50 bc547_ mdom: is your apache configured correctly for the message size you want?
08:51 mdom No, i expect that to work but i wanted to set it in Mojolicious so i can set it in one place regardless how and where i deploy
08:52 bc547_ mdom: wrong expectations :-)
08:52 mdom I use 'return $self->render( text => 'File is too big.', status => 413 ) if $self->req->is_limit_exceeded' in the post handler
08:54 mdom Heh, no i expect that i can set the max upload size in apache, but i wonder why it isn't possible in mojolicious. It can see the body size and it can still send out a 413 ... is there any technical reason that behaving that ways isn't possible under cgi?
08:55 * sri wonders why his textual icon is wearing a party hat today Oo
09:09 neyasov______ joined #mojo
09:18 elik joined #mojo
09:27 lb sri: https://twitter.com/textual/status/491672487709900800
09:33 sri ah \o/
09:40 lipizzan joined #mojo
09:46 * sri wonders if a method for extracting default values from a form would be nice
09:47 sri like my $hash = $ua->get('github.com')->res->form('#search'); or so
09:49 sri perhaps crossing the line...
09:51 batman what's the difference between form() and dom() ?
09:52 batman shorter..?
09:52 purl shorter is faster after a bit of google
09:53 sri it returns a hash with extracted form values
09:53 sri in the format that ->post(... => form => $hash) understands
09:53 mishantil sri: How would one target a specific form on a page? first use ->dom() w/ selector, then ->form()?
09:53 batman oh.
09:53 sri selector
09:53 purl selector is not giving me a 2GHz option
09:53 batman mishantil: form() takes a selector
09:54 sri you still have to extract the form url yourself though
09:55 batman sri: maybe form() could also make sense in testing. something like $t->get_ok("/some/form")->form_is({ name => '', country => 'no' });
09:55 batman forgot selector ^
09:55 mishantil Ah. I misunderstood then.
09:57 batman maybe $dom->find("#form")->val; could make sense? as in extracting the defaults as a hash from a from, a plain string from an input, default selected option from a select list
09:57 batman from = form
09:58 * sri shrugs
09:59 batman too complicated?
09:59 sri not sure Mojo::DOM is the rigth place for something like that
10:00 batman http://api.jquery.com/val/ <--- was thinking something like that
10:00 sri is there precedent? jquery? nokogiri? beautiful soup?
10:01 sri aah!
10:01 sri precedent in jquery is always good
10:01 batman they don't do form though, but i think that would be very useful as well :)
10:01 sri odd that i wasn't aware of it :)
10:02 sri yea, get hash for form makes perfect sense imo
10:02 batman i guess you're human after all ;)
10:02 batman does it make more sense to add val() to Mojo::DOM, since jquery has it?
10:02 sri that's why we pay you the big bucks ;p
10:02 * batman didn't get it :(
10:03 aleksey joined #mojo
10:04 sri it wasn't a very good joke
10:05 sri a play on you being on the core team and us not actually paying you
10:05 batman :)
10:05 sri anyway... i guess $dom->val would make sense for extracting form values
10:06 batman the simplest val() is $dom->find('input#foo')->{value};
10:06 sri ->{value}?
10:06 purl ->{value} is fine for retrieval
10:07 sri oh of course
10:07 batman :)
10:20 sujithm joined #mojo
10:25 sri i wonder how complex ->val would be
10:30 sri http://pastie.org/9414543 # suppose this is how one would start
10:35 batman why do you need "return undef unless my $e = $self->at(shift);" ?
10:35 batman isn't there a way to figure out if $self is already a single element?
10:35 sri ?
10:36 batman allowing $dom->at('#foo')->val;
10:38 sri ah
10:38 batman also, i gues _form() will also do $e->{value} if $e->type eq 'input'; ?
10:38 sri right, i did not think that through
10:40 * batman need to do some actual work
10:40 batman *meeting* *bbl*
10:42 sri http://pastie.org/9414564 # a naive implementation without checkbox and radio
10:46 geira joined #mojo
10:49 sri i need a better test form
10:50 sri http://pastie.org/9414577 # this might be pretty close to a full patch
10:50 mr-foobar joined #mojo
10:51 d4rkie joined #mojo
10:54 sri http://pastie.org/9414585 # so far so good
10:57 jalie joined #mojo
10:57 sri i kinda like it
10:58 sri really need edge cases for testing it though
10:59 batman sweet!
10:59 sri and a few +1 votes
11:01 basiliscos joined #mojo
11:03 batman i would really like if val() also did what the jquery.fn.val() does
11:04 batman sorry
11:04 batman i didn't read the last version
11:04 batman +1
11:04 purl 1
11:07 sri you're welcome to refine the patch
11:08 sri i'm also not sure how the documentation should explain ->val
11:08 sri http://pastie.org/9414616
11:09 dod joined #mojo
11:09 jalie joined #mojo
11:10 jalie joined #mojo
11:15 jalie joined #mojo
11:20 mattastrophe joined #mojo
11:21 jalie joined #mojo
11:25 jalie joined #mojo
11:26 neilhwatson joined #mojo
11:26 jalie_ joined #mojo
11:28 janliesendahl joined #mojo
11:28 jalie joined #mojo
11:28 janliesendahl joined #mojo
11:29 janliesendahl joined #mojo
11:31 batman i would pretty much steal the doc from jquery :)
11:34 janliesendahl joined #mojo
11:34 jalie joined #mojo
11:38 batman sri: not sure how to do it, but could you filter out which radio button is selected based on a group?
11:38 batman i guess you can't, since that would be an collection which need to be looped over..?
11:39 janliesendahl joined #mojo
11:39 jalie joined #mojo
11:41 janliesendahl_ joined #mojo
11:41 batman i think i would also rename "_form()" to "_val()", but that's not a big deal
11:41 D4RK-PH0ENiX joined #mojo
11:45 oetiker jberger I have been playing with running Mojo::IOLoop::ForkCall instances.  Ass soon as the second fork starts, the callback of the firs fork is called. Very odd. What am I doing worng: https://gist.github.com/oetiker/76186fbe55ec0a554de1
11:46 dod joined #mojo
11:47 batman oetiker: many things. you can't use "sleep" in non-blocking code. that defeats the purpose completely
11:47 batman also, your $fc object goes out of scope. you need to $c->stash(fc => $fc) or something to keep it alive
11:48 oetiker batman sleep is in the forked call ... that is the whole purpose of ForkCall
11:48 batman line 25...?
11:48 purl line 25 is : $Destroy->Call($obj->{handle});
11:49 oetiker that can be removed it does not change anything
11:49 oetiker ok keeping fc around will try that
11:50 Kripton joined #mojo
11:50 oetiker keeping fc in scope does not help either
11:51 sugar_ joined #mojo
11:51 jalie joined #mojo
11:51 janliesendahl_ joined #mojo
11:52 oetiker https://gist.github.com/oetiker/870f88c1910d06b69481
11:52 oetiker new gist without sleep in setup phase and with an array to keep fc in scope
11:52 oetiker still not working
11:52 purl see "doesn't work"
11:54 batman oetiker: ignore me. forkcall doesn't seem to work as i remembered it
11:54 oetiker batman: :)
11:54 jalie joined #mojo
11:54 janliesendahl_ joined #mojo
11:55 oetiker anyone knows how to use ForkCall to run multiple fork instances in parallel ?
11:58 batman what do you expect in the output?
11:59 oetiker the first return: is not supposed to happen
11:59 oetiker as you can see 1: has started sleep
11:59 oetiker but not ended sleep yet
11:59 oetiker still the callback is being called
12:00 oetiker the callback gets called again when the process really ends
12:01 oetiker but I think I know the problem
12:01 oetiker now
12:02 batman ok?
12:02 oetiker not clear how to fix
12:03 jalie joined #mojo
12:03 janliesendahl_ joined #mojo
12:03 oetiker the callback in the parent is called when the stream from the child closes
12:04 batman https://github.com/jberger/Mojo-IOLoop-ForkCall/issues/new :)
12:04 oetiker when the second child is forked this setting in the parent is inherited by the second child
12:04 batman jberger: also, are you sure all the callbacks gets the same number of results? looks like you're sometimes just sending $@ ..?
12:05 batman maybe it works if the ioloop is stopped first...
12:05 batman oetiker: do you have a github account?
12:06 janliesendahl_ joined #mojo
12:06 jalie joined #mojo
12:06 oetiker sure :)
12:06 oetiker ha ha
12:06 jberger oetiker: run forks immediately
12:06 oetiker hey jberger
12:06 jberger so it happens before you attach the finish handler
12:06 oetiker cool
12:07 oetiker one second ... creating a new gist
12:07 jberger and finish handlers are run at the completion of every run call
12:07 jberger if you want to have a per-call callback, pass it as the last argument
12:08 oetiker https://gist.github.com/oetiker/75c7f66c178f048ac285
12:08 oetiker look at the process numbers
12:08 janliesendahl_ joined #mojo
12:08 jalie joined #mojo
12:08 oetiker the callback of the first fork is called in the second child
12:09 oetiker I guess because the stream is forked and closed and thus runs the callback
12:10 jberger finish handler != callback
12:10 oetiker I heard you :)
12:10 oetiker let me change it ... I tried finish because the first form did not work
12:11 jberger sorry, I'm being a bit terse, I'm getting ready for work
12:11 batman jberger: i think you should do $self->ioloop->next_tick(sub { $self->_run(...) }); inside run() to avoid that bug
12:11 jberger I've pondered that
12:12 jberger I've also pondered removing the finish handler as I think people expect it to do something different
12:12 oetiker but the problem is the same
12:12 D4RK-PH0ENiX joined #mojo
12:12 oetiker if I use finish or the regular callback
12:12 oetiker the callback defined for the first fork gets run in the second fork
12:13 batman jberger: do next_tick() and "finish" will work as expected :)
12:13 jberger hmmm, maybe
12:13 batman oetiker: just use Mojo::IOLoop::ForkCall 'fork_call'; instead. the fork_call() function behaves like you expect
12:14 jberger batman: why is the function any different? because it forces the use of the callback form?
12:14 batman i suppose so
12:16 oetiker using the callback form ... https://gist.github.com/oetiker/bbd3e468b0d25815738c
12:16 oetiker still not working ...
12:17 oetiker not clear how todo the next_tick thing in my code ... will look at the source
12:17 batman oetiker: use this: http://p.thorsen.pm/074fe291204b
12:17 batman oetiker: you can't do next_tick. jberger need to fix that
12:18 jberger oetiker: what do you expect to happen?
12:18 oetiker batman your example fails in the same way
12:18 oetiker jberger I expect the callback to be called once when the fork is done
12:18 batman which version and os do you have
12:19 batman oetiker: it works for me. mojolicious 5.13, forcall 0.10
12:19 oetiker ubuntu 12.04 lts 3.8.0-3
12:19 batman s/forcall/M::IOLoop::ForkCall/
12:19 oetiker mojo 5.16 here
12:20 sri if in doubt use next_tick, rarely hurts
12:20 oetiker will try your exact code now ...
12:20 jberger oetiker: it is
12:20 batman sri ;)
12:20 jberger each instance calls its callback once
12:20 batman oetiker: did you say my code didn't work WITHOUT testing it first?
12:21 jberger oetiker: are you expecting this to sequentialize?
12:21 jberger also it seems that storable is failing again
12:21 jberger grrrr
12:21 oetiker batman just verified
12:21 oetiker jberger
12:22 oetiker batman it does not work
12:22 batman what's the output from my code?
12:22 oetiker but the storable failure is a red herring I think
12:22 oetiker (in cleanup) Mojo::IOLoop::Stream: Event "close" failed: Magic number checking on storable string failed at /usr/lib/perl/5.14/Storable.pm line 416, at /home/oetiker/checkouts/znapzend/bin/../thirdparty/lib/perl5/Mojo/IOLoop/ForkCall.pm line 80
12:22 oetiker m
12:22 oetiker the problem is that the callback from the first instance is called INSIDE the second instance
12:22 jberger batman did NOT verify that I see "oetiker: it works for me. mojolicious 5.13, forcall 0.10"
12:22 oetiker but this has no access to the sream
12:23 oetiker but this has no access to the stream
12:23 oetiker obviously and so storable complain bitterly
12:23 oetiker point is that the callback should not be called in the child but in the parent anyway and also not at this time but when the first child is done
12:24 oetiker it also does get called in the parent just fine ...
12:24 oetiker look at the PID numbers in my gist
12:25 batman are you absolutely sure you're running my exact code and not trying to be clever about it and puts it into a more complex setting?
12:26 jberger ok I'm interested now, but I REALLY have to go
12:26 batman this is not the point to be clever. do exactly what we (or you) say.
12:26 oetiker bye bye jberger
12:26 jberger batman: be nice :-)
12:26 oetiker batman I have
12:26 oetiker run your code
12:27 oetiker have you run mine ?
12:27 batman jberger: i think i am. i try not to waste anyone's time.
12:27 batman no. and i don't care about failing code. that's jberger's task.
12:27 batman i only care about solving your problem
12:28 batman but i think i need to give up, since i don't have your exact setup.
12:28 oetiker hmmm
12:28 oetiker batman which version of perl are you using
12:29 oetiker I tried with 5.14 (standard on ubuntu) and 5.16
12:29 batman oetiker: my code also works with forkcall 0.10 and mojo 5.16
12:29 batman nasty warning about "Magic number" but it still works
12:30 batman at least i get "my id is 1" followed by "my id is 2"
12:30 oetiker haaaa
12:30 oetiker so you do get the errror
12:30 batman it's not an error. it's a warning.
12:30 oetiker that 'nasty warning' is your die
12:30 batman it is? why does it work then?
12:30 oetiker die "PID $$: ".$@ if $@; # error
12:31 oetiker try this
12:31 _eugen joined #mojo
12:31 oetiker I guess there is an eval somewhere
12:31 batman i never get to that line $@ is false
12:31 batman i never get to that line. $@ is false
12:33 oetiker https://gist.github.com/oetiker/f9d26a4389ddd28ca438
12:33 batman sorry. either i don't get you, or you don't get me :(
12:33 oetiker batman look at my gist
12:34 lipizzan joined #mojo
12:34 oetiker can you run this ?
12:34 batman let me just get one thing clear: your code behaves as you expect right? the _first_ bug you came with (finish handler) is not an issue anymore..?
12:34 oetiker no it does not
12:35 batman let me rephrase.
12:35 oetiker I can make it work by detecting that the callback is being called out of context
12:35 oetiker but that is not really a good thing I would  say
12:35 batman if you use fork_call(...) instead of your original code, then it works? i mean, if you avoid the "finish" handler completely?
12:35 oetiker sigh
12:36 oetiker batman the code you created exhibits exactly the same issue as mine
12:36 oetiker with callback OR with finish
12:36 oetiker it does not matter
12:36 oetiker the problem is always the same
12:36 oetiker you even see it yourself
12:36 oetiker the complaint about the storable filing
12:36 batman that is not true in my world. my version (fork_call(...)) does not get called twice
12:37 oetiker batman do you see the stroable complaint ?
12:38 laouji joined #mojo
12:45 batman yes.
12:48 batman sri: do you think you need to force checking ":checked" when getting val() from an radio/checkbox?
12:48 batman (it doesn't behave the same as jquery then)
12:48 * batman creates an alternative
12:50 lipizzan joined #mojo
12:50 sri batman: please elaborate?
12:50 batman i think it will be easier if i make a patch... give me five/ten minutes
12:54 jberger_ oetiker: I'm expecting that batman was correct originally
12:54 laouji joined #mojo
12:54 jberger_ I need next_tick
12:55 jberger_ oetiker: you should be able to replicate
12:55 jberger_ Put the body of your for loop into a next_tick
12:55 jberger_ It should fix things
12:56 jberger_ I'm on the train platform now
12:56 jberger_ I will tinker further when I'm on and can get my laptop out
12:57 moritz train platform? is that still 32 bit?
12:57 moritz SCNR
12:57 genio It still surprises me that people use IRC from mobile devices.  I think I'd go insane on that small screen
12:58 Ralesk depends on the client :)
12:58 moritz I think I'd go insane with that small keyboard
12:58 Ralesk connectbot + irssi is nice (I mean, does what you expect) but super annoying on a phone :D
12:58 sri he could be using google glass and his irc window looks like a skyscraper
12:59 ilbot2 joined #mojo
12:59 Topic for #mojo is now 🐯 hear me roar | http://mojolicio.us | http://irclog.perlgeek.de/mojo/today
13:00 sri you could use voice
13:00 sri "OK Google, slap Ralesk with a large trout"
13:00 Ralesk :D
13:03 batman sri: http://p.thorsen.pm/095c106cac6c # don't hate me for renaming _form() to _val() :)
13:03 sri i hate you for renaming _form() to _val()
13:03 batman i haven't perltidy-ed the code either.
13:04 batman it was just supposed to be pastebin friendly :/
13:04 batman did you see the :checked changes i made? and i also added "option" + modifying the pod
13:04 batman this way it behaves more like jQuery's val()
13:04 sri wait
13:05 batman i move the "checked" check to only "form"
13:05 sri jquery .val() returns "foo" for the element <input type="radio" name="x" value="foo">?
13:05 batman yes
13:06 sri and option elements that are not selected... i see
13:06 batman try this in the chrome console on the mojo webpage: $('<input type="radio" name="x" value="foo">').val()
13:06 jberger_ oetiker: didn't fix it. Hmm
13:06 batman the "select" behavior is not the same either... *one moment*
13:07 * jberger_ has a brain irc implant
13:07 oetiker jberger_ you are trying the reset the ioloop in the child
13:07 oetiker and as you are doing that the stream is closed
13:07 oetiker and the callback registered to the stream close event is called
13:08 oetiker not trying ... you ARE resttting
13:08 batman sri: http://p.thorsen.pm/480000924514
13:09 batman ^ also jquery compat
13:09 jberger_ Hmm yes indeed removing reset causes it not to emit
13:09 sri batman: oh my, don't make patches for patches!
13:09 batman haha. ok. give me a sec :)
13:09 jberger_ Patch ALL the things!
13:10 batman sri: http://p.thorsen.pm/88526cef00c5
13:10 batman check out # "select"
13:10 oetiker jberger_ can I have a cookie now ?
13:11 oetiker I sometimes find it rather hard to report bugs with you guys
13:11 jberger_ I didn't get the problem
13:11 jb360 joined #mojo
13:11 oetiker jberger_ I guess yes ;)
13:12 jberger_ I was a little short with you though, i apologize
13:12 sri oetiker: if you prefer async commmunication you could have opened a github issue
13:12 * jberger_ almost had to choose between perl and showing
13:12 oetiker sri :)
13:12 jberger_ Showering
13:12 purl i guess Showering is optional, i suppose
13:12 sri irc is messy
13:13 jberger_ Especially if purl isn't showering
13:13 oetiker sri my track record with reporting mojo bugs via the issue tracker is equally depressing
13:13 jberger_ :o
13:13 batman sri: what do you think about the last "select" change? ...or any of the other changes for that matter :)
13:13 oetiker so I tried to interactive route thistime
13:13 jberger_ Well now that i understand, I'm not sure what i should do about it
13:13 sri batman: i think the code is getting a bit big
13:14 batman sri: i think it behaves exactly as jQuery.fn.val() now...
13:14 sri semantics seem sensible though
13:14 jberger_ I want to reset the ioloop
13:14 batman also, you don't get { select_input => [] } from $dom->at("form")->val;
13:14 batman sri: will you take it if i golf it down? ;D
13:15 oetiker jberger_ well I guess you could remove the registration for the close event someohow
13:15 batman what do you think about the documentation? does it make sense?
13:15 sri batman: it would sure improve the odds :)
13:15 oetiker just not figured a good way yet
13:15 * batman to the golfmobile!
13:15 sri i'm still on the edge about the feature as a whole (no problem with the semantics or implementation... just the concept)
13:16 sri you know, if it belongs in Mojo::DOM
13:16 sri will we get enough value (pun intended!) out of it
13:17 batman i think it's really nice to have one method to return value from a field.
13:17 batman the jQuery version has surely saved me a lot of time.
13:17 sri true, your changes made it a bit more versatile
13:19 jberger_ I can add 'return unless $buffer' to the stream close handler
13:20 jberger_ Which fixes it, but probably causes other problems
13:20 oetiker and is 'sad'
13:20 oetiker sort of fixing it after the fact
13:20 batman jberger_: why not one_tick?
13:20 jberger_ Doesn't fix it
13:21 * batman leaves the discussion
13:21 jberger_ batman: the second child is seeing the first child's stream close
13:22 batman because of reset() ?
13:23 jberger_ Ha!
13:24 jberger_ At the start of the parent store $$ and in the callback check that it is still the same
13:24 jberger_ Fixes it
13:24 oetiker so quitting the callback really early
13:24 jberger_ Yeah
13:24 oetiker ok fair enough
13:25 jberger_ Best i can do i think
13:25 jberger_ I think i will also put the next_tick in too
13:25 oetiker yea, removing the close callback from the stream seems a bit involved
13:26 oetiker rather deep in the bowls of ioloop
13:26 arthas joined #mojo
13:26 jberger_ Darn near impossible of the streams are a part of two different fc objects yours are
13:26 jberger_ As yours are
13:26 oetiker well there could be a class variable keeping track of them
13:27 oetiker my $streams
13:27 jberger_ Yea that's true
13:27 oetiker and then use this to cleanup
13:27 jberger_ Class variables and forking scare me more
13:27 batman class variables should scare you.
13:27 batman with or without forking :)
13:27 oetiker well IOLoop is a singleton
13:28 jberger_ oetiker: thanks
13:28 batman oetiker: it's still an object
13:28 jberger_ I will put this on cpan tonight
13:28 oetiker thanks!
13:28 oetiker while looking at your code
13:28 odc batman, do you plan to support Sentinel in Mojo::Redis2 ?
13:28 batman odc: what's that?
13:28 purl that is, like, probably what is biting you
13:28 mdom left #mojo
13:28 oetiker $self->ioloop->reset;  and Mojo::IOLoop->reset; seem redundant
13:28 batman sounds like something from the matrix...
13:29 jkg left #mojo
13:29 odc batman, the fail-over system for redis
13:29 batman oetiker: it's not.
13:29 odc http://redis.io/topics/sentinel-clients
13:29 batman oetiker: it doesn't have to be the same object
13:29 dotan joined #mojo
13:29 jberger_ It's not if you are using a different ioloop
13:30 jberger_ I could probably check if they are the same, but reseting twice doesn't hurt
13:30 oetiker yes, but why mess with Mojo::IOLoop then ?
13:30 batman odc: this is completely new to me. i have to look into it, but i really hope my design can add support for it later on.
13:30 batman odc: anything else will be a complete fail :)
13:30 basiliscos joined #mojo
13:31 oetiker but anyway ... not to bother
13:31 odc cool, I think it's an important feature
13:32 batman oetiker: because you have to make sure the child doesn't continue running any of the parent loop events
13:33 jberger_ If you have other ioloops then on your head be it
13:33 batman odc: i will come back to you when i understand more or if i don't understand anything :)
13:33 sri jberger_: you have an opinion about Mojo::DOM::val?
13:34 odc yeah, i'm also trying to understand it...
13:34 batman odc: haha ;)
13:34 batman awesome
13:35 batman sri: should val() return undef() if the form doesn't have any child nodes or if it could not be found?
13:35 batman i think maybe it should return undef()
13:35 sri empty hash seems fine
13:36 sri i would just end up doing ->val // {}
13:36 genio dear RHEL 7, why did you change eth0 to some seemingly random value that's apparently now ens192 on this install?  I hate you, genio
13:37 batman isn't that inconsistent with my "select" change? "return undef unless @values;"
13:37 sri no, but i think your code is incorrect
13:37 purl okay, sri.
13:38 batman sri: my code is "jquery correct" :)
13:38 sri doesn't .val() return the value instead of an array if there is only one value?
13:38 batman that is true
13:39 * lb is working on a plugin for multi-page forms, and put in both value and values to force scalar/array
13:39 oetiker batman: how can it do that anyway if the ioloop is not started
13:39 lb worst design mistake in history of cgi
13:39 batman sri: http://p.thorsen.pm/d4786363d061 # fixed some typos as well
13:40 batman the golfing was unsuccessful. only managed to shave off four lines :(
13:40 sri batman: that pase looks broken
13:40 sri *paste
13:40 batman ok? i compiles :P
13:40 batman *it
13:40 sri http://p.thorsen.pm/d4786363d061 # there's two versions of everything
13:41 batman oetiker: not all code is as simple as yours. ex calling fork_call() from inside a async hypnotoad worker... that's a completely different ball game.
13:41 batman sri: sorry :(
13:42 batman need to fix the pod as well...
13:44 sri pod doesn't have the right format anyway, don't worry too much about it
13:44 batman maybe it gets better now
13:45 batman sri: http://p.thorsen.pm/095429a23ea9
13:48 d4rkie joined #mojo
13:48 sri i tend towards a +1 now
13:48 sri i'll play with some tests and see if i like it
13:49 batman sweet!
13:52 sri gonna prettify some things too :)
13:52 sri map { $_->val } $self->find('option[selected]')->each
13:52 sri can be written as
13:53 sri $self->find('option[selected]')->val->each
13:54 sri even if the collection is empty, the ->val call works... it just returns another empty collection
13:55 bowtie joined #mojo
13:55 batman Cool :)
13:57 sri i really don't thing ->val for a <form> should ever return undef
13:57 sri when would you want that?
13:58 sri i know i'll be using it all the time to get default values for hidden input elements like csrf token... i don't really care if it's empty or not, i just add my values and pass it on to $ua->post(...)
13:59 sri which i expect to be the main use case
13:59 sri sooo... the main use case would be ->val // {}
14:04 batman i don't mind {}. just wasn't sure if it "felt" consistent.
14:27 btyler joined #mojo
14:34 dvinciguerra joined #mojo
14:36 disputin joined #mojo
14:46 sh4 joined #mojo
14:57 sujithm joined #mojo
14:58 diegok batman & sri: +1 on {} instead of undef :)
14:58 sri diegok: so you like ->val?
14:59 sri everybody else, speak up if you like ->val!!!
14:59 diegok also, I would love to have $form->val( some_field => 'fill_value', some_other_field => 'lalala' )
15:00 diegok sri: I like it. I already have some hack on my side to fill & submit forms that will be much more clean with this :)
15:01 sri ohoh...filling out forms is a whole new can of worms
15:02 diegok It basically looks into attr('method') to select get/post and get input/option/text values.
15:02 batman i think we should keep it as a getter for now.
15:02 sri if ->val has to do that i might switch to -1
15:02 batman i agree. let's not do that (now)
15:02 diegok ok, getter _for now_ :D
15:03 sri :S
15:03 diegok Still, I'll replace my getter code with ->val and run my live tests to see if it gets it right :p
15:04 batman sri: i don't even want to consider filling out at this point.
15:09 Lee joined #mojo
15:09 diegok without filling I still like it :)
15:16 Ptolemarch joined #mojo
15:34 batman odc: from what i read, this should be possible. i'm thinking Mojo::Redis->new(url => [...], sentinel => 1);
15:34 batman (i want to explicitly specify sentinel)
15:36 odc batman, looks easy enough :)
15:36 odc but aren't I supposed to provide a list of sentinel urls ?
15:38 batman yeah: new(url => [ ........ ])
15:39 batman the client have to figure out the rest by it self
15:40 batman meybe new(sentinel => [$url, .....]) makes more sense
15:40 batman either way, it can support it. i'm not going to implement it at this point though :P
15:43 mire joined #mojo
15:45 sri batman: what about <button> btw?
15:46 batman sri: jQuery do support <button value="foo"></button>
15:47 batman never used it myself
15:47 batman but we also support it though... not documented, but we support it
15:47 batman "we also" = "the patch"
15:48 * batman need to get some chocolate. *brb*
15:48 odc ok, new(sentinel => []) is indeed clearer
15:49 batman odc: 👍
15:52 batman odc: would "url" have any purpose then?
15:53 odc for normal redis urls maybe?
15:53 batman Maybe it could be used to hold the current connection URL..?
15:53 odc yup
15:53 batman cool.
15:53 batman then we have a plan for something i might do in 2015 ;)
15:54 odc $redis->master would also be cool
15:54 batman what's the difference?
15:54 odc none
15:54 odc it's a synonym
15:54 batman clutter--
15:55 odc hm right
15:57 sri i wonder which html elements can have a value attribute
15:57 batman i think a lot of them... but does that matter?
15:59 sri i'll make it a bit stricter about shich elements to use
16:00 batman why?
16:00 D4RK-PH0ENiX joined #mojo
16:08 sri because why should this work? x('<div value="foo">')->at('div')->val?
16:08 sri anyway
16:08 sri http://pastie.org/9415201 # full patch
16:09 * sri pokes batman, jberger, batman, tempire, crab
16:10 sri phew... i think i'll need a macro for that :o
16:10 sri wait
16:10 sri i forgot marcus!
16:10 sri all norwegians look the same :O
16:10 batman two times batman is almost like one marcus ;)
16:11 batman *looking*
16:11 batman sub _pair { $_[0]->{$_[1]} = $_[2] if defined $_[1] && defined $_[2] } # doesn't get much more readable than this ;)
16:12 sri right!
16:13 batman if ($type ne 'radio' && $type ne 'checkbox') || defined $e->{checked}; # this makes my brain hurt a lot
16:13 batman even though i can't make sense of it, i can understand it by guessing :)
16:13 batman brain--
16:13 batman did you just write that from the top of your head?
16:13 sri i think your version also didn't handle elements without name
16:14 sri those are supposed to be ignored
16:14 batman that's true indeed.
16:15 sri this was fun, i learned a lot about forms
16:15 Kripton_ joined #mojo
16:16 batman i think you might want to skip <input type="submit"> ...?
16:16 neyasov______ joined #mojo
16:16 batman i forgot about that as well
16:16 sri no
16:16 batman and type="button"
16:16 sri if it has a name and value it gets submitted too
16:16 batman that's not true.
16:17 batman type="button" is never submitted and only the type="submit" that is actually clicked gets submitted
16:17 batman <input type="submit" name="a" value="1"> <input type="submit" name="b" value="1"> # only a OR b will be posted from a gui browser
16:18 sri hmm, i wonder if you just broke the feature :o
16:19 sri i don't see clean semantics for my use case (extracting default values for submitting a form)
16:19 sri it's the same with <button>
16:19 batman skip everything that has input[type="submit"] and [type="button"]
16:19 sri we would have to know which button we use
16:20 batman that's true. you can't include button in the $form={} generator
16:20 sri then you might miss out on a name/value pair
16:20 batman oh! wait a sec
16:20 batman the first is the default.
16:20 batman crap. this is getting harder :(
16:20 Kripton_ joined #mojo
16:20 sri yea, i'm -1 now
16:20 batman wait a sec....
16:21 batman oh! i have to go before they close the gym :(
16:21 batman back in two hours - hopefully with a patch :)
16:21 sri doubt you could save it anyway ;p
16:22 sujithm joined #mojo
16:22 batman i wan't to believe i can. this is right up the mojo-spirit: make hard things super-duper-easy
16:24 Lingo joined #mojo
16:37 sri http://pastie.org/9415273 # batman prolly had this in mind.... but i dunno
16:38 sri only takes the value from the first button
16:42 * sri pokes jberger, batman, marcus, tempire and crab
16:44 sri i still tend towards -1... since the button problem annoys me a bit
16:49 sri http://pastie.org/9415301 # with updated documentation (funny thing is the explanation gets easier)
16:49 sri "In the case of C<form>, find all elements mentioned before that would be submitted by pressing the first button and return a hash reference with their names and values."
16:50 sri still, i'm not sure this is mojolicious quality
16:52 KCL_ joined #mojo
16:52 sri button problem bugs me :S
16:53 dvinciguerra joined #mojo
16:59 denis_boyun joined #mojo
16:59 good_news_everyon joined #mojo
16:59 good_news_everyon [mojo] kraih created val (+1 new commit): http://git.io/Nfo5WQ
16:59 good_news_everyon mojo/val 3564dd1 Sebastian Riedel: added val method to Mojo::DOM
16:59 good_news_everyon left #mojo
16:59 sri a branch for testing
17:03 tempire the button problem is where it only returns the first value from a collection?
17:04 sri the button problem is where only the button that gets pressed is submitted
17:04 sri if you have 3 buttons with different name/value pairs, only the one pressed is submitted
17:05 sri so if we collect all name/value pairs for a form with ->val, we don't know which button would be clicked, we can guess the first, but that's it
17:09 tempire that is troublesome
17:10 good_news_everyon joined #mojo
17:10 good_news_everyon [mojo] kraih pushed 1 new commit to val: http://git.io/94XBvg
17:10 good_news_everyon mojo/val 363e4cc Sebastian Riedel: simplify example a bit
17:10 good_news_everyon left #mojo
17:10 denis_boyun_ joined #mojo
17:16 sri https://github.com/kraih/mojo/compare/val
17:20 nic "./myapp.pl daemon --help" doesn't show the "-m" option
17:23 sri that option is inherited
17:28 mattastrophe joined #mojo
17:32 berov joined #mojo
17:42 denis_boyun joined #mojo
17:48 batman sri: if you press "return" in an input field, the first button will be used.
17:48 batman I think that's a good default for val() as well
17:49 batman Btw: [type="button"] must be ignored
17:49 batman That goes for both input and button
17:50 batman type="button" is just for JavaScript. It doesn't have anything to do with form submission.
17:50 * jberger_ can't look yet
17:51 * jberger_ punches purl in the nose
17:51 jberger_ Oh too bad
17:54 batman sri: how does the PR work? Can I commit to that branch or do I use a pastebin for modifications?
17:54 batman I'm currently on the bus... Will do some coding when I get home.
17:54 batman ETA: 30 min
18:21 agorman joined #mojo
18:47 sri batman: yes, you can commit to the branch, for experimenting just make a new one
18:53 dotandimet joined #mojo
19:03 good_news_everyon joined #mojo
19:03 good_news_everyon [mojo] kraih pushed 1 new commit to val: http://git.io/Fxps5g
19:03 good_news_everyon mojo/val fe015c6 Sebastian Riedel: ignore buttons
19:03 good_news_everyon left #mojo
19:04 sri batman: i suppose you mean that
19:04 batman crap! i'm about to push ;)
19:05 sri you need to say something unless you're faster than me ;p
19:05 batman :D
19:06 batman i think you should keep this test: is_deeply $dom->find('form')->[2]->val, {r => 'R'}, 'right values';
19:06 batman just change {r => 'R'} to {t => 'T'}
19:06 batman that way you know $form->val skipped it
19:07 batman oh! sorry
19:07 batman i read [$index] wrong
19:07 batman ignore that last part
19:07 sri wait, buttons are skipped?
19:07 batman maybe "skipped" wasn't the right word. "ignored"..?
19:08 sri <input type="button"> is not the default even if it is first?
19:08 batman yes.
19:08 sri what?
19:08 batman can give it a try?
19:09 batman type="button": The button has no default behavior. It can have client-side scripts associated with the element's events, which are triggered when the events occur.
19:11 sri that makes it easier \o/
19:11 batman you need to use type="submit" or no type at all
19:11 batman default type for a button is "submit"
19:11 batman default type for <input> is "text"
19:12 batman type="reset" and type="button" must be ignored. but i think it's easier (safer) to say what should be included
19:12 batman include this: <button type="submit" name="x" value="1"> <button name="x" value="1"> <input type="submit" name="x" value="1">
19:12 sri and we are back to really fricking annoying
19:13 batman ignore these: <button type="reset"> <button type="button"> <input type="reset"> <input type="button">
19:13 batman s!include this! select the first one of these!
19:13 batman can i give it a try?
19:15 sri sure
19:16 * batman creates some tests first...
19:16 sri no mess please :)
19:16 sri but seriously, if the code gets any uglier it's 100% not going into master
19:16 sri all the exceptions are soooo annoying
19:17 batman i will use a pastebin.
19:20 neyasov______ joined #mojo
19:23 sri all this skipping buttons and stuff feels way too magical :/
19:24 batman sri: is there a way to check if an attribute is not present using Mojo::DOM::CSS ?
19:24 batman [type=""] is empty string i thing, instead of "not there"
19:24 sri :not([type])
19:25 batman oh. toooooo easy ;)
19:32 sri i could commit, but i'll wait for you ;p
19:35 batman trying to make perltidy work :(
19:35 sri http://pastie.org/9415623 # i suppose that's what you got too
19:36 sri maybe with a few more tests
19:36 batman http://p.thorsen.pm/25160802f0b5
19:37 batman http://p.thorsen.pm/7282241f9aef # just the diff
19:37 sri hard to see what's new
19:37 sri you should diff on the branch
19:38 batman check the last one
19:38 batman sorry for messing up the tests - i couldn't find the failing one when all the descriptions where the same :(
19:39 sri 'val for direct button button"? really? :)
19:39 batman sorry. a bit tired now :(
19:39 batman working out in 33C is a killer
19:40 dotandimet joined #mojo
19:40 sri it's nice you want to clean up the descriptions, but that makes reading harder too :S
19:40 batman how do you do it? do you have a tool for getting to the right place?
19:41 batman haha! i actually got it in vim :D
19:41 batman i will change it back sri :)
19:44 sri "button button is for javascript"? Oo
19:44 batman sri: http://p.thorsen.pm/ff68a98204ae
19:44 batman what can i say? my vocabulary has zero failing tests ;)
19:44 batman hehe
19:44 sri DOM.pm part is missing
19:45 batman ARG!
19:45 batman what was that tool either tempire or jberger_ created for pasting?
19:45 sri don't see a reason why you can't push it to the branch though
19:46 batman sweet
19:48 good_news_everyon joined #mojo
19:48 good_news_everyon [mojo] jhthorsen pushed 1 new commit to val: http://git.io/4UFDhQ
19:48 good_news_everyon mojo/val 7b1497c Jan Henning Thorsen: Will only keep submit button/input
19:48 good_news_everyon left #mojo
19:49 neyasov_______ joined #mojo
19:50 good_news_everyon joined #mojo
19:50 good_news_everyon [mojo] kraih pushed 1 new commit to val: http://git.io/sYUC3Q
19:50 good_news_everyon mojo/val d2935dd Sebastian Riedel: remove unnecessary check again
19:50 good_news_everyon left #mojo
19:51 batman what do you think? still 50/50?
19:57 good_news_everyon joined #mojo
19:57 good_news_everyon [mojo] kraih pushed 1 new commit to val: http://git.io/uIU6HQ
19:57 good_news_everyon mojo/val a324e15 Sebastian Riedel: more unique names
19:57 good_news_everyon left #mojo
19:58 sri batman: more towards -1 now
19:58 sri https://github.com/kraih/mojo/compare/val#diff-24fe40937fb0bc295d664900b1a94f0eR185
19:59 sri mostly because of those button hacks
19:59 batman i don't get why that is an issue
20:00 sri i'm almost certain there is still stuff we are overlooking
20:01 sri always is when you're trying to interpret html
20:01 sri batman: that stuff needs to be maintained
20:02 batman ok. but instead of abandoning the branch, we could wait for feedback...?
20:02 sri of course
20:02 sri if it passes a vote i won't veto
20:03 sri but you need to consider the cost, and if it is worth it
20:03 sri i consider ->val to have a relatively high maintenance cost, since input elements are constantly in development
20:04 batman i think it's worth it. 1) we have copied the behavior of jQuery which makes a lot of people happy 2) we have added handling for form which will make Mojo::UserAgent people happy
20:04 batman and by the amount of time we have already put into #2, i think we will save quite a lot of hours for others
20:04 sri there is also still the multi button problem
20:04 batman what do you mean?
20:04 sri sure, pretty much nobody will care... but some will ultimately
20:05 sri "BUT I WANT TO CLICK THE SECOND BUTTON!!!!1"
20:05 sri "Y U NO ADD ATTRIBUTE TO USE SECOND BUTTON"
20:06 batman then i suggest we should skip -all- buttons and note this in the documentation
20:06 batman haha
20:06 sri it's gonna happen ;p we have to decide where to draw the line
20:07 sri this also opens the door for new mechanize features... so we better be prepared for that kind of feature request
20:07 neilhwatson If you are testing with "$t->post_ok( '/report/classes' form => { ..." How can I dump the contents returned for me to look at?
20:08 batman neilhwatson: MOJO_USERAGENT_DEBUG=1 ...?
20:09 batman sri: i need to get some sleep now...
20:09 batman it
20:09 batman it's been a long val()uable day :)
20:09 sri you need so much sleep :o
20:09 * sri pokes batman, jberger, marcus, tempire and crab
20:09 sri see val branch!
20:10 batman yeah. getting up 6am each day now. it's killing me :P
20:10 sri consider this a formal call for votes!
20:10 denis_boyun joined #mojo
20:10 batman this sucks. i'm 100% pro val() getting in somehow, but i'm 50/50 on the "skipping submit buttons" completely.
20:11 batman need to think about it while in hibernation mode :)
20:11 sri hmmm
20:11 sri yea, think about it
20:11 batman if everything fails: can we still keep val() for everything else, except "form"?
20:12 * sri shrugs
20:12 sri without buttons doesn't gain us that much though... we still have to skip them in the value collection stage
20:13 sri just those 3 lines would be gone https://github.com/kraih/mojo/compare/val#diff-24fe40937fb0bc295d664900b1a94f0eR191
20:13 batman that's true. but you don't need the $e = $self->at("submit...."); .... if $e step;
20:14 sri and you need a new description for <form> handling
20:15 batman https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input#attr-type # need to skip type="img" as well :(
20:15 sri which is actually quite easy to grok now
20:15 sri OH CMON!!!!1
20:16 sri (╯°□°)╯︵ ┻━┻
20:16 batman button, image, reset (and submit) are special
20:17 batman oh. and "[disabled]"
20:17 tempire I don't like the hashref returned from the form
20:17 batman so if anything <button disabled>, <input disabled>, ...
20:17 tempire particularly that ignoring previous button values
20:17 batman "previous button values" ?
20:18 tempire is_deeply $dom->at('form#button')->val, {s => 'S'}, 'right value';
20:18 tempire I would expect that to give me a hashref of all the values
20:19 batman but your firefox, chrome, ... doesn't do that
20:22 sri lets see how it looks if we cut out the hash return value :S
20:22 batman tempire: why would you expect that?
20:23 tempire I don't understand why you wouldn't. I'm specifying the form id, and asking for the value. What is the value of a form?
20:24 tempire if the form has a value, it's sensible to me that it would return a representation of all the values the form holds.
20:25 batman i would suppose val() would return what would be submitted if you click on a submit button
20:25 batman if an input is disabled, then it should not be reported back in the hash-ref, since it's not there from the form's perspective.
20:25 denis_boyun joined #mojo
20:26 tempire I'm looking at the tests, I don't see disabled buttons
20:26 batman the input still has a value, but the form does not see it when constructing a submission
20:26 batman tempire: all buttons except the first is disabled, unless you click them with your mouse.
20:28 tempire You're saying that the type=button, and type=submit buttons under id="button" are disabled in dom.t, on line 2330?
20:29 batman sri: i don't want to include any buttons or type="submit": http://api.jquery.com/serializeArray/
20:30 batman tempire: from a useragent's perspective that wants to submit the form: yes.
20:31 batman http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2
20:33 batman i think it will be a lot harder to remove the button/submit value form the hash instead of adding them manually.
20:33 good_news_everyon joined #mojo
20:33 good_news_everyon [mojo] kraih created simple_val (+1 new commit): http://git.io/rdpHIA
20:33 good_news_everyon mojo/simple_val d602e07 Sebastian Riedel: simplify val semantics
20:33 good_news_everyon left #mojo
20:33 sri new proposal from me
20:34 batman +1
20:34 purl 1
20:34 sri https://github.com/kraih/mojo/compare/simple_val
20:34 sri things get really really really simple and clean without hash return value
20:34 batman :)
20:35 tempire looks fine to me. I only have a problem with assumptions on the return value of a form.
20:35 batman tempire: i don't, if the assumptions are pre-declared
20:36 batman what about adding a cookbook example for the "form" variant?
20:38 * batman will make a blog post if not...
20:38 sri batman: this is exactly what i meant earlier when i was certain there will be more exceptions :)
20:38 sri there always are with html...
20:39 sri and you can bet "they" are working on new ones right now
20:39 batman hehe... i'm glad i remembered serializeArray() so i could cheat :)
20:40 batman you got my vote on "simple_val": +1
20:40 batman Zzzzee you around #mojo
20:40 sri tempire: the reason i wanted that stuff was for grabbing a bunch of hidden input elements when posting stuff somewhere
20:40 sri batman: nn
20:41 sri csrf token and the like
20:42 sri i don't want to imagine how much of this WWW::Mechanize has to get wrong considering how badly the underlying modules are maintained
20:44 sri anyway, i think simple_val gets a +1 from me
20:44 * sri pokes batman, jberger, marcus, tempire and crab
20:44 sri another poke for another proposal
20:44 marcus__ wat
20:44 marcus__ simple_ ???
20:44 purl hmmm... simple_ is reading a flat file which has parenthesis (router code ver for cisco)...is there a way to do this where it doesnt report it as a scalar?
20:45 sri https://github.com/kraih/mojo/compare/simple_val
20:45 sri you don't want to look at the non-simple one
20:46 sri or the discussion about it really :)
20:46 marcus__ sri: Oh ok, I thought you were naming the method simple_val and I freaked out a bit
20:46 sri dude...
20:46 marcus__ I read the discussion from last night earlier today.
20:46 marcus__ I like what I'm seeing now tho
20:47 marcus__ +1 from me too.
20:47 sri \o/
20:48 marcus__ I want to run linux  dual boot on my macbookpro retina
20:49 marcus__ I've started installing it with arch last night, but now all my meat friends tell me arch sucks and I should do ubuntu or smth instead.
20:52 batman Ubuntu++
20:52 sri go to sleep!
20:53 batman Im in bed. But it's too freakin' hot to sleep.
20:54 lb bowchickabowwow
20:54 sri was 36C here earlier
20:55 batman simple_val()++ # so people will understand how simple it is to use.
20:55 marcus__ it's crazy in denmark too
20:55 marcus__ so hot
20:55 marcus__ lb: I'm in your country, drinking beer.
20:56 lb marcus__: you bitch
20:56 purl I'm gonna git you sucka!
20:56 jberger_ Ye gods! The backlog!
20:56 sri holy backlog batman
20:56 batman Maybe I should fork mojo into Mojo::Simple... simple_new() has_simple() simple_md5_sum(). It will be simple!
20:56 marcus__ Wow, jberger has an actual avatar on my computer. frickin' awesome.
20:57 marcus__ technology ftw
20:57 jberger_ I use demo.convos.by when I'm away from home
20:57 * lb forks into Mojo::Simple::ButMaintained after batman ignores some patches
20:57 batman marcus__: he's on demo.convos.by
20:57 marcus__ batman: ait
20:57 lb marcus__: where you at?
20:57 purl it has been said that you is what you am
20:57 * sri rewrites everything into Mojo::Tiny
20:58 marcus__ lb: close to Mols Bjerge
20:58 jberger_ That's right I'm in Chicago but my irc client is in Norway!
20:58 batman Haha! Watch out. It might implode.
20:58 batman jberger_: not really. No idea where digitalocean has the server... Maybe Ireland..?
20:59 jberger_ So what is the state of things, someone catch me up. Also someone bring me a beer
20:59 lb marcus__: nice, that's almost my original neck of the wood
20:59 marcus__ lb: It's very nice here, I just took over the Vrinners kirke ingress portal :)
20:59 batman jberger_: check the simple_val branch and give us 👍
20:59 batman ;)
20:59 batman jberger_: 🍺
20:59 lb marcus__: to go to interesting places in the world to stare at your phone
21:00 marcus__ lb: And also buy cheap beer at the supermarket.
21:00 sri jberger: this is up for votes https://github.com/kraih/mojo/compare/simple_val
21:00 lb marcus__: mmm, crappy beer
21:01 marcus__ lb: Actually their selection was ace here.
21:01 lb you did say cheap
21:01 lb so norwegian-cheap, not the cheapest swill they have ;)
21:01 marcus__ lb: cheap compared to norway.
21:01 * sri thinks he has only been once to denmark, for a legoland visit
21:01 lb sri: for shame
21:02 * lb is not drinking beer this year
21:02 marcus__ lb: Not buying the cheapest swill for sure. Buying the for me cheap belgian munk beers :)
21:02 lb mmm
21:02 marcus__ 9% blondes and such
21:02 marcus__ which you could not get in the supermarkets in oslo at all
21:02 lb crazy!
21:03 lb go to aarhus for a bit, there are some great beer places
21:03 lb which i would have to look up on the interwebs, since i haven't been there in 4 years
21:05 sri oh i love the moz docs https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
21:06 sri sooo <progress> for example also has a value attribute
21:06 lb marcus__: if you have any possibility of a tiny road trip, this place is bonkers, http://www.xn--alverdensl-8cb.com/
21:06 jberger_ Would it make more sense for a select to always return an array ref?
21:07 lb jberger_: also checkbox
21:08 lb or as i said earlier, let the user decide through two functions, value = scalar, or first in array; values = forced arrayref
21:08 lb i really hate having to check the refness in the controller, it's just messy
21:09 jberger_ That was my thought too
21:09 * jberger_ smells a holy war coming on
21:09 good_news_everyon joined #mojo
21:09 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/ja9eRw
21:09 good_news_everyon mojo/master 47e8e5b Sebastian Riedel: better value tests
21:09 good_news_everyon left #mojo
21:10 lb i've been thinking deep about forms for a month, i'm pretty well armed for that war ;)
21:10 sri merged ->val into master \o/
21:10 disputin joined #mojo
21:11 jberger_ Generally I'm +1, but i would like not having to check ref
21:11 sri jberger: you mean for <select>?
21:12 batman jberger_: we tried to copy the behavior of jquery. Which already works really nicely
21:12 sri javascript is not perl though
21:12 sri jberger has a point
21:13 batman I would rather check that occasionally instead of getting array-ref with one element 99% of the time
21:14 batman I don't see what js vs Perl has to do with it...
21:14 sri it could return a collection
21:15 batman Temperature is getting lower. Now I can sleep :)
21:15 sri which stringifies to your value
21:15 batman I'm not changing to -1 just because of array, collection, scalar change
21:16 batman I'm fine either way. But I do like jquery :)
21:16 batman be back tomorrow.
21:16 * lb uses vanilla.js
21:17 lb "The Vanilla JS team maintains every byte of code in the framework and works hard each day to make sure it is small and intuitive."
21:17 lb they sure do
21:17 tempire intuitive <- lulz
21:17 lb http://vanilla-js.com/
21:18 lb it's brilliant satire
21:18 lb did we lose marcus__ again
21:24 good_news_everyon joined #mojo
21:24 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/sYWOMA
21:24 good_news_everyon mojo/master b54e754 Sebastian Riedel: return collection for select values
21:24 good_news_everyon left #mojo
21:24 sri batman: you should like that
21:24 sri jberger: you too
21:25 sri still undef for no value, but collection for one or more, which can be checked with a ref $value, but always stringifies
21:26 sri and less code \o/
21:26 sri actually quite elegant code https://github.com/kraih/mojo/commit/b54e754bf778dca2464f928197a6a010277c46df#diff-24fe40937fb0bc295d664900b1a94f0eR187
21:27 sri uses the new bool overload of Mojo::Collection
21:28 sri we could also go one step further, and just return a collection for all cases
21:30 lb special cases where the special case is 0 or more is really not that special
21:32 lb i like the explicit single/plural value, because it puts the onus on the programmer to specify what he expects, without getting verbose
21:33 lb normal inputs can be plural too, especially when you consider abuse
21:37 sri not sure what you just said
21:41 hummeleBop joined #mojo
21:42 lb it's complicated, and i'm tired - have a method for getting a SINGLE value from any form field, and another method to ALWAYS get an array ref
21:43 lb not val() but value() and values()
21:45 sri no
21:46 lb that's a valid point
21:51 sri glad we could come to an understanding :)
21:52 good_news_everyon joined #mojo
21:52 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/fNn5Hw
21:52 good_news_everyon mojo/master cdee141 Sebastian Riedel: always return a collection
21:52 good_news_everyon left #mojo
21:52 hummeleBop joined #mojo
21:52 * sri pokes batman, jberger, marcus, tempire and crab
21:52 sri one more time ;p
21:53 sri no special case, all collections
21:54 lb i almost like it
21:54 * lb runs
21:56 lb $emptycollection->first is undef?
21:58 lb yep
22:01 lb heh, reading mojo 5.12 docs, and trying to run a one-liner on another machine with mojo 2.70
22:05 jberger_ Looks ok to me
22:23 sri hmm, i guess it's actually more comfortable for one-liners too
22:23 sri perl -Mojo -E 'say g("mojolicio.us")->dom->find("input")->val->flatten'
22:24 sri no need to deal with undef values in between
22:25 disputin joined #mojo
22:29 sri hmm, lots of form elements without name and value on metacpan
22:29 sri perl -Mojo -E 'say g("metacpan.org/pod/Mojolicious")->dom->find("input, select")->map(sub { "$_->{name}: " . $_->val })'
22:43 D4RK-PH0ENiX joined #mojo
22:57 Negor joined #mojo
23:04 D4RK-PH0ENiX joined #mojo
23:21 sugar_ joined #mojo
23:43 Lee joined #mojo
23:45 disputin joined #mojo
23:57 vervain joined #mojo

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