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

IRC log for #mojo, 2015-11-11

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

All times shown according to UTC.

Time Nick Message
00:28 mib_xnobp2 joined #mojo
00:28 mib_xnobp2 hi
00:30 absolut__ joined #mojo
00:32 preaction hello
00:49 disputin joined #mojo
01:29 Zoffix joined #mojo
01:57 cheesekun joined #mojo
02:43 mattastrophe joined #mojo
02:45 voldemortensen joined #mojo
03:07 kaare joined #mojo
04:04 val joined #mojo
04:21 inokenty-w joined #mojo
04:52 val joined #mojo
05:13 melo joined #mojo
05:17 absolut_todd joined #mojo
05:18 val joined #mojo
07:03 McA joined #mojo
07:41 ashimema joined #mojo
07:43 absolut__ joined #mojo
07:53 Vandal joined #mojo
08:02 osfabibisi joined #mojo
08:12 AndrewIsh joined #mojo
08:24 trone joined #mojo
08:47 kes joined #mojo
08:57 dod joined #mojo
09:03 dod joined #mojo
09:10 punter joined #mojo
09:14 cheesekun joined #mojo
09:27 nic joined #mojo
09:48 vanHoesel joined #mojo
09:55 kes What does this error mean? Bad name after hpanel' at template form.html.ep line 86, <DATA> line 46.
09:55 kes the 86 line is "%= content 'hpanel';"
09:58 nic I might be able to help if you can produce a tiny example that gives the same error (and pastebin the entire lite_app so I can run it)
09:59 nic Often when constructing a tiny example that exhibits the problem, the cause of the problem jumps out at you, but if it doesn't at least it'll be easy for anyone to diagnose what's going on
10:02 kes Hi, nic.
10:02 nic 'lo
10:02 kes Does sri agree with you yesterday?
10:03 nic The version on github now lets you use layout+extends
10:04 nic So if you want to try it out, now's the time!
10:05 kes cool (Y)
10:05 nic cpanm -l dep https://github.com/kraih/mojo/tarball/master; export PERL5LIB=$PERL5LIB:$PWD/dep/lib/perl5
10:07 kes nic: about last question. It is my mistake... I just miss ' sign in code before
10:07 shadowpaste "kes" at 217.168.150.38 pasted "Bad name after hpanel' at template" (7 lines) at http://paste.scsys.co.uk/501272
10:08 kes example to reproduce error
10:09 kes it seems parser (????) eat all lines after line 3 at example but must be stoppend at the end of line
10:10 kes because the % is Perl code line
10:12 kes I yesterday catch another notice about '%' in templates. Have you time to discuss?
10:15 Quai any strings in perl might me multi lined. The parser is doing the right thing IMO.
10:17 nicomen stopped at next ' it found
10:17 nicomen which was three lines down
10:18 nic kes: that's good that you found the cause
10:18 nic if you have another query, just create another tiny example exhibiting the same problem
10:22 shadowpaste "kes" at 217.168.150.38 pasted "notice about % at template" (20 lines) at http://paste.scsys.co.uk/501276
10:24 nic kes: That's nearly there, but it's not a lite_app I can run
10:24 nic Until I can run it, I can't be sure you're executing what I'm guessing you're executing, and that would lead to us both wasting time
10:24 kes ok. I will create small apps for both cases
10:25 nic I'm sure just one app will do both
10:25 mattastrophe joined #mojo
10:26 nic btw, if you're in a context where whitespace is significant, you usually want to be using the "<%= xyz %>" format
10:26 kes it does not help. I will describe in app
10:26 nic k
10:28 punter joined #mojo
10:32 berov joined #mojo
10:40 shadowpaste "kes" at 217.168.150.38 pasted "notice about % at template" (94 lines) at http://paste.scsys.co.uk/501284
10:41 kes nic: done
10:45 nic k, when you said you were doing both cases, I thought you meant the cases "% " and "<% %>"
10:46 nic I'm ignoring the case of the missing ' because you've already solved that self-inflicted problem
10:46 nic re extra space at the start and end of blocks, yes that happens
10:47 shadowpaste "kes" at 217.168.150.38 pasted "extended by <%= xyz %>" (70 lines) at http://paste.scsys.co.uk/501285
10:47 nic you can take measures to avoid it, but in my experience you end up with something worse
10:47 nic note that your block really does have a "\n" at the end, so the templating did the right thing
10:48 kes I have only one, not two
10:48 nic and it has a "\n" at the start, so alignment will indeed be what you see
10:48 kes which start you mean?
10:50 shadowpaste "nic" at 217.168.150.38 pasted "An ugly way to avoid whitespace issues" (3 lines) at http://paste.scsys.co.uk/501286
10:51 nic Remember what I said about using "<  >" if whitespace matters
10:51 nic (I haven't tried out that code; I'm rushing thru this a little)
10:51 kes oh, I forget about that the % replaced by <% %>
10:52 nic The block of yours which I've rewritten... yours had "\n" at the beginning and ending
10:53 kes but stop. the % is replaced by <% =%>
10:53 kes so trailing whitespaces should be removed
10:53 kes http://mojolicio.us/perldoc/Mojolicious/Guides/Rendering#Embedded-Perl
10:53 nic tbh, in all my html I accept a little extra whitespace; it's much more important that the source is readable; the target really doesn't care
10:53 AndrewIsh joined #mojo
10:55 pink_mist nic: just putting a = at the end of the <% =%> isn't too bad to get rid of that though =)
10:55 kes it must be placed by default (as doc says)
10:56 kes or doc mean the trainling spacec inside <% =%> block?
10:56 kes s/spacec/spaces/
10:57 nic pink_mist: true
10:57 nic kes: In your tiny app, do three templates for the three ways of constructing it and compare the output
10:58 jontaylor joined #mojo
10:58 kes nic: ok
10:58 kes in the third example there is wrong line number at error message
10:58 kes 6 vs 7
10:59 kes Sorry. I need to go away now (( I will back for an hour...
11:10 kes I back =)
11:11 kes It better I will create tests for that and put on branch of forked mojo.
11:23 shadowpaste "nic" at 217.168.150.38 pasted "Whitespace in templates" (67 lines) at http://paste.scsys.co.uk/501287
11:24 nic kes: Look at that example.  I believe 'reallystripped' is the one you're looking for
11:25 nic btw, there is no forked mojo.  github hosts the development branches.  Once/if code has passed its probation it gets released to CPAN at an appropriate time
11:27 kes I mean I form your project on github and will work on my repository to not disturb mojo dev team.
11:27 kes s/form/fork/
11:28 kes and discuss those tests here.
11:28 nic hacking mojo doesn't sound to me like a product way forward
11:29 nic using "mojo generate lite_app Abc" and reading about test-driven design might get more useful results
11:29 kaare joined #mojo
11:30 kes not hacking mojo, just add tests to /t
11:34 punter joined #mojo
11:36 dboehmer joined #mojo
11:36 dboehmer I'm having problems using rlib in my Mojolicious startup script
11:37 dboehmer when starting my app with `morbo` rlib points to lib/ in my home directory
11:37 dboehmer i've created a small test app to verify the problem
11:37 dboehmer if i should create an issue on github?
11:38 melo joined #mojo
11:39 nic kes: You don't need a fork for that
11:40 nic cpanm -l dep --look https://github.com/kraih/mojo/tarball/master
11:40 nic will give you the distro, from which you can copy t/ to your project dir
11:40 nic then add tests within your project
11:42 nic dboehmer: Can you paste the app to http://paste.scsys.co.uk/mojo ?
11:44 kes dboehmer: paste please the command how you run your script
11:47 shadowpaste "dboehmer" at 217.168.150.38 pasted "morbo breaking "use rlib" in Mojolicious app" (14 lines) at http://paste.scsys.co.uk/501288
11:47 dboehmer nic, I pasted shell code to create the files like I did
11:48 dboehmer surprisingly @INC first contained $HOME/lib (which is wrong) but now I ran it again and @INC contained /lib (also wrong, but different)
11:48 kes the default app should be runned as: morbo script/my_app
11:49 kes also `perl script/my_app`
11:50 dboehmer ah, then @INC contains /home/../lib and /home/lib. there's obviously a problem with path traversal
11:50 kes Look at default app
11:50 kes mojo generate app
11:51 kes the script/my_app has: use lib 'lib';
11:51 kes let me assume to use:  'use lib '../lib'; instead
11:52 mattastrophe joined #mojo
11:53 dboehmer kes, I'd prefer using rlib. the app itself works. it's only when calling it from morbo that paths get wrong. I don't know if that's a problem with morbo or rlib but I think rlib should still be relative to my app.pl
11:54 dboehmer kes, do you agree?
11:55 shadowpaste "nic" at 217.168.150.38 pasted "Clearer example showing '=' only needed in the base template/layout" (43 lines) at http://paste.scsys.co.uk/501289
11:57 nic dboehmer: Having myapp.pl at the top level (the one containing 'lib') works for lite apps
11:58 nic For a full app, it needs to be in a subdir.  The convention is 'script'.  I happen to prefer 'bin'; it doesn't matter what it's called.
11:58 dboehmer nic, are you trying to insist that placing app.pl in the app's root? move it to script/ and the error persists. ...
11:59 neilhwatson joined #mojo
12:02 shadowpaste "dboehmer" at 217.168.150.38 pasted "morbo breaking "use rlib" in Mojolicious app, also in script/" (23 lines) at http://paste.scsys.co.uk/501290
12:05 nic ok, I've tried it with a lite_app and it worked perfectly
12:05 dboehmer nic, which kind of module did you load from lib/?
12:06 nic dboehmer: rlib includes /home stuff at the start of @INC
12:06 nic that's just what it does
12:08 dboehmer my app is located in /home/dboehmer/tmp/script/app.pl. so "use rlib" should include /home/dboehmer/tmp/{,lib} and it does when called with `perl`. only with morbo something get's wrong and rlib fails to find the right location. i thought /home/lib might be relative from morbo's location but it's also in some deeper subfolder:-/
12:09 dboehmer correction: rlib should include /home/dboehmer/tmp/{,script}/lib
12:10 shadowpaste "nic" at 217.168.150.38 pasted "rlib working in a lite_app" (7 lines) at http://paste.scsys.co.uk/501291
12:11 cpan_mojo Clustericious-1.03 by PLICEASE https://metacpan.org/release/PLICEASE/Clustericious-1.03
12:15 jberger dboehmer: first can I confirm that you are using a recent mojo
12:15 dboehmer nic, can't confirm. when run with `morbo` the app reports /lib as first @INC path. you get the right paths both for perl and morbo runnig the lite app?
12:16 nic see jberger's question
12:16 nic I'm using v6.30
12:16 jberger Second, do note that mojo assigns to $0
12:16 kes dboehmer: the morbo run appliation at sandbox: Mojo::Server::Sandbox::ddf16ccf40dfce238765178d05d13899. Than the rlib for each :: at $pkg strip one level of directory. Look at rlib.pm:36
12:16 dboehmer rlub 0.02 and Mojolicious 6.29
12:17 jberger So it might be useful to make a route that confirms the value of $0
12:17 nic why would $0 matter?
12:17 kes when you run under perl, the $pkg is main, so path is untouched
12:17 jberger rlib docs mention that they are relative to $0
12:18 nic but that's before mojo has played with $0
12:18 shadowpaste "kes" at 217.168.150.38 pasted "what is comming on" (36 lines) at http://paste.scsys.co.uk/501293
12:19 dboehmer $0 reported by morbo is /home/dboehmer/perl5/perlbrew/perls/perl-5.18.2/bin/morbo
12:19 kes the reason morbo run your app in the sandbox is do not know, as either reason the rlib go up for each level of package the app were runned
12:20 jberger Personally, I'm no fan of magic @INC manipulation
12:20 nic dboehmer: I've pasted a lite app that works (for me).  Can you paste a lite app that doesn't work for you?
12:21 nic and explain in what way it 'doesn't work'
12:22 nic it doesn't matter what's at the start of @INC; it matters whether rlib put the 'lib' dir into @INC (somewhere)
12:23 dboehmer nic, the lite app that works for you doesn't work for me. the issue is the same as pasted initially: rlib includes paths relative to a wrong path. the difference originates from calling via morbo (/not/ implying morbo has a bug!). what exactly is unclear about that?
12:23 kes dboehmer: look at rlib doc: If rlib is used from within any package other tha main then the paths in LIST are assumed to be relative to the root of the library where the file for that package was found.
12:23 nic I'm afraid you haven't given me enough information to identify your problem
12:24 nic but rlib is tiny; try replacing it with FindBin and see if your problems persist
12:24 dboehmer kes, interesting point. I wasn't aware my app.pl could be not in main. but also all other modules are located in ~/perl5/lib/. including /lib makes no sense after all
12:25 nic the fact that what works for others doesn't work for you suggests you have something wonky in your env, but it's impossible for us to tell what till you do more diagnosis yourself
12:25 dboehmer nic, do you use perlbrew?
12:26 nic kes: ah, good point.  When I ran it, the lib of morbo was also the lib I wanted to pick up
12:26 nic dboehmer: so kes has identified your problem
12:26 nic bottom line: use FindBin not rlib
12:26 vanHoesel1 joined #mojo
12:27 dboehmer i can confirm that with FindBin it works
12:27 jberger "jberger: Personally, I'm no fan of magic @INC manipulation"
12:27 jberger :-P
12:27 jberger glad you found it
12:28 dboehmer jberger, do you consider FindBin also magic?
12:29 jberger no, first of all, FindBin has nothing to do with @INC
12:29 jberger second, mojo makes sure that FindBin is fixed up to find the right thing
12:29 dboehmer jberger, you're absolutely right. I already connect FindBin only with manipulating @INC
12:29 jberger yep
12:30 dboehmer I'm still not sure why using morbo and rlib shouldn't work and don't know which could be improved. but thanks to you I found a solution working in my perlbrew env. thanks!
12:31 jberger the "magic @INC manipulation" libraries try to guess what you intend, but IME don't always get it right and for that reason I find them more trouble than they're worth
12:31 jberger dboehmer: it is an interesting question
12:32 nic dboehmer: rlib has a bad design
12:32 nic It's shoves multiple dirs into your @INC, including ones you didn't expect or want, but in some cases will omit the one that it initially promised to deliver
12:34 nic There are (a max of) two obvious dirs to include.  If it did that and only that, it would be useful package
12:39 ajr_ joined #mojo
12:50 good_news_everyon joined #mojo
12:50 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/v8HUb
12:50 good_news_everyon mojo/master 0b68e56 Sebastian Riedel: set $0 consistently in morbo and hypnotoad
12:50 good_news_everyon left #mojo
12:50 sri dboehmer: that might help
13:03 kes sri: last commit may help to show right name at pstree when application is run under hypnotoad
13:03 kes I will check when it were available on CPAN
13:04 kes oh ((( it Morbo.pm
13:14 mantovani joined #mojo
13:16 hernan605 joined #mojo
13:30 shadowpaste "kes" at 217.168.150.38 pasted "try to extend dynamic content" (56 lines) at http://paste.scsys.co.uk/501295
13:31 kes nic: what do you think about inheritance improvement?
13:35 jontaylor joined #mojo
13:35 nic sorry, bit busy at the mo wrestling with git
13:37 kes ok
13:37 pink_mist that sounds like the worst WWE character ever -- 'The Git' :P
13:37 good_news_everyon joined #mojo
13:37 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/v8H4O
13:37 good_news_everyon mojo/master 2ceccd5 Sebastian Riedel: goodbye Dan Book
13:37 good_news_everyon left #mojo
13:39 pink_mist huh, Grinnz stepped down from being a core dev?
13:39 sri yes, he's retiring on good terms
13:39 pink_mist Grinnz: thanks for you contributions! =)
13:39 pink_mist *your
13:44 sri if i understand correctly he will keep contributing, just with a little more freedom
13:44 ajr_ joined #mojo
13:44 pink_mist ah =) cool =)
13:45 gryphon joined #mojo
14:04 Akron joined #mojo
14:10 inokenty-w1 joined #mojo
14:19 Trelane Is there a good example of writing a websocket client somewhere?  My google-fu is weak
14:27 nic Trelane: Did you see the example in the Guides?
14:36 nic sri: In the README.md for Minion, in section Installation, you might want to change url to https://cpanmin.us
14:37 nic I don't think https was avail when you originally wrote that
14:43 sri nic: it says https://
14:44 nic hah.  I'm forgetting that I'm looking at a version more than a year old.  sorry
14:44 sri lol
14:54 Nemix Trelane:  by client do you mean from browser/javascript?  search for "javascript websocket" should get you examples.
15:02 kes hm... when I add die at Mojolicious/Renderer.pm and run my ./lite_app.pl it goes into endless loop
15:02 kes at line 135
15:03 jberger "doctor it hurts when I do this" ... "then don't do that"
15:03 jberger :-P
15:03 kes :D
15:04 kes does application checks that server alive?
15:04 jberger kes: you probably fall back into the ioloop is my guess
15:04 jberger but I don't know, that's not something I would be doing :-P
15:06 nic :)
15:08 kes thank you for assumption
15:09 kes digging logs found: Mojo::Reactor::Poll: I/O watcher failed
15:10 kes it seems that is not I expect when run: ./my_app get '/'
15:11 kes ((
15:11 jberger why wouldn't you expect that?
15:11 jberger your app always runs as a full server when serving requests, even via the get command
15:12 kes When app can not complete request it must return an error
15:12 jberger in that case it gets an "anonymous" port, but its still a server
15:12 kes s/must/should
15:13 jberger are you doing delayed rendering?
15:13 jb360 joined #mojo
15:13 kes no
15:13 kes just add 'die' at Mojolicious/Renderer.pm:136
15:14 kes just for experiment what is happening when server dies
15:14 nic When the server dies, what do you expect is going to serve the error response?
15:14 jberger there's quite a lot of code that handles exception paths and because of the asynchony its located in different places
15:16 nic If you pull the plug out of the back of the box running the server, you also get no error response ;)
15:16 jberger this is where the default 500 page comes from: https://github.com/kraih/mojo/blob/master/lib/Mojolicious.pm#L169
15:16 kes when I 'wget http://some_site' and the server at some_site not alive the wget shows error. can not query... etc. So when my_app can not query internal server it should exit with some error, I think.
15:16 PryMar56 joined #mojo
15:17 jberger kes: it usually does, but if you bring down the server in unexpected ways, you might end up without that mechanism
15:17 nic There can only be one main ioloop
15:17 jberger and I don't have the time to dig into throwing an exception where you are doing so
15:17 nic in your case the client and server are sharing the same main loop
15:17 nic you kill that loop => client can't do very much
15:18 kes ((
15:18 kes but this just notice, do not keep this in head.
15:19 nic but you can run the server eg with daemon, and then run an entirely separate client with a full url (http://.../)
15:19 kes that it not important for me
15:19 jberger kes, how does your example behave if you check it in the browser rather than get command
15:19 jberger (as nic is saying)
15:19 nic and then you have separate client & server, and you should see a timeout
15:19 kes ok. I will check and give feedback tomorrow
15:21 kes oh. I forget morbo
15:22 jberger sri: when a job emits finished/failed are those in the worker or the spawned process?
15:24 jberger from here it looks like it happens in the worker https://github.com/kraih/minion/blob/master/lib/Minion/Job.pm#L34-L38
15:24 jberger but then again you can call them from the job itself
15:24 kes when I run morbo my_app and do request from browser it waits forever
15:24 kes logs are empty
15:24 kes morbo does not produce any error message
15:25 berov joined #mojo
15:26 kes need to go. Bye.
15:33 Akron Hi jberger!
15:33 jberger Akron: \o
15:33 Akron Nice to be back in the channel. ;)
15:34 Akron May I point you to my question from two days ago http://irclog.perlgeek.de/mojo/2015-11-09#i_11507979 - I guess this is something you may already have solved for Galileo.
15:36 jberger I saw that and I didn't really understand the question
15:37 voldemortensen joined #mojo
15:38 ajr_ joined #mojo
15:40 Akron Let's say I've got an administration panel and I have a plugin for user invitations and a plugin for emailing users, I want to have these plugins listed (some HTML code) in my administration panel.
15:42 Akron Like '<nav><%= content_for 'plugins' %> and I want to have all plugins add there navigation items to the list. Now content_for is pretty much what I want, but this would need a call from the controller, ...
15:42 jberger you probably need the plugin to register a callback
15:42 Akron ... i.e. either a template has to be loaded or I have to add this to a hook.
15:42 jberger and no Galileo didn't do this, which is one of the motivations for a successor
15:43 Akron Ah, okay. How would you trigger such things?
15:43 sri Akron: o/
15:43 jberger I'd probably make an EventEmitter somewhere that would emit events that the plugin could subscribe to
15:44 Akron sri: Hi!
15:44 Akron jberger: So whenever the administration panel is called, you would release the hook?
15:44 jberger that's my first thought, yes
15:45 jberger that or just have some dispatch chain that calls all the plugins which might themselves append to named content buffers
15:46 Akron I was thinking of something like "component_for", that behaves similar to content_for but with named buffers in a non-stash variable.
15:46 jberger which is only really a difference of "when"
15:46 sri sounds more like a chache
15:46 Akron Yeah, I see. I think, having an event is way more flexible.
15:46 sri s/h//
15:47 Akron Yes - the templates from the plugins would somehow be cached.
15:48 Akron Or - you mean the buffer. Yes - true.
15:52 vanHoesel joined #mojo
16:06 sri i mean more like a global cache
16:08 Akron Yes. In fact, it would work similarly, if I could add contents to named buffers with default(), but that does not sound like a good idea.
16:09 jberger Akron: content('name') || 'default values' ?
16:10 Akron jberger: But how could I add to the content buffer from plugins?
16:11 jberger $c->content('name' => $value)
16:11 jberger just like any other named buffer
16:12 jberger I mean, you could roll your own content caching thing, but (and I haven't checked this to be sure) I'm guessing the content(_for/_with) system is a pretty basic implementation
16:13 Akron The problem here is the controller. It adds the content to the stash, which means I need either a hook or a template that will be called when the template snippet for the component is called.
16:14 jberger right, we already discussed that
16:14 Akron content_for is extremely close to what I want, but I need a mechanism to call the plugins. So it's either your hook idea or something like a "content_for" that allows a cache.
16:15 sh4 joined #mojo
16:16 jberger if I weren't already making a prototype of something else, I'd make a prototype for this
16:16 Akron And as I said, it's rather a question of design. I don't know if it's a good design to emit an event inside a template.
16:16 jberger but I am and this one might get me hired
16:16 Akron Oh - cool. Perl job again?
16:17 jberger I don't think it would HURT, but I'd emit the events before the actual render started
16:17 jberger I'm hoping
16:17 jberger I haven't mentioned in here yet, but the last just ... kinda vanished
16:17 jberger last $job
16:17 Akron Oh - I'm sorry to hear that!
16:18 jberger yeah, it was a bit of a surprise
16:18 Akron It was a med startup, right?
16:18 jberger medical yes, startup no; but their business model became unviable with changing conditions
16:19 Akron Oh. :(
16:20 Akron Then - I wish you all the best for the new job and your prototype!
16:21 jberger thanks
16:29 ajr_ joined #mojo
16:31 jontaylor joined #mojo
16:41 hernan605 joined #mojo
16:47 dod joined #mojo
16:48 good_news_everyon joined #mojo
16:48 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/v8QFS
16:48 good_news_everyon mojo/master b88b07a Sebastian Riedel: update year
16:48 good_news_everyon left #mojo
16:52 gryphon joined #mojo
17:02 mspo how can I build my own build_tx() and use it async like get() with UserAgent?
17:02 mspo I'm getting a little lost
17:04 Grinnz_ https://metacpan.org/pod/Mojo::UserAgent#start1
17:13 Akron Is there a way to know, if a helper was called from a controller or from the app?
17:14 sri no, you could just guess based on the data in the transaction
17:14 Akron Okay, thanks.
17:15 sri calling a helper on an app basically does say $app->build_controller->helpers->dumper({foo => 'bar'});
17:15 sri s/say//
17:16 Akron Yes - I like the coherence of that, but sometimes it's a useful information.
17:21 sri too bad ribasushi's plan is not working out https://news.ycombinator.com/item?id=10540206
17:21 sri guess pro versions of open source code might be the best bet for sustainable funding
17:25 jberger I told him at the outset that I hoped it would work but I had little actual reason to think it would
17:25 jberger riba assumes an incredible level of responsibility, one that companies often don't expect of themselves let alone their "vendors"
17:26 jberger add to that these are the companies who have decided that they are going to use open source, they expect breakage and are ready to work with it (grumbling of course)
17:26 jberger the fact that riba provides stellar compatibility just means they think about it (him) even less
17:31 preaction jrpt in that thread has the right idea: you won't pay for something you already get for free
17:33 preaction thinking about it a bit, this is how languages will die now. because all the free work must be fun, which in rare instances leads to something useful, which therefore becomes not fun, so won't be worked on for free
17:33 Grinnz_ and eventually we all become javascript developers
17:34 sri a protection racket... i like where you are going with this... "nice mojolicious app you got there, wouldn't it be a shame if sri broke backwards compatibility again?" :)
17:36 sri until you realize most users never upgrade :S
17:53 jberger when they do though, the almost always do it blindly
17:53 jberger the weird dicotomy
17:59 carneirao joined #mojo
18:08 trone joined #mojo
18:20 Mattjes joined #mojo
18:21 Mattjes hello
18:21 preaction hello
18:21 Mattjes Can anyone help me? How can i find with Perl/Mojo empty tags for strip?
18:22 Mattjes <p>   </p>
18:22 Mattjes $dom->find('empty tags')->strip;
18:22 Mattjes this is an example ;-)
18:23 Mattjes for "what i mean"  ;-)
18:24 cpan_mojo PlugAuth-0.31 by PLICEASE https://metacpan.org/release/PLICEASE/PlugAuth-0.31
18:24 preaction check to see if the element has text (the ->text method) or children (the ->children method). if it does not, it's empty and you can strip it. something like $dom->find( 'body *' )->grep( sub { !$_->text && !$_->children } )->each( 'remove' ); might work
18:25 preaction but test that, as i just made it up. see Mojo::DOM for find() and remove() and text() and children() and Mojo::Collection for grep() and each()
18:25 Mattjes Cool! Thank you! I test it ;-)
18:31 jnbek joined #mojo
18:32 sri http://mojolicio.us/perldoc/Mojo/DOM/CSS#E:empty
18:32 Mattjes preaction: It works - thank you!
18:33 Mattjes sri: Thank you too!
18:33 preaction huh. :empty is new one on me
18:35 Mattjes With Dom: CSS I have not worked. I have to find myself first purely.
18:36 preaction i think whitespace can count as a text node, so maybe that's why?
18:37 sri yes, whitespace affects emptyness
18:37 preaction a p with only whitespace in it gets truncated to <p> </p><!-- a single space -->
18:38 preaction but in that case, $_->text would return something that would evaluate as truthy. so you'd need $_->text =~ /\S/ # matches a non-whitespace character
18:40 sri css4 selectors have a :blank pseudo class that also matches "<p>  </p>"
18:41 sri (that's whitespace in between the tags)
18:42 mspo okay I think I have my build_tx non-blocking thing working
18:43 mspo just had to start groking the mojo event stuff
19:09 good_news_everyon joined #mojo
19:09 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/v85eX
19:09 good_news_everyon mojo/master 1bd1ed3 Sebastian Riedel: use the correct terminology
19:09 good_news_everyon left #mojo
19:12 jb360 joined #mojo
19:28 mspo is monkey_patch a stable thing?
19:47 lonerr joined #mojo
19:53 good_news_everyon joined #mojo
19:53 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/v85CT
19:53 good_news_everyon mojo/master 81e0953 Sebastian Riedel: another Mojo::DOM example
19:53 good_news_everyon left #mojo
19:57 kyshtynbai joined #mojo
19:58 hernan605 joined #mojo
19:59 ZoffixW joined #mojo
20:00 ZoffixW sri, are you sure "foo::bar" is a correct URL? Mojo::URL breaks it into scheme => 'foo', path => ':bar', but what I see in the spec the path needs to start with //: https://url.spec.whatwg.org/#syntax-url-scheme-relative
20:01 * ZoffixW is really bothered http://www.w3.org/Addressing/URL/url-spec.txt has non-word "seperate" in it :(
20:01 sri what is //:?
20:02 ZoffixW start with //
20:02 ZoffixW The ':' was part of the sentence's grammar, sorry :)
20:02 sri the // signals the presence of an authority
20:02 sri take mailto:sri@example.com for example
20:03 sri no authority
20:03 ZoffixW Ahh.
20:03 cpan_mojo JSON-Validator-0.61 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/JSON-Validator-0.61
20:04 sri actually, mailto::whatever@whatever might even be valid
20:13 ZoffixW I see my mistake with the top link (it applies to "special" schemes), but I'm still failing to find that double colon is valid.
20:14 ZoffixW That is that foo::bar is valid and should not be foo:%3Abar
20:14 sri would be hard to find i think
20:14 sri different specs prolly even contradict each other
20:14 sri URLs are messy
20:14 ZoffixW Alright then :)
20:16 sri if i remember correctly, most special characters are only special until they appear once
20:16 sri like :, @, ? and #
20:16 sri a query can contain an unescaped ?, and a fragment can contain an unescaped #
20:17 sri http://example.com?foo=b?a?r#test#123
20:19 sri took ages to figure out the correct escaping behavior for Mojo::URL
20:21 sri actually, # might not be valid in the fragment ;p
20:22 sri but ? in query and fragment
20:23 sri for anyone who like spec lawyering, URLs are a goldmine :)
20:23 sri +s
20:25 zivester joined #mojo
20:25 ZoffixW :D
20:25 berov1 joined #mojo
20:37 mspo $tx->client_close seems to cause a lot of cpu and trouble.  What am I missing?
20:38 sri are you implementing your own user agent?
20:40 sri http://mojolicio.us/perldoc/Mojo/Transaction#client_close
20:45 mspo sri: I just did a build_tx but the keep-alive is waiting for a timeout before closing
20:46 mspo sri: so I tried doing $tx->on(finish => sub { my $tx = shift; $tx->client_close; });
20:46 sri sounds like you're doing something very wrong
20:46 mspo but it didn't go so well :)
20:48 mspo https://gist.github.com/msporleder/b8712bfac7dd4d139063
20:49 jberger http://orig03.deviantart.net/319e/f/2014/147/0/9/minionthronedesign_by_naolito-d7jy30w.jpg
20:49 preaction nice
20:49 preaction Game of Bananas!
20:50 ichi joined #mojo
20:54 mspo sri: I was also generating deep recursion warnings
20:56 sri how many items are in @{$j->{"content"}}?
20:57 mspo sri: two
20:57 sri then the example is incomplete
20:58 mspo okay
20:59 sri you're doing weird stuff you're not showing us
20:59 mspo reload, please (this is working)
21:00 mspo adding  $tx->client_close; to line 33 makes it go a little nuts
21:00 lonerr left #mojo
21:03 ZoffixW mspo, it would be helpful if you could pastebin a working testcase that demonstrates the problem
21:03 mspo sure
21:05 mspo reload again
21:06 sri don't use ->client_close
21:06 sri the documentation says it is used to implement user agents
21:06 sri you're not doing that
21:07 mspo I'm *using* a user agent that's already implemented
21:07 mspo okay is there another way to close a transaction?
21:09 sri take a step back, explain what you're actually trying to accomplish
21:10 mspo sri: I am trying to curl those urls and (eventually) grep out content
21:10 mspo sri: but wanted to use something like build_tx so I could configure a lot of headers and things
21:11 ZoffixW mspo, you can configure those with regular ->get
21:11 ZoffixW mspo, ->get( 'http://foo' => { My => 'Header' ) => sub { ... } );
21:12 ZoffixW mspo, and I really doubt you need to "close" a transaction. Or at least... I've never been closing anything and my stuff works fine :P
21:12 mspo ZoffixW: there is a delay waiting for timeouts if you have a keepalive
21:13 sri that's not how keep-alive works
21:13 mspo my example will sit for ~5s if you remove the $ua = $ua->max_connections(0);
21:14 mspo maybe I can add Connection: close
21:14 sri keep-alive happens in between transactions, not while they are in progress
21:17 mspo this worked as expected: $tx->req->headers->add("Connection" => "close");
21:18 cpan_mojo Mojolicious-Plugin-CGI-0.24 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/Mojolicious-Plugin-CGI-0.24
21:45 Trelane Nemix: no, I mean, talking to a websocket from Mojo
21:46 Trelane (that was a long away from irc, I know.  Whenever I ask a question on IRC it seems something else always catches fire right at that moment)
21:47 * Trelane awaits the drop of the other shoe as he says that
21:51 preaction Mojo::UserAgent works as a websocket cline
21:51 preaction client*
21:56 * Trelane tries it
22:07 sri http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#WebSockets
22:44 stigo joined #mojo
23:08 jberger I thought there was a way to change a job's queue before it was failed/finished but retry seems to only update failed/finished jobs?
23:11 polettix joined #mojo
23:27 jberger and I can't even fail it unless its active?
23:27 jberger hrm
23:27 jberger I thought one of the features of queues would be the ability to have a "parking lot" queue
23:30 preaction what would that do?
23:34 cpan_mojo Paws-0.19 by JLMARTIN https://metacpan.org/release/JLMARTIN/Paws-0.19
23:34 jberger preaction: insert a job that you don't want to run yet
23:35 jberger then you move it into a queue that has an active worker
23:35 jberger then it runs
23:36 preaction in some things, they won't drain messages until someone reads, so you could put things on a queue all you want, and nothing will happen until someone pulls a message off
23:37 preaction so then your thing that moves jobs would read that queue, and move the job to the right queue
23:46 jberger preaction: I'm talking about minion not a message queue
23:46 preaction ah
23:46 jberger np
23:52 sri yes, the state machine is pretty strict
23:53 sri you need a worker to dequeue the job to be able to fail/finish it
23:54 sri making parking lots easy was not a goal btw.
23:54 sri just possible
23:58 sri it's pretty easy to allow other transitions, now that there are versions to avoid the concurrency issues, but i'm not convinced that we should

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