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

IRC log for #mojo, 2017-12-05

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

All times shown according to UTC.

Time Nick Message
00:42 Repaster joined #mojo
01:06 kaare_ joined #mojo
02:40 Armen joined #mojo
02:40 vinnix joined #mojo
02:43 ghenry joined #mojo
02:57 rickbol_ joined #mojo
02:58 ilbot2 joined #mojo
02:58 Topic for #mojo is now 🍩 nom nom | http://mojolicious.org | http://irclog.mojolicious.org | http://code-of-conduct.mojolicious.org
03:11 thejacobaco joined #mojo
03:13 rickbol joined #mojo
03:16 wouter joined #mojo
04:41 sh14 joined #mojo
04:43 sh14 joined #mojo
04:49 diegok joined #mojo
04:52 Seth joined #mojo
05:00 Seth joined #mojo
05:46 jberger https://twitter.com/joelaberger/status/937920965866123264
05:46 jberger man, that took all night and it feels like I only scratched the surface
05:47 jberger sri, I know you mentioned another whole article on generate, but I have to admit I'm not sure what all there is to say
05:47 jberger I left a hook there though
05:47 jberger I guess in terms of application commands perhaps
05:49 saki joined #mojo
05:56 inokenty-w joined #mojo
06:23 Grinnz speaking of taking all night, I'm just about ready to release https://github.com/Grinnz/Mojolicious-Plugin-Log-Any
06:28 Grinnz jberger: i didn't know about eval -v and -V, nice
07:10 Lee joined #mojo
07:11 dod joined #mojo
07:13 Grinnz and released https://metacpan.org/pod/release/DBOOK/Mojolicious-Plugin-Log-Any-0.001/lib/Mojolicious/Plugin/Log/Any.pm
07:16 geospeck joined #mojo
07:16 dod joined #mojo
07:41 Vandal joined #mojo
07:48 AndrewIsh joined #mojo
07:56 dim0 joined #mojo
08:31 karjala_ joined #mojo
08:34 CandyAngel jberger: In the Day 1 article, it says "It has tons of ways to keep you safe and you code safe".. should that be "your code safe"?
08:41 CandyAngel jberger: and in day 4, "This is a much more nature api", s/nature/natural/ ?
08:44 trone joined #mojo
08:51 rickbol_ joined #mojo
09:39 ppp joined #mojo
09:39 ppp ARE YOU MAD THOSE NIGGERS ARE TRYING TO STOP TRUMP??
09:39 ppp EMERGENCY KKK AND NAZI COALITION MEETING IN #/JOIN
09:39 ppp ON FREENODE IRC SERVER --IRC.FREENODE.NET--
09:39 ppp FREENODE IS AWARE OF THE GROUP AND SUPPORTIVE BUT PLEASE
09:39 ppp DON'T COMPLAIN ON #FREENODE.
09:40 ppp rickbol_ trone karjala_ Vandal dod geospeck Lee inokenty-w saki diegok wouter ilbot2 ghenry vinnix Armen kaare_ Repaster gordonfish jamesaxl Pyritic marty bwf caeles_ dallaylaen ashimema cascardo robinsmidsrod Psiman bit_shifter noganex esh mohawk Gedge sivoais schelcj jnbek dabudabu genio
09:40 ppp kivilahtio Xyem CandyAngel jacoby Kharec hkclark maschine gregf_ dustinm mfontani pirateFinn crab robx eseyman Jonis klapperl tianon jabberwok kgoess irqq_ stefan_ mbudde BinGOs arcanez pink_mist stryx` spicyjac1 charsbar abracadaniel bc547 perlpilot simon_ mishanti1 iamb preaction vicash sjn CHYC
09:40 ppp bjakubski zach Grinnz mtths Sebbe exp-innit mattp [vlad] ccakes VVelox chandwki Da mdom stokachu cng erry simcop2387 batman meredith plicease anparker phillipadsmith sri Ralesk odc karjala Zx3 elik go|dfish tempire jantore_ stein alilles kamyl_ Phil21 firnsy matt hernan604 skaji mrallen1 gabiruh
09:40 ppp left #mojo
09:45 inokenty-w ppp: No, we are those niggers are trying to stop Putin
09:47 kes joined #mojo
09:47 dim0 joined #mojo
09:49 trone O_o
09:50 kes heh... you just close the #1148 issue. Sadly, none has time to review my patch which fixes that.
09:50 kes maybe is it better do not try to fix at all?? ((
09:56 lodin joined #mojo
10:08 cng joined #mojo
10:16 dexteruk joined #mojo
10:27 Andreas3 joined #mojo
10:57 tchaves joined #mojo
10:58 Lee joined #mojo
10:58 dotan_convos joined #mojo
11:05 sri i wonder if minion should reset the "$SIG{PIPE} = 'IGNORE';" that Mojo::IOLoop does
11:06 sri suppose it should reset all signals used to default
11:06 sri i have a hunch that is what trips up some of our minion jobs at work
11:07 sri i mean, we already do a Mojo::IOLoop->reset
11:07 sri so, we try to make the job environment as clean as possible
11:07 sri it would be more correct
11:08 sri technically, i suppose Mojo::IOLoop->subprocess should reset $SIG{PIPE} too
11:10 sri hmm, on the other hand Mojo::IOLoop wouldn't work the same in subprocesses/jobs :S
11:25 pink_mist breaking change for 8.0?
11:26 sri i don't know which one is right
11:41 tyldis So render to PDF... Anyone used https://github.com/sharabash/Mojolicious-Plugin-PDFRenderer?
11:51 tyldis Oh, seems to do a recursive request.
11:53 dexteruk Hi im still trying to work out how to use this Mojo::DOM its either me or the instructions are writen for smarter people than me.    Its seems so easy what i need to do but i more sure Mojo::DOM is the right tool for the job
11:53 dexteruk I have a HTML with a TAG called <section > ..... </section> i just need to extract that part from the whole HTML
11:54 dexteruk i can do it with awk without any issues
11:54 dexteruk but it seems to me that i should be able to do this simply from the body returned from the UserAgent
11:55 dexteruk rather than awk the file itself
12:11 mishanti1 dexteruk: When you say 'extract' do you mean "remove the tag <section>...</section> from the html and be left with a dom without that tag" or do you mean "retreive the <section>...</section> tags contents"?
12:12 dexteruk basically i want to have only the <section .... </section> removing all the html, body and scripts
12:13 dexteruk from what i can tell i should be able to use the ua dom to directly access the correct dom
12:14 dexteruk for example $ua-get(url)->res->dom->html->body->section
12:14 mishanti1 dexteruk: perl -e 'use Mojo::DOM; print Mojo::DOM->new("<html><section>Foo</section></html>")->find("section")->first->text;'
12:15 mishanti1 dexteruk: or in your case `dom->find('section') etc etc`
12:15 pink_mist instead of ->find(...)->first
12:15 pink_mist just do ->at(...)
12:15 mishanti1 I'm sure someone hare can point you to the elegant way of doing it. I just reached for the hammer. :)
12:16 mishanti1 ...link pink_mist just did. :p
12:16 mishanti1 s/link/like/
12:16 dexteruk ok but when i use find it put the data into a collection where all i want is as a string that i can pass to base64 to store the structure
12:17 mishanti1 dexteruk: see what pink_mist said.
12:18 dexteruk great
12:19 dexteruk that works i was missing the ->first part
12:19 dexteruk i know it was going to be easy once you know how
12:22 tyldis jberger: I need an advent post on roles tomorrow, by the way. kthxbye!
12:23 CandyAngel I approve of roles.. if only because I managed to write one and didn't have anything explode
12:24 sri roles are cool
12:27 tyldis I have the same code surrounding several devices from various manufacturers. So their APIs are vastly different, but the workflow is the sdame. Roles seems like a good fit
12:40 simon_ I'm in web-mode in emacs and my multi-line <%= include '...', ...params... %> keeps re-indenting whenever I copy-paste stuff into my buffer. I feel like it's got the wrong idea about how I like to indent. i.e., not:
12:40 simon_ <%= include 'company_profile_list/ad_row',
12:40 simon_ ad              => $ad,
12:40 simon_ section         => $ad->type,
12:40 simon_ but rather so that 'ad => ...' is just below the "ude 'company_pr..."
13:17 kes joined #mojo
13:19 pink_mist don't paste, please
13:19 pink_mist use a gist or something
13:20 pink_mist and your question is really more of an emacs question than anything
13:20 * pink_mist has never used emacs
13:57 jberger tyldis does it have to be tomorrow?
13:58 dotan_convos joined #mojo
14:01 tyldis jberger: Hehe, no :)
14:02 jberger There is certainly a roles article planned. Provably soonish
14:02 jberger Probably
14:30 sri coolo just reminded me that i meant to add support for multiple migration files to Mojo::Pg::Migrations
14:30 sri not exactly sure what would look best though
14:31 sri i do like the up/down version comments
14:31 gizmomathboy joined #mojo
14:31 sri so, perhaps just something that concatenates all .sql files in a directory
14:33 sri app->pg->migrations->from_files(app->home->child('migrations'));
14:33 sri app->pg->migrations->migrate;
14:34 mishanti1 sri: While still keeping the '-- X up/down' syntax?
14:34 sri yea
14:34 sri you'd basically make up your own naming scheme
14:35 sri and the system only cares about the comments
14:36 sri alternative would be to dictate a naming scheme to get rid of comments
14:37 sri migrations/05_up_some_feature.sql
14:37 sri migrations/05_down_some_feature.sql
14:41 sri Grinnz: preferences?
14:42 sri (personally i tend towards 05_up_some_feature.sql, since people tend to just abuse too much freedom)
14:42 sri :p
14:43 * sri glares at CandyAngel
14:46 mishanti1 At $work we have migrations placed in version-specific directories. Eg. `6-7/`, `7-6/` etc, and the migration-tool slurps all files in each directory it needs to process.
14:46 mishanti1 Not a perfect solution but it does make it tidy when having migrations that eg. need to span multiple files due to (bigger-ish) datasets that needs to be loaded.
14:47 mishanti1 An example is having some geo-bounds that are fairly large. The application _needs_ that new data loaded when upping to a new version, but you _really_ do not want your editor to have to load that data when working on migration-steps.
14:47 sri migrations/up/05/some_feature.sql is also an option of course
14:48 sri or migrations/05/up/some_feature.sql
14:48 sri with one or more sql files
14:49 simcop2387 mojolicious is now powering https://perl.bot/ :)
14:49 sri last one would scale the best
14:53 sri suppose i go with migrations/05/up/foo.sql
14:54 sri the 0 prefix being insignificant, so 5, 05, 005 would all work the same
14:55 sri and sql files ordered alphabetically
14:59 kes Maybe somebody have a time to make patch review, please?
15:08 jberger CandyAngel: thanks, fixed
15:10 jberger kes: which patch?
15:13 kes jberger: https://github.com/kraih/mojo/compare/master...KES777:do_not_lose_captures_for_embedded_apps?expand=1
15:14 kes Here I fix the: #1148 issue
15:18 hkclark joined #mojo
15:21 jacoby joined #mojo
15:21 jberger kes: it is interesting that you had to disable caching in that test
15:22 jberger is that because of the way the test works or does it actually change something related to caching?
15:22 kes I can explain why I did that
15:25 gryphon joined #mojo
15:26 kes That is because of Lite application is singleton. And when the App is mounted twice we need to disable caching. Otherwise the cache will be shared
15:26 kes between mountpoints
15:27 kes Or ( I am not sure) we should add mountpoint path into the $path
15:28 kes on this line:
15:28 kes https://github.com/kraih/mojo/compare/master...KES777:do_not_lose_captures_for_embedded_apps?expand=1#diff-6e5e5efb5e0e6c3cb4157384b8472135R83
15:28 kes to distinguish: /:point_one/bye  and /:point_two/bye
15:29 kes currently both request are cached as: GET /bye 0
15:32 jberger that is an interesting question
15:33 kes and there is no such problem for full app when you create application instance for each mountpoint
15:35 tchaves joined #mojo
15:45 ChmEarl joined #mojo
15:52 Grinnz sri: not sure how i feel about putting too much importance in the file names. but as long as i can still use it all in one file i don't mind either way
15:52 sri single file migrations wouldn't change at all
15:52 sri i'm just thinking about how i'd manage migrations for very large projects
15:54 sri so, what i'm looking for basically is the cleanest directory structure for say 500 migrations
15:55 sri for example, i like the idea of allowing migrations/125/README.md
15:56 sri to explain very big and complicated migrations
15:56 mishanti1 +1 for that :)
15:56 sri you know, when the explanation really doesn't fit into a commit message or comment
15:57 Grinnz sounds reasonable
15:58 Grinnz never used migrations for a large project, because the only large project I've worked on lately uses mysql 🤐
16:02 jberger kes: I can't reproduce here
16:02 jberger it doesn't look like two light apps share the same cache
16:02 Afristar joined #mojo
16:02 jberger s/light/lite/
16:03 kes may you please post gist
16:03 jberger https://gist.github.com/jberger/b0999dacc596edb715b8d62adda82614
16:03 jberger I played with several variations of routes and order of calling
16:03 jberger and finally just decided to dump the caches
16:04 jberger if the caches aren't shared then there is no reason they should collide in the way you suggest
16:05 CandyAngel sri: What? What did I do?!
16:05 kes jberger: This occur when you embed same app twice
16:05 kes try this: http://paste.scsys.co.uk/566087
16:06 jberger CandyAngel: did you become our resident maniac?! That was my title!
16:06 dod joined #mojo
16:07 Afristar Hello. I have a question about receiving a streaming response and following redirects using Mojo. I have the subroutine as shown in https://paste.kotsendekat.nl/ejefumemom.pl (I used the cookbook for this subroutine). The subroutine is suppod to start a transaction and follow redirects. However, this function hangs indefinitely (on the while loop) when the server returns a 307 response. It seems that my subroutine does not follow redirects.
16:07 Afristar What am I doing wrong here? (I am a beginning Perl developer)
16:08 jberger kes: I'm almost certain that in the previous conversations about this topic we said don't route to the same embedded app twice
16:08 jberger Afristar: hello, I'll look in a second
16:08 jberger we have a few other conversations going on at the moment, but I'll be happy to look soon
16:09 jberger (unless someone else beats me to it)
16:09 Afristar Sorry, I posted the wrong code snippet. This is the correct snippet: https://paste.kotsendekat.nl/zucumibolo.pl
16:09 Afristar Thank you. :)
16:09 CandyAngel jberger: Mayyyyyyybe (also, you're welcome :P)
16:09 Pyritic joined #mojo
16:13 jberger kes: ah, it seems the previous conversation you were mounting the same app into itself
16:13 jberger https://irclog.perlgeek.de/mojo/2017-10-31#i_15382332
16:13 jberger which is even more strange
16:13 jberger I'm not sure what I would expect to happen when I mount the same application twice
16:13 jberger (both into a third)
16:13 jberger but it is beyond the time I have to think about right now
16:14 jberger kes: I'll try to remember to write a summary on the mailing list post to try to keep this discussion alive
16:14 jberger because I think the goal of routing to mounted apps with placeholders is interesting
16:14 jberger I'm just not as sure about the multiple app reuse questions
16:15 jberger Afristar looking at yours now
16:16 jberger Afristar: what is it that you are trying to accomplish?
16:18 jberger manually subscribing to the content's read event is for handling streaming responses
16:19 jberger but it looks like you are treating it as a finished response
16:20 Afristar This function snippet is part of a monitoring program that tries to connect to a web radio station (streaming http) and attempts to get data. If it gets data (so the response is 200 and I am reading data) then the radio station is considered alive. Else it is put on a list of dead radio stations. That is the overall idea.
16:20 Afristar And I used the streaming response in the cookbook example to get started because regular HTTP clients do not handle streams very well.
16:21 Afristar Some radio stations however redirect you. That is fine, but my radio monitor should be able to handle that.
16:21 jberger ok so you are connecting to a url that provides a streaming response but you don't actually care about the stream, just that you connected
16:21 jberger am I understanding that correctly?
16:21 Afristar Yes. If the response code is 200 and I can read an arbitrary number of bytes then it´s OK.
16:22 sri the while loop is pointless
16:22 sri you'd use the read event to wait for one chunk of response data and then finish the transaction manually to make $ua->start return
16:23 jberger sri: intercepting the read event is going to interrupt automatic redirect following though right?
16:23 sri depends on what you do there
16:24 sri only headers matter for following redirects
16:24 jberger Afristar: (aside) perhaps it is possible to try some different approach too, would a HEAD request work instead of a GET?
16:24 jberger I guess you wanted SOME data
16:25 Afristar Some data would be nice, yes.
16:25 sri i use the technique in a test case here https://github.com/kraih/mojo/blob/master/t/mojolicious/longpolling_lite_app.t#L237
16:25 sri but that is failrly advanced, and not explained in the docs
16:26 sri reads at least 3 bytes from the body and then raises an error to short circuit the request through the user agent
16:27 Afristar Perhaps in a later stage I´d like to actually parse the read data (perform some DSP and read actual audio data), so that´s another reason why I´d like to fetch some data.
16:27 Afristar For now just knowing there is data is sufficient.
16:32 Afristar sri: I assumed that the start of the transaction would be non-blocking and for reasons I can´t remember I wanted it to be blocking, so that´s why I put the while loop there.
16:33 jberger Afristar: do you have a url handy to try with? you can pm it to me if you prefer
16:35 Afristar jberger: http://rrr.sz.xlcdn.com/?account=rtv_oost&amp;file=RadioOost_mp3&amp;type=live&amp;service=icecast&amp;output=m3u
16:37 karjala_ joined #mojo
16:42 ghenry joined #mojo
16:45 sri Afristar: your assumption was wrong
16:49 jberger Afristar: is that stream live or dead?
16:49 Afristar jberger: The stream is live.
16:49 Afristar Should be at least
16:49 Afristar Let me Check My Assumptions (sri)
16:50 Afristar Yes, it´s alive.
16:50 jberger oh indeed it is
16:51 jberger ran my script with MOJO_USERAGENT_DEBUG=1 and I see it
16:51 Pyritic joined #mojo
16:56 jberger Afristar: that was a fun one, here's what I came up with: https://gist.github.com/jberger/b5e35ffd5231ad44ef6178d4a94fba27
16:56 jberger I think what was happening is that on the redirect you get a new content object
16:56 jberger and so the thing that was supposed to be listening for data wasn't
16:57 jberger actually that means I can clean it up even more
16:58 jberger updated
17:00 Afristar So you are interrupting the stream on line 13 as soon as you get a chunk of data. To my untrained eye this looks like an unclean way of closing the stream. Is that true or have I missed something?
17:01 jberger tbh I haven't done that much with streaming responses so I just took the mechanism sri used in his test
17:01 jberger perhaps there is some other way, but this one works
17:03 jberger (or perhaps I should say that I don't think I've ever worked with streaming responses that don't eventually terminate of their own accord)
17:03 Afristar Thank you very much. I will try this out as soon as I get home. :) I have another unrelated question.
17:04 jberger sri: is this the rare case for $tx->closed?
17:04 jberger Afristar: shoot
17:04 Afristar Some older versions of Shoutcast reply with an ICY response instead of an HTTP response. ICY is pretty much the same has HTTP, but in the current version of my script Mojo throws an error. Is there any way I can deal with an ICY response?
17:05 jberger well I have no idea what the difference is nor what the error is, so I have no idea
17:05 jberger worst case scenario, you could implement your own minimal client using Mojo::IOLoop::Client
17:06 jberger but that's just the raw TCP
17:07 jberger people have tried to use Mojo::UserAgent to work with non HTTP/nearly HTTP things before; basically our response is "we don't support it" but it you can make it work that's up to you
17:07 Afristar Let me find you an example of a radio station that sends ICY. The error Mojo throws is ¨Bad response start-line¨.
17:07 jberger (there was some horrific protocol that needed to ensure connection reuse/keep-alive in some strange way)
17:08 jberger well, that's a bad start ;-P
17:08 jberger (hehehehehe)
17:09 Afristar jberger: http://pr320.pinguinradio.com:80/;stream.mp3
17:10 sri http://instantrimshot.com/index.php?sound=rimshot&amp;play=true
17:10 jberger Afristar: well this doesn't look good for your prospects: https://github.com/kraih/mojo/blob/master/lib/Mojo/Message/Response.pm#L98
17:10 Afristar You can see the ICY 200 OK response using Wireshark or in plain text using (((IE)))
17:10 Afristar Apparently Firefox and VLC know how to deal with it.
17:11 Afristar AH.
17:11 Afristar That indeed does not look good. :P
17:11 Afristar My current solution is catching the error and assuming it must be ICY.
17:12 Afristar But that is not really a solution as we still don´t know whether the radio station is alive or not.
17:13 Afristar Maybe I should write those radio stations an email with a picture of my angry face that they should update their Shoutcast software. :P
17:13 jberger yeah
17:13 Afristar ICY is supposed to be dead and buried.
17:13 sri so, what makes the icy start line incompatible with http?
17:13 jberger that it doesn't contain HTTP version
17:14 sri oh
17:14 Afristar Nothing. Afaik it can be interpreted as HTTP 0.9.
17:14 sri was about to say
17:14 sri that's 0.9-ish
17:14 sri which we no longer support
17:14 Afristar I think that is exactly what Firefox does: interpret it as HTTP 0.9.
17:14 Afristar And perhaps VLC too.
17:14 Repaster joined #mojo
17:15 jberger MOJO_USERAGENT_DEBUG=1 mojo get 'http://pr320.pinguinradio.com:80/;stream.mp3'
17:15 jberger if it was for some new protocol, I could maybe MAYBE see trying to make something work
17:16 jberger as it is for a retired protocol, I don't see that happening
17:16 jberger but, you could try your hand with Mojo::IOLoop::Client
17:16 Afristar I think that is my best option then.
17:17 jberger I got it to work with telnet and just the string: GET /;stream.mp3 HTTP/1.1\x0d
17:18 jberger so that's basically what Mojo::IOLoop::Client is
17:18 Afristar Your terminal was filled with gibberish from the stream? :P
17:18 sh14 joined #mojo
17:18 jberger (then I had to kill my terminal because I can never remember what the escape stuff is in there)
17:18 jberger yes
17:19 Afristar I don´t mind having a go at that. Sounds like a fun challenge.
17:20 Afristar The whole radio monitor started as a Perl exercise that got out of hand. :P
17:20 jberger don't they all :-P
17:20 jberger well have fun with it, if you're having fun then this is all worth it
17:20 Afristar But the current (slightly broken) version is actually in production right now monitoring all radio stations offered by a Dutch web radio portal that I am developing and maintaining.
17:21 Afristar So it is actually going to be a really useful engine (reference right there) when it´s done.
17:21 jberger neat
17:21 jberger of course be sure to check the failure cases
17:22 Afristar And then maybe it won´t send me a Telegram message every hour complaining about radio stations that aren´t broken. :P
17:22 jberger we've only tried for live ones here
17:22 sri oooh, a new the expanse book is out :O
17:22 * jberger checks for Winds of Winter
17:22 Afristar It is my intention to cover all cases eventually. The ICY case however will have to wait for a bit. :)
17:23 Afristar Right, I really should get back to my Fourier analyses now. I have already been spending too much time on not doing what I was supposed to do. Thanks again. Will give a shout later when it works. :)
17:23 jberger let us know how it goes
17:25 sri so, any more opinions on the Mojo::Pg migration directory strucutre?
17:25 sri migrations/05/up/foo.sql it should be?
17:26 sri which would remove the comment requirement
17:27 simon_ anyone here who uses emacs web-mode and finds that mojo template files don't indent perfectly? e.g. having an '% } elsif (...) {' messes up the expected indentation levels compared to when I have only 'if' and 'else' lines.
17:28 simon_ having forced indentation to a certain level is a major feature in emacs for me, but it drives me nuts that modifying the buffer the wrong way re-indents everything in an insane way.
17:29 jberger sri the single-file comment style would remain? I really like that
17:30 jberger if so then sure, that structure is fine
17:30 jberger would "migrations" be the name of the migration set?
17:30 sri jberger: of course, nothing changes, just an addition
17:30 Grinnz 'migrations' would be the directory name you supply it to read, rather than the filename for the current method
17:30 sri app->pg->migrations->from_dir('myapp/migrations')
17:31 Grinnz from_dir, i like that
17:31 jberger if you do do that, perhaps you want to want to add some way to run a perl script before/after
17:31 sri instead of ->from_file
17:31 jberger with that it is basically a full-fledged migrations tool
17:31 sri can always add that later
17:31 jberger though that might be scope creep
17:31 jberger yeah
17:32 sri it ignores all non sql files
17:32 sri for now
17:32 jberger I'd definitely document that that should not be relied on :-P
17:38 dim0 joined #mojo
17:39 Grinnz well this is a baffling error report http://www.cpantesters.org/cpan/report/dd116a7c-d4c6-11e7-b57a-ff913f784bd2
17:42 Grinnz how could Mojo::IOLoop::Delay not have an ioloop attribute
17:43 sri inherited
17:43 Grinnz right so it should be there
17:43 jabberwok joined #mojo
17:44 sri old mojo version
17:44 Grinnz it says it's 7.57
17:44 * sri shrugs
17:45 Grinnz i got that same error from a few of slaven's smokers
17:45 gizmomathboy I'm having problems crafting the correct way to find/extract/whatever with mojo-dom with div's with classes like: ReceiptDetail-Foo, where Foo can be 1 of 7 things (like itemDescription, itemUnitPrice etc)
17:46 jberger I swear some of his smokers have weird things in them, but I've never been able to pin them down
17:46 jberger but he has found many real bugs for me so I don't want to raise too much trouble over them either
17:47 jberger gizmomathboy: the css3 spec for "or" is pretty clunky
17:47 jberger it is a comma, at the top level of your query
17:48 gizmomathboy yeah, I was thinking I might have to do something like find('div^=ReceiptDetail')->each
17:48 Grinnz 'div.ReceiptDetail-Foo, div.ReceiptDetail-Bar'
17:48 jberger oh, maybe matches? http://mojolicious.org/perldoc/Mojo/DOM/CSS#E:matches-s1-s2
17:48 gizmomathboy ah, thanks, I give that a go
17:49 Grinnz yes you could do it with matches, but it's not much better
17:49 gizmomathboy jberger, I was looking at that but I do this so infrequently I forget all that stuff and have to relearn it :-)
17:49 Grinnz i don't think there's any way in css to wildcard-match classes
17:49 Grinnz they're supposed to be specific whole words really
17:49 jberger Grinnz: it depends how much of the query comes before the or-ed bits
17:49 gizmomathboy so find('div.foo, div.bar, div,baz')?
17:49 Grinnz 'div:matches(.foo, .bar, .baz)' should work too
17:50 gizmomathboy cool, I'll give that a try, too
17:50 jberger which is much better if the query really is '.this .that .the-other div:matches(.foo, .bar, .baz) .the-thing-I-need'
17:51 jberger rather than expanding that out
17:51 Grinnz oh, yeah
17:52 Grinnz sri: i was going to ask how you keep the Minion tests from failing on windows where workers will just die, then i remembered you dont run pg tests without TEST_ONLINE
17:54 Grinnz i'm jsut gonna have to skip a lot of the tests on windows i guess
17:55 gizmomathboy Grinnz, so something like this should work: $dom->find('div:matches(ReceiptDetail-itemDescription)')->map('text')->each;
17:56 Grinnz .ReceiptDetail-itemDescription, but there's no reason to use :matches for just one class
17:57 gizmomathboy I was just trying it with one class before I add in the other 6 or so
17:58 Grinnz basically the selector 'div.foo, div.bar, div.baz' is equivalent to 'div:matches(.foo, .bar, .baz)' but the latter has the benefit of being one selector you can use in a larger chain
17:58 Grinnz so 'div.foo' and 'div:matches(.foo)' are also the same
17:58 gizmomathboy can I plop in a scalar in place of ReceiptDetail-itemDescription? Like I have an array of the classes, join them with a comma and then just have $classes?
17:59 Grinnz you can use string interpolation to form a selector, sure
17:59 Grinnz remember each class needs to start with a . though to be applied as a class name
17:59 gizmomathboy for instance: my @divs = $dom->find('div:matches($classes)')->map('text')->each;
17:59 gizmomathboy ah, not have the . might be killing it...
18:00 Grinnz my $classes = join ', ', map { ".$_" } @classes;
18:00 jberger yeah, without a . it is a tag name
18:01 jberger and you need a "" to interpolate
18:01 jberger that's just the perl of it
18:01 gizmomathboy yeah, that's next edit :-)
18:02 gizmomathboy welp that got me more than before...now to look closer at the html spaghetti the web site gives me
18:02 gizmomathboy thanks all
18:25 Seth joined #mojo
18:28 Seth1 joined #mojo
18:30 trone joined #mojo
18:47 trone joined #mojo
18:49 Pyritic joined #mojo
18:52 xarcus joined #mojo
19:11 lodin joined #mojo
19:11 kes jberger:
19:11 kes thank you for review.
19:11 kes The caching in case when same app is mounted twice is the *different* problem.
19:11 kes I disable caching in my patch only to keep tests PASS:
19:11 kes Here them are:
19:11 kes https://github.com/kraih/mojo/blob/master/t/mojolicious/embedded_lite_app.t#L140
19:11 kes https://github.com/kraih/mojo/blob/master/t/mojolicious/embedded_lite_app.t#L144
19:11 kes Because when application is embeded second:
19:12 kes https://github.com/kraih/mojo/blob/master/t/mojolicious/embedded_lite_app.t#L96
19:12 kes and third times:
19:12 kes https://github.com/kraih/mojo/blob/master/t/mojolicious/embedded_lite_app.t#L98
19:12 kes That should be the *ANOTHER* application instance. But lite application is
19:12 kes singletone. It is impossible to create two or more instances of MyTestApp::Test1
19:12 kes Currently in tests you share this lite app between mountpoints, so cache is shared too.
19:12 kes Therefore I disable caching.
19:12 kes The caching for embedded apps is the different problem.
19:12 kes Sebastian recomends me split problems,
19:12 kes so in this patch I just make captures to work.
19:12 kes The main idea I used is init captures of embedded application by the captures
19:12 kes of parent application:
19:12 kes https://github.com/kraih/mojo/compare/master...KES777:do_not_lose_captures_for_embedded_apps?expand=1#diff-6e5e5efb5e0e6c3cb4157384b8472135R73
19:12 kes as you can see changes are minimal.
19:12 kes What can I do futher to improve this patch (except tests of course)?
19:12 kes Is there maybe any critical notices?
19:26 trone joined #mojo
19:27 jnbek joined #mojo
19:32 karjala_ joined #mojo
19:36 Pyritic joined #mojo
19:49 itaipu joined #mojo
20:03 CandyAngel I'm still all indecisive about how to handle this packet parsing
20:03 CandyAngel Like.. I can just have a encode/decode, or an object which does ->parse and returns the appropriate object.. maybe using roles for the different packet types..
20:05 Grinnz you could make objects modeled after NetPacket?
20:05 Grinnz maybe not the greatest api, but it works
21:14 Repaster joined #mojo
21:18 CandyAngel I'll figure something out :P
21:19 CandyAngel The payload actually uses information that is in the header
21:19 CandyAngel As far as I can tell, that's not what NetPacket really expects for each type
21:20 CandyAngel Why they decided to do length-object_id-type, rather than length-type-object_id.. I have no idea
21:20 CandyAngel Specially because there is a special object_id that says that multiple objects are referenced in that packet
21:25 CandyAngel Oh yeah
21:26 CandyAngel In Mojo::Server::Daemon, on the 'close' event, it does: sub { $self && $self->_close }
21:26 CandyAngel Why is there the extra "$self" in there?
21:27 jberger checks that it still is defined
21:27 jberger you need to do that if there is weakening involved
21:28 CandyAngel Ah okie
21:28 CandyAngel I see :)
21:28 CandyAngel I'm tempted to make this server have a web interface and draw the current situation on a HTML canvas or something
21:29 CandyAngel But I think I have butchered it beyond being able to just add it as-is
21:39 CandyAngel I should actually make a website for this project. Not sure what web framework to use.. any suggestions? ^_^
21:40 jberger remind me what the project is?
21:40 jberger (my brain is kinda full, so things are getting ejected quickly)
21:41 CandyAngel 3rd party server implementation for a really old chat program whose servers might go offline soon
21:42 jberger ok so your mention of canvas had me thinking I didn't have any suggestion
21:42 jberger but for something like that, I'm a big fan of vue js
21:42 CandyAngel Watching Human Fall Flat while my jokes do the same :P
21:43 jberger oh, heh, I totally missed it
21:44 CandyAngel ^_^
21:44 jberger I assumed you meant front-end framework, I mean, no one here would have a backend framework suggestion for you :-P
21:45 CandyAngel Was thinking of the canvas thing so I could draw the position/orientation of the users
21:45 CandyAngel Partly because there is some serious weirdness about the position actually in the official client
21:45 CandyAngel If I make the server say everyone is teleporting to their new position, works fine
21:45 CandyAngel If I say they move to it, the position and rotation is slightly wrong
21:58 mgrimes joined #mojo

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