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

IRC log for #mojo, 2015-11-26

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

All times shown according to UTC.

Time Nick Message
00:30 woz joined #mojo
00:48 Zoffix joined #mojo
00:48 Zoffix Having a bit of a trouble parsing HTML... How do I go about doing $dom->find('> div > ul > li') ?
00:48 Zoffix Without nesting a whole ton of ->children
00:49 sri that leading > is intentional?
00:50 Zoffix Yes. I want "div" that is the child
00:50 sri ok, you can't yet
00:50 Zoffix Alright
00:50 sri that's a css4 feature
00:50 Zoffix sweet
00:50 sri which we don't have, but jberger had a partial patch
00:51 sri "> foo > bar" will be equivalent to ":scope > foo > bar" in css4
00:51 * Zoffix thinks up of a $dom->wrap('<zoffix></zoffix>')->find('zoffix > div > ul > li') ^_^
00:51 Zoffix or zoffix > * > div ... I suppose
00:53 Zoffix weird. ->wrap doesn't seem to be working
00:56 * Grinnz was about to suggest a bunch of ->children but sees that was already considered
00:57 sri if i remember correctly, the big problem with jberger's patch was that the css4 selector spec was still very unstable, with talk of :scope getting removed again
00:58 Zoffix Um, why is Line 16 ->wrap works, but Line 26 ->wrap doesn't? https://gist.github.com/zoffixznet/0d47be34a2634cc9958d
00:58 Zoffix Here's the output: http://fpaste.scsys.co.uk/501939
01:00 Zoffix Same goes for wrap_content
01:01 * Zoffix has a spidey sense that's telling me it's something obvious and stupid
01:02 Zoffix Changing $d->wrap_content('<pre></pre>')->to_string; to Mojo::DOM->new($d)->wrap_content('<pre></pre>')->to_string; work tho
01:05 marty joined #mojo
01:06 Zoffix Hm. I get use on uninitialised value in Mojo::DOM L312, which is sub _start { $_[0][0] eq 'root' ? 1 : 4 }
01:15 Zoffix 'tis a bug: https://github.com/kraih/mojo/issues/877
01:16 Zoffix (and never mind ->wrap_content I mentioned above; seems to be working fine)
01:19 salva joined #mojo
01:23 sri first bad bug report from Zoffix :o
01:24 bobkare joined #mojo
01:24 sri there is nothing one could do with the "Misc" part
01:24 Zoffix Why is bad? Even if you disregard my assumptions about the return value of ->wrap, it's inconsistent
01:25 sri the "Misc" part makes it bad
01:25 Zoffix And even if I disregard the return value, ->warp still doesn't wrap anything for ->at()ed Mojo::DOMs
01:26 sri of course it does
01:26 Zoffix http://fpaste.scsys.co.uk/501940
01:27 sri perl -Mojo -E 'say x("<div><b>test</b></div>")->at("b")->wrap("<i></i>")->root'
01:27 sri your code is just wrong
01:27 Zoffix :S
01:28 sri your assumption here doesn't even make much sense
01:29 sri perl -Mojo -E 'say x("<div><b>test</b></div>")->at("b")->wrap("<p><i></i></p><p></p>")->root'
01:29 sri you can wrap a structure like that around the current node
01:29 Zoffix My assumption came straight from the doc "Wrap HTML/XML fragment around this node, placing it as the last child of the first innermost element."
01:29 sri that says nothing about a return value
01:30 Zoffix I'm no longer considering the return value.
01:30 Zoffix perl -Mojo -E 'my $d = x("<div><b>test</b></div>")->at("b"); $d->wrap("<p></p>"); say $d'
01:31 sri why would $d change?
01:31 sri that makes no sense
01:32 sri ->wrap(...) could create a structure with two or more sibling nodes at the top
01:32 sri $d would have to magically become a collection of nodes
01:32 sri that's crazy
01:32 Zoffix Well, $d changes in this case:
01:32 Zoffix <Zoffix> Well, $d changes in this
01:32 Zoffix err
01:32 Zoffix perl -Mojo -E 'my $d = x("<div><b>test</b></div>"); $d->wrap("<div></div>"); say $d'
01:33 sri that's the root node
01:33 salva joined #mojo
01:33 sri there can't be more than one root
01:34 sri what i was interested in is the warnings
01:35 Zoffix I guess it's trying to get a root and fails.
01:35 Zoffix Or create a root
01:35 batman joined #mojo
01:45 sri so, you have no test case?
01:47 Zoffix For the warning?
01:47 Zoffix I had, but closed the terminal
01:48 * Zoffix tries again
01:48 Zoffix This produces the warnings: perl -Mojo -E 'my $d = x("<div><b>test</b></div>")->at("b"); $d->wrap("<p></p>"); say $d'
01:48 nicomen joined #mojo
01:49 Zoffix huh? This does not produce warnings perl -Mojo -E 'x("<b>test</b>")->at("b")->wrap("<div></div>");'  but this does perl -Mojo -E 'my $d = x("<b>test</b>")->at("b"); $d->wrap("<div></div>");'
01:49 Zoffix I'd think the two are equivalent
01:50 sri that's just a weaken issue
01:50 Zoffix Ah
01:50 sri you need to hold on to the root
01:51 Zoffix Then no, no testcase :P
01:55 salva joined #mojo
01:59 sri if you want to propose a doc update for the weaken thing, good luck explaining it!
01:59 Zoffix :)
01:59 sri i tried to explain a similar problem in the mango docs, and it just didn't work, most people just don't get weaken
02:39 kaare joined #mojo
02:50 woz joined #mojo
02:59 berov1 joined #mojo
03:07 voldemortensen joined #mojo
03:16 voldemortensen1 joined #mojo
03:16 woz joined #mojo
03:16 noganex joined #mojo
03:35 berov joined #mojo
03:47 cpan_mojo Mojo-SQLite-0.019 by DBOOK https://metacpan.org/release/DBOOK/Mojo-SQLite-0.019
03:52 sunrise joined #mojo
04:02 Grinnz sadly, the unfinished select issue does not seem to be related to the forking issue from before..
04:17 woz joined #mojo
04:25 sh4 joined #mojo
04:47 Grinnz i got oauth 1.0 working \o/
04:47 Grinnz now i just have to figure out how i actually want this interface to work, and then figure out how i'm going to test it
04:48 Grinnz fortunately i think you can use oauth 1.0 to do innocuous things like read people's tweets, so i don't have to test it by posting tweets
04:48 jberger Yeah that discovery about :scope really took the wind out of my sails
04:48 jberger (On that patch)
04:52 sunrise is there an idiom for a Lite app to return a 'downloadable' file in the browser
04:53 sri http://mojolicio.us/perldoc/Mojolicious/Guides/Rendering#Serving-static-files
04:54 sunrise i should have said, the data is generated in the route and i dont want to write it to the disk at any point
04:54 sunrise i see there is a plugin
04:54 sri http://mojolicio.us/perldoc/Mojolicious/Guides/Rendering#Rendering-data
04:55 Grinnz plugin seems quite overkill for that
05:00 Grinnz if you want to make the browser "download" it, set the content-disposition header: $c->res->headers->content_disposition(qq{attachment; filename="$filename"});
05:01 Grinnz i see that's also mentioned under "serving static files"
05:01 sunrise yeah im trying that now
05:03 Grinnz if you're using $c->render(data => $foo) you might want to also set the content type: $c->render(data => $foo, format => 'bin') https://metacpan.org/pod/Mojolicious::Types
05:03 woz joined #mojo
05:03 sunrise bin did it
05:04 sunrise i was trying my specific file type and it wasnt working
05:05 Grinnz you'd either need a format from Mojolicious::Types or to set the appropriate content-type header like the content-disposition header
05:13 sunrise ok, that works.
05:13 sunrise $c->res->headers->content_type then $c->res->headers->content_disposition('attachment; filename=..;') then $c->render(data => ..)
05:23 sunrise thank you for the help Grinnz
05:44 melo joined #mojo
05:54 disputin joined #mojo
05:57 melo1 joined #mojo
06:04 woz joined #mojo
06:28 disputin joined #mojo
06:36 Grinnz_ joined #mojo
06:45 disputin joined #mojo
06:55 dod joined #mojo
07:05 Grinnz joined #mojo
07:10 sattellite joined #mojo
07:32 disputin joined #mojo
07:42 kes joined #mojo
07:42 sattellite joined #mojo
07:45 sattellite_ joined #mojo
07:50 dod joined #mojo
07:50 disputin joined #mojo
07:51 Vandal joined #mojo
07:51 woz joined #mojo
07:55 dod joined #mojo
07:57 osfabibisi joined #mojo
07:57 sugar joined #mojo
08:04 meshl joined #mojo
08:13 AndrewIsh joined #mojo
08:16 disputin joined #mojo
08:17 sri thinking some more about it, is it actually a bug that you can $dom->wrap(...) the root element?
08:18 woz joined #mojo
08:18 sri you should really be calling ->wrap_content()
08:20 eseyman joined #mojo
08:26 trone joined #mojo
08:27 disputin joined #mojo
08:30 sri ah, yea, there are other cases too
08:30 sri ->append() and ->prepend() do nothing when called on the root too
08:40 good_news_everyon joined #mojo
08:40 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/vB0r0
08:40 good_news_everyon mojo/master 5bbb90d Sebastian Riedel: fix bug in Mojo::DOM where the wrap method would attempt to wrap an HTML/XML fragment around the content of root nodes
08:40 good_news_everyon left #mojo
09:08 vanHoesel joined #mojo
09:12 vanHoesel1 joined #mojo
09:15 berov joined #mojo
09:24 woz joined #mojo
09:30 stephen joined #mojo
09:31 vytas joined #mojo
09:38 n16gel joined #mojo
09:40 good_news_everyon joined #mojo
09:40 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/vB072
09:40 good_news_everyon mojo/master d51b3ae Sebastian Riedel: fix bug in Mojo::DOM where the wrap_content method would attempt to wrap an HTML/XML fragment around nodes that do not have children
09:40 good_news_everyon left #mojo
09:40 Eric joined #mojo
09:40 Zoffix \o/
09:44 sri hmm, not sure if that's correct
09:44 sri $dom->append_content('foo') called on a text node will append that to the text content
09:45 sri which is not quite consistent with $dom->wrap_content('...') called in a text node
09:58 sri i guess the current behavior kinda makes sense
09:58 sri it's not consistent, but there's no scoping issues
09:59 sri ->wrap_content is a different beast than ->append_content and ->prepend_content
10:00 sri since ->wrap_content can only work with html/xml fragments, not raw text content
10:09 woz joined #mojo
10:16 woz joined #mojo
10:18 woz_ joined #mojo
10:23 woz joined #mojo
10:23 Eric left #mojo
10:47 punter joined #mojo
10:48 melo joined #mojo
11:35 woz joined #mojo
11:39 CandyAngel "Hey, can you make this task be regarded as done in your script when X == Y?" "Sure, that's easy enough" *adds the one line of code and reruns the report* "It's gone down from 110 to 75" "Yeah.. actually, I want it to still be outstanding, can you undo that change?" -.-
11:39 woz joined #mojo
11:40 nic If you tell them 'no', it usually helps affect a change-of-thinking
11:41 CandyAngel They are lucky it is a VC'd Perl script and not in Excel or I would be demanding a full functional specification for any changes so they can have their thinking time :P
11:42 nic I have some customers to which I give an artificial 'queue delay' for that very reason
11:42 Zoffix One of the things my recent app I wrote for a coworker does is reduce prices for ~40 produces each month by 10%, because that coworker used to calculate each price by hand using a calculator....
11:42 Zoffix ...recently I've learned they still calculate each price each month by hand just to check my app got it right -_-
11:42 Zoffix s/produces/products/;
11:42 nic awesome
11:44 nic Saying that, I know a top-10 corporate accounting app that from time to time has troubles....   adding up numbers
11:44 Zoffix heh
11:45 nic couldn't get the annual accounts signed off because the numbers for March stopped adding up correctly (and some other periods)
11:46 nic the fix was to get their support techs to dial-in and "clean up some ghost records"
11:46 Zoffix The ghost in the machine! :D
11:47 nic I've been in so many meetings where I've been thinking but but I wouldn't get this kind of rubbish from an open-source app
11:53 CandyAngel nic: Unfortunately, I'm sat right next to the people who ask me -.-
12:04 nic s/Un//
12:04 nic Close enough to poke them in the eyes?
12:05 CandyAngel With a little chair movement, sure :P
12:07 woz joined #mojo
12:22 CandyAngel Okay, so my plan for my rewrite of this task report is to have "./app.pl import <type> <file>" for importing the data, which will just put the files in the right places, then "./app.pl generate" will create the database, populate it, create tasks and such, then "./app.pl report" can output the report to go into Excel
12:22 CandyAngel And the tasks table can have a field which records what data was used when it was deciding if it was done or whatever for ".app.pl why <task_id>"
12:23 CandyAngel I think that will work
12:25 kaare joined #mojo
13:05 woz joined #mojo
13:16 ajr_ joined #mojo
13:17 jberger "nic: I've been in so many meetings where I've been thinking but but I wouldn't get this kind of rubbish from an open-source app"
13:17 woz joined #mojo
13:17 jberger That was pretty much every piece of software we paid for at the bank
13:35 woz joined #mojo
13:44 sugar joined #mojo
13:56 dod joined #mojo
14:16 CandyAngel The saga continues
14:16 CandyAngel "Send them the new report please" "What new report?" "The one that regards those tasks as done" "You asked me to undo that" "No I didn't" :|
14:19 prg joined #mojo
14:23 * sri changes the title to "watercooler talk"
14:28 woz joined #mojo
14:29 prg joined #mojo
14:31 woz joined #mojo
14:32 jberger sri: the problems of a web framework this awesome, you don't need to discuss it much anymore
14:32 * jberger wonders how crab is getting on with the transaction refactoring
14:32 jberger I might be able to put in some time on that this weekend
14:34 sri \o/
14:38 n16gel joined #mojo
14:43 woz joined #mojo
14:46 disputin joined #mojo
14:48 CandyAngel sri: Hint taken :P
14:52 woz joined #mojo
15:04 woz_ joined #mojo
15:19 woz joined #mojo
15:37 disputin joined #mojo
15:38 woz joined #mojo
15:39 melo joined #mojo
15:59 voldemortensen joined #mojo
16:03 neilhwatson joined #mojo
16:06 ZoffixW joined #mojo
16:06 ZoffixW Shouldn't $t->app->stash( foo => [42, 43] ); with Test::Mojo set my stash var so that $t->app->stash('foo') returns that arrayref?
16:07 woz joined #mojo
16:08 ZoffixW I'm getting an undef
16:11 Grinnz ZoffixW, that's going to set the stash on an anonymous controller it creates... not very useful
16:11 Grinnz the appplication itself doesnt have a stash
16:11 ZoffixW Figured it out: my $c = $t->app->build_controller; and then operate on $c
16:11 Grinnz that works
16:11 asarch joined #mojo
16:12 punter joined #mojo
16:20 woz joined #mojo
16:38 woz joined #mojo
16:47 meshl joined #mojo
16:48 disputin joined #mojo
16:52 asarch I have '/students' and '/students.json' (the first one would render the JSON data from the second one). Question: in the controller, how would I get/call the data from /students.json? With LWP?
16:52 asarch (The HTML rendered data from /students.json)
16:56 sue joined #mojo
16:59 csson asarch: sounds like you want respond_to, https://metacpan.org/pod/Mojolicious::Controller#respond_to
16:59 csson If the client wants html give html, if it wants json give json.
16:59 ashimema am I missing something fundamental here: https://ssl.thorsen.pm/paste/4fcfb8e99d5f
17:00 ashimema getting very confused as to where my array wrapping is dissapearing
17:00 woz joined #mojo
17:02 ashimema any hints?
17:11 ashimema home time for many I reckon..
17:12 asarch I thought that you should use your own .json controller to be RESTful 100%
17:12 asarch Thank you csson
17:12 asarch Thank you very much :-)
17:17 woz joined #mojo
17:18 woz joined #mojo
17:19 ashimema anyone..
17:19 ashimema I'm totally confused
17:34 go|dfish ashimema: I've not used Minion myself but the example for enqueue is: my $id = $minion->enqueue(foo => [@args]);
17:34 go|dfish which suggests you would want to pass [$patch] not $patch
17:39 woz joined #mojo
17:53 jberger ashimema: go|dfish is right, the arguments passed to the task are given as an arrayref to enqueue
17:54 jberger That's because enqueue can also take arguments which control how the job is enqueued
17:56 ashimema oh.. of course!
17:56 ashimema thanks chaps
17:56 ashimema i'm going code blind
17:56 ashimema time to go cook me thinks
18:14 PryMar56 joined #mojo
18:23 dod joined #mojo
18:51 woz joined #mojo
18:53 trone joined #mojo
18:54 berov1 joined #mojo
18:55 woz joined #mojo
19:04 woz joined #mojo
19:04 voldemortensen joined #mojo
19:09 kyshtynbai joined #mojo
19:11 kyshtynbai Hi guys. Not sure if it is Mojo specific question, but anyway, does anyone know what value should I pass to the column of Postgresql database which is a prmary key and has SERIAL data type? If I pass undef, I recive an error. I use Mojo::Pg if it matters.
19:12 kyshtynbai I would like just to auto-increment primary key, of course
19:17 preaction you shouldn't pass it any value at all. pretend it doesn't exist
19:21 kyshtynbai oh, i see
19:43 sugar joined #mojo
19:43 ZoffixW joined #mojo
19:45 ZoffixW Is it by design that PODRenderer renders =head3 the same as =head2 and does not indent =head3s further down in the TOC?
19:52 phillipadsmith joined #mojo
20:05 ZoffixW h2 { font-size: 1.3em; } h2 { font-size: 1.1em; }... That difference is not detectable to me :/ Should use some colour
20:05 ZoffixW *h3 for the 1.1em
20:05 marcus The cuffs
20:06 ZoffixW ?
20:06 ZoffixW And h2/h3 are rendered in the same list in the TOC. That makes it rather useless :(
20:08 ZoffixW And L</_foo> containing underlines make it hard to see the underscore... And // operator on its own line gets syntax-highlighted as a comment.
20:08 ZoffixW Complain all the things! :)
20:12 ZoffixW Actually the highlight seems kinda bogus and doesn't highlight most things.
20:13 ZoffixW I'm talking about this, if anyone cares what I'm rambling about :) : cd $(mktemp -d); git clone https://github.com/perl6/modules.perl6.org.git . ; git checkout new-db-builder; ./bin/morbo;
20:13 ZoffixW And then view http://localhost:3333/perldoc/ModulesPerl6::DbBuilder::Dist::Source
20:13 ZoffixW But I guess beggers can't be choosers. Beats using perldoc from the shell
20:16 preaction that's a mojo app?
20:16 ZoffixW Yeah
20:17 ZoffixW modules.perl6.org now runs on Mojolicious
20:17 preaction nice
20:17 ZoffixW :)
20:17 preaction humph. github+travis... we need cpantesters for p6!
20:17 preaction ooh, that's a good idea. that ties into my cpantesters for python idea even...
20:17 ZoffixW Well volunteered! :)
20:18 sue joined #mojo
20:44 kyshtynbai joined #mojo
20:44 jberger :o
20:44 jberger http://www.sigtrapgames.com/sublevelzero/
20:45 ZoffixW .oO( I should save up money for a VR set... )
20:46 jberger I <3 Descent so much
20:47 jberger in fact a Descent 2 alternate levels page was the first website I ever created
20:47 jberger hosted on our isp's user pages
20:48 ZoffixW cool
20:49 batman joined #mojo
20:54 kyshtynbai joined #mojo
21:22 punter joined #mojo
21:22 woz joined #mojo
21:30 disputin joined #mojo
21:41 dod joined #mojo
21:56 Zoffix left #mojo
22:12 d4rkie joined #mojo
22:13 Zoffix joined #mojo
22:15 melo joined #mojo
22:17 Zoffix joined #mojo
22:18 Zoffix :S Mojolicious::Plugin::Bootstrap3 just died all of a sudden :/
22:24 Zoffix nm doing sudo su -c "gem install sass" on this box fixed the issue, whatever it was :/
22:24 Zoffix left #mojo
22:31 sue joined #mojo
22:48 woz joined #mojo
22:54 meshl joined #mojo
23:08 woz joined #mojo
23:35 woz joined #mojo
23:36 da5id joined #mojo
23:37 noganex joined #mojo

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