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

IRC log for #mojo, 2014-01-02

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

All times shown according to UTC.

Time Nick Message
00:18 sri hmm, hash deprecation in select_field works out pretty well actually
00:27 jberger I'm guessing we have gotten about 8 inches today
00:27 jberger and probably a total of 8ish more over the past few weeks, but most of that melted in a brief warm spell
00:28 jberger 8in ~ 20cm, says google converter
00:28 * jberger wishes he used metric in practical things as well as scientific
00:30 dsteinbrunner joined #mojo
00:31 sri http://pastie.org/8592428 # does that look good?
00:31 * sri pokes marcus, jberger, crab and tempire
00:31 sri tianon too
00:32 sri pretty clean deprecation
00:44 jberger should you describe that you use a collection to generate an optgroup? it is in the example, but I think a line of text would help
00:44 jberger other than that, the patch looks good
00:45 sri jberger: dunno, i think if you explain one thing you have to explain the whole structure
00:46 sri which i'm having trouble to put into words
00:50 good_news_everyone joined #mojo
00:50 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/V5Keeg
00:50 good_news_everyone mojo/master 684e637 Sebastian Riedel: deprecated use of hash references for optgroup generation with select_field helper in favor of Mojo::Collection objects
00:50 good_news_everyone left #mojo
00:50 jberger perhaps you are right, still, if I were to read that, I would wonder what that c is doing there
00:50 sri hmm
00:51 sri maybe very subtle
00:52 sri "Generate select and option elements from array references and optgroup elements from L<Mojo::Collection> objects."
00:52 sri no explanation, but a pointer
00:55 good_news_everyone joined #mojo
00:55 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/bHe-5A
00:55 good_news_everyone mojo/master e42cd7d Sebastian Riedel: slightly better description for select_field helper
00:55 good_news_everyone left #mojo
00:59 sri jberger: btw. got any mojolicious-ish use case for reduce yet?
01:00 chansen Would it not be more clear if you provided the output after each "%= select_field " example instead of combining the output of all examples?
01:03 sri http://www.mikeperham.com/2013/12/31/rubys-gil-and-transactional-memory/ # *drool*
01:25 mire_ joined #mojo
01:30 tianon sri: +1, I like it :)
01:31 jberger sri: almost all the ideas that come into my head can be redone as a map and join
01:31 jberger but I'm not done thinking yet!
01:31 jberger of course, specialized finding works too
01:33 jberger c(...)->reduce(sub{ $_->a > $_->b ? $_->a : $_->b })
01:34 jberger where the test in the above example could be arbitrarily complex
01:43 jberger but in the end, I think the best reason is for summation
01:54 D4RK-PH0ENiX joined #mojo
02:00 d4rkie_ joined #mojo
02:10 klapperl joined #mojo
02:12 tianon looking through that select code again, still loving how clean that solution is :)  sri++ and jberger++
02:13 jberger select was all sri
02:13 jberger I guess I thought of Collection
02:14 sri jberger++, tianon++
02:16 jberger as to reduce, it's benefit is flexibility
02:16 tianon and I'm still stoked that I finally have a better understanding of how you guys want PRs used :)  I've honestly never thought of them that way, and kinda wish Github would let individual projects change the language for things like that, so mojo's could be something like "Submit Proposal" instead of "Submit Pull Request"
02:16 jberger every now and again a PR gets accepted as-is
02:16 sri i'm actually not 100% sure what i want from pull requests
02:17 sri for discussion i think i like a nopasted diff on irc the most
02:18 crab sri: what am i being poked about? point me to $whatever and i'll read.
02:18 tianon I've seen it happen :)  but now that I know they're still considered useful as a foundation for more discussion and a potential real fix, I'll be less shy about submitting them if I think I've got something worthwhile :)
02:18 sri crab: commits above
02:18 crab pulling
02:19 jberger speaking of which, I never heard if anyone liked this idea: https://github.com/jberger/Mojolicious-Command-nopaste
02:19 good_news_everyone joined #mojo
02:19 good_news_everyone [mojo] amenonsen pushed 1 new commit to master: http://git.io/rVmR7w
02:19 good_news_everyone mojo/master b510c0d Abhijit Menon-Sen: Fix typo
02:19 good_news_everyone left #mojo
02:20 sri oh my!
02:22 tianon jberger: pastie's API really requires you to hard-code the language IDs? :(
02:22 crab looks good. i think the part i like best is having 'b' in defaulthelpers though :-)
02:23 jberger tianon, that was just a direct port of the nopaste service code, but yeah, I assume so
02:23 tianon ah, I see :)
02:23 tianon I guess looking at pastie, they don't really have an official "API", so it does make sense
02:24 jberger I like the "authorization" key
02:24 tianon hahaha it's literally hard-coded to a static value?
02:24 tianon that's nuts
02:24 tianon I suppose it avoids the main spam bots anyhow
02:26 sri that reminds me... did we want a csrf_meta_tag helper?
02:27 sri %= csrf_meta_tag -> <meta name="csrf-token" content="123456...">
02:28 sri to go with X-CSRF-Token header support
02:30 sri maybe not yet
02:34 kej joined #mojo
02:36 good_news_everyone joined #mojo
02:36 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/cRM6jA
02:36 good_news_everyone mojo/master 2a8c956 Sebastian Riedel: merged two select_field examples
02:36 good_news_everyone left #mojo
02:37 tianon shouldn't that optgroup example still have an attribute on one of those optgroups, especially since that's why the change was made in the first place?
02:37 sri the other does
02:38 tianon doh sorry
02:38 tianon misread the diff >.<
02:41 salparadise joined #mojo
03:31 arpadszasz 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/-xGR4g
04:04 good_news_everyone mojo/master b45db60 Sebastian Riedel: fixed reference handling bug in Mojo::Collection
04:04 good_news_everyone left #mojo
04:13 good_news_everyone joined #mojo
04:13 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/KY0JMQ
04:13 good_news_everyone mojo/master b671ef5 Sebastian Riedel: changed order of select_field examples
04:13 good_news_everyone left #mojo
04:29 kej joined #mojo
04:35 keedi joined #mojo
04:42 preflex_ joined #mojo
04:51 irq joined #mojo
05:48 xantus joined #mojo
06:00 * sri decides to try something new https://groups.google.com/forum/#!topic/mojolicious/YK7SrFvEneY
06:44 Vandal joined #mojo
07:07 marcus sri: I think we want a meta_tag helper for csrf. the select change looks good.
07:24 trone joined #mojo
07:34 abra_ joined #mojo
08:28 d4rkie joined #mojo
08:45 KindTwo joined #mojo
08:50 odc joined #mojo
08:57 denisboyun joined #mojo
08:59 irq joined #mojo
09:02 highflying joined #mojo
09:09 dod joined #mojo
09:11 hrupp joined #mojo
09:13 denisboyun joined #mojo
09:37 denis_boyun joined #mojo
09:39 dod joined #mojo
09:42 batman sri: $app->helper(b => sub { shift; Mojo::ByteStream->new(@_) }); # me like! :)
09:44 batman the c() change for select also makes sense
09:46 batman i think i would like sub{} support as well. been thinking about it, and i think it makes sense: you don't have to look twice over data to generate the tag. normally i would do it once to generate the argument for %= select_field and then the helper would look again to produce the html
09:46 batman it's just a minor tweak, but it feels right :)
09:46 batman s/look/loop/
09:57 denisboyun joined #mojo
10:11 denisboyun joined #mojo
10:23 ladnaV joined #mojo
11:12 KindOne joined #mojo
11:22 mire joined #mojo
11:40 sh4 joined #mojo
11:52 meshl joined #mojo
12:27 maxhq joined #mojo
12:41 dsteinbrunner joined #mojo
13:46 dsteinbrunner joined #mojo
13:53 damaya joined #mojo
13:54 damaya I have a DBIx::Class resultset that returns a list of terms like some input on a form. My question is: Can I have these terms printed as a JSON object from my resultset object?
13:55 damaya i.e., my $terms = $self->db->resultset('Terms')->search_title($term); $self->render( json=> $terms );
13:58 d4rkie joined #mojo
14:11 d4rkie joined #mojo
14:18 kej joined #mojo
14:24 batman damaya: yes. https://metacpan.org/pod/DBIx::Class::ResultClass::HashRefInflator
14:29 sri hmm... the wishlist thread is not very exciting yet
14:30 mishantil joined #mojo
14:32 damaya Hm, alright, checking out the documentation and trying to figure it out. Thanks batman!
14:33 batman damaya: the doc is pretty straight forward allowing ->next to return a hash instead of an object. ->all will return a list of hashes
14:35 sri if anyone has something to contribute to the mojolicious wishlist https://groups.google.com/forum/#!topic/mojolicious/YK7SrFvEneY
14:40 damaya Is this about how you'd do it: http://pastebin.com/a8RMi14C
14:40 damaya ?
14:41 damaya it works, but just checking if that's pretty ugly?
14:42 batman do you you encode it first?
14:43 batman $self->render(json => [$tags->all]); # just do this
14:45 damaya ah, nice, that works well :D
14:45 damaya Thanks batman
14:45 batman your welcome :)
14:46 batman *you're
14:46 batman :P
14:46 batman sri: not very exiting, but i would also like json_like()
14:58 damaya batman: what would json_like() do?
14:58 damaya just curious.
15:04 tianon sri: ouch, several of those would be pretty easy with monkey_patch or custom modules as plugins or just additions
15:05 sri most actually have been discussed before, and people seem to ignore the reasons against them :S
15:10 paraplexed joined #mojo
15:13 * sri has no clue what exactly json_like() would do either
15:13 Adurah Google groups doesn't like me scrolling to the very bottom of a page.
15:23 Adurah http://kohanaframework.org/3.0/guide/kohana/files Something like that ever suggested?
15:23 rem_lex| joined #mojo
15:32 gryphon joined #mojo
15:49 batman json_like('/som/path', qr{ not exactly but partially what it holds })
15:51 batman text_is() is to text_like() what json_is() would be to json_like() (Test::Mojo)
15:51 sri it can't be
15:51 batman why?
15:52 sri json_is() is an is_deeply test, it also has no negation... text_isnt()
15:54 batman right. then ignore the comparison. json_like() would use like()
15:55 batman and the pointer would need to point to a scalar, not a ref
15:55 batman pointer = json pointer
16:22 * sri hates inconsistency
16:23 btyler joined #mojo
16:39 btyler joined #mojo
17:04 beyondcreed joined #mojo
17:04 btyler joined #mojo
17:09 bowtie joined #mojo
17:14 bowtie_ joined #mojo
17:15 irq joined #mojo
17:25 marty joined #mojo
17:49 marcus json_contains ?
17:50 marcus json_is_subset ?
17:56 maxhq joined #mojo
18:03 lsm-desktop_ joined #mojo
18:24 cfedde this way to the php library documentation ==>
18:27 arthas joined #mojo
18:30 maxhq joined #mojo
18:33 beyondcreed joined #mojo
18:40 dvinciguerra joined #mojo
18:46 tianon ooh, fun: http://unrellius.deviantart.com/art/The-cast-of-Futurama-397545751
18:47 paraplexed joined #mojo
18:50 marcus tianon: I found hypnotoad!
18:51 beyondcreed joined #mojo
18:54 Adura joined #mojo
19:12 btyler joined #mojo
19:14 tianon :D
19:32 cullum joined #mojo
19:35 sri wishlist thread went better than expected
19:45 * moritz wants validation examples in Mojolicious::Lite docs
19:46 sri http://mojolicio.us/perldoc/Mojolicious/Guides/Rendering#Form_validation
19:48 moritz looks sensible, thanks
20:05 * marcus posts about ponies
20:36 lukep joined #mojo
20:43 irq_ joined #mojo
21:00 preflex joined #mojo
21:02 asarch joined #mojo
21:13 paraplexed joined #mojo
22:08 jberger joined #mojo
22:08 asarch joined #mojo
22:09 jberger sri: a possible compromise on the JSON comparison test, since I have wanted a similar thing
22:09 jberger what about a wrapper method for Test::Deep::cmp_deeply which croaks if Test::Deep is not available
22:11 sri jberger: -1
22:11 purl -1
22:11 * sri pats purl
22:11 * purl bites!
22:12 jberger any particular reason? Test::Deep is a fairly common approach to data structure testing
22:14 sri not elegant
22:14 jberger au contaire, I feel it is quite elegant :-)
22:15 jberger delegate to the module which does these kind of things
22:15 jberger the test file would still have to import Test::Deep to get all of its functions
22:16 jberger its just a connector
22:17 sri nobody is preventing you from using Test::Deep, it just doesn't fit into Test::Mojo
22:18 jberger the same is true of using like on $t->tx->res->json
22:18 sri i don't understand
22:19 jberger $t->json_cmp_deeply('/pointer', <<some comparison>>)->other_chained_test(...) is nice and mojo
22:19 sri nothing else in Test::Mojo requires you to import a gazillion functions from a 3rd party module
22:20 sri it doesn't "just work", you have to write extra boilerplate, that's not mojo
22:21 sri i'm not arguing against the method, just it being in core
22:22 jberger any non-core approach would require a Test::Mojo subclass or (worse) monkey patching
22:23 sri then that's the problem you should be solving ;)
22:23 jberger anyway, all I meant to say is that I think that that is a better generic solution than starting to add data structure comparisons piecemeal
22:24 jberger plugins for Test::Mojo?
22:24 sri ok, then that's a -1 for json_like
22:24 dvinci joined #mojo
22:25 jberger its a weak -1, I personally would like something of the sort, but I would like a more generic data structure comparitor if possible
22:26 jberger what are your initial reactions to some kind of plugin system for Test::Mojo
22:27 sri sceptical
22:27 purl sceptical is good. Look anyway :)
22:27 jberger thanks purl, I can always count on you
22:27 jberger botsnack
22:27 purl :)
22:28 sri just calling it a "plugin system" could get confusing
22:29 sri since one already exists in mojolicious for a different purpose, got to be careful
22:30 jberger true
22:30 Adura Test::Morjo
22:33 marcus Test::Moar::Mojo
22:33 jberger if it were to be subclasses, I can imagine wanting to use two different subclasses of Test::Mojo, say Test::Mojo::Deep and Test::Mojo::Differences for example
22:33 marcus please add capybara functionality to your test class while you are at it :)
22:34 sri jberger: which wouldn't be a big problem, you have to perform the request twice
22:34 jberger marcus, ROUS?
22:34 marcus jberger: https://github.com/jnicklas/capybara
22:35 good_news_everyone joined #mojo
22:35 good_news_everyone [mojo] kraih tagged v4.65 at d34d4b4: http://git.io/-3Zc9Q
22:35 good_news_everyone left #mojo
22:35 jberger sri: good point, yet another reason to do all the data comparison at once
22:35 jberger (ie. Test::Deep)
22:35 jberger but I see which way the wind is blowing on this
22:36 phillipadsmith joined #mojo
22:36 jberger marcus: glad to, for a very large consultancy fee :-)
22:36 marcus :)
22:37 marcus I just wrote capybara tests for $work_app
22:37 marcus webkit drivers requires a huge QT install :-/
22:37 marcus but really neat when it works
22:38 sri pluggable tests is a topic that comes up every year it seems
22:40 mire_ joined #mojo
22:40 jberger sri: because we all love the chaining of Test::Mojo and wish it had our favorite Test:: thingy
22:40 jberger <3 Test::Mojo
22:41 sri well, then make it happen! :)
22:41 * jberger puts on thinking cap
22:42 sri don't overthink it, pick the simplest solution you can get away with ;p
22:42 chansen joined #mojo
22:42 * sri 's motto
22:43 jberger part of why it needs some thinking
22:45 phillipadsmith joined #mojo
22:50 jberger the no-harm approach would be to make a Test::Mojo::Deep which lexically monkey-patched using a variant of Exporter::Lexical
22:50 jberger we've been looking into similar things for PDL
22:51 jberger I'm not sure that will work tho
22:57 xantus joined #mojo
22:57 jberger the other would probably have to expose the private methods in Test::Mojo in some way, which I think is probably less likely to be accepted
22:58 sri which private methods?
22:59 jberger _test and _json for a start
22:59 sri _json does absolutely nothing special
23:00 sri _test only uses {latest}, which could be made public in some way
23:00 jberger the semantics of it are unlikely to be well-groked by plugin-writers
23:00 sri you're overthinking it already
23:01 kej joined #mojo
23:01 sri but i better shut up before i kill your motivation :o
23:02 jberger ok, well if _test were exposed, and could take a subref in place of name, it would be 90% there
23:06 jberger unless it truly would be a plugin/helper system like Mojolicious has, if not called plugins to avoid confusion
23:07 asarch joined #mojo
23:13 good_news_everyone joined #mojo
23:13 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/nM1gIw
23:13 good_news_everyone mojo/master c56a12a Sebastian Riedel: another helper test
23:13 good_news_everyone left #mojo
23:14 asarch joined #mojo
23:18 asarch joined #mojo
23:23 asarch joined #mojo
23:35 * jberger sees the inspiration fade ... for now
23:37 * jberger installs convos instead
23:42 jberger batman, can buildz the convos?
23:43 cooper joined #mojo
23:43 jberger damn, I double-misspelled "teh"
23:46 jberger batman, you have a Makefile in your dist AND you are missing the cpanfile
23:47 sri testing is hard, lets go shopping
23:48 * sri is looking forward to discussing this topic again in 2015 ;p
23:48 jberger hahaha
23:48 jberger I think its worth doing
23:48 jberger but it needs some thinking
23:49 sri yea, i'm just kidding
23:49 * jberger slaps sri with a comically large fish
23:54 * sri starts bleeding... comically
23:56 jberger typically one falls into the nearby canal
23:59 jberger can not haz convos
23:59 jberger :-(
23:59 sri hmmm... blizzard in the us... so you're the ones stealing all our snow?

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