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

IRC log for #mojo, 2017-05-16

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

All times shown according to UTC.

Time Nick Message
00:23 stryx` joined #mojo
01:56 gizmomathboy joined #mojo
02:11 noganex_ joined #mojo
02:18 disputin joined #mojo
02:43 stryx` joined #mojo
03:20 marcus joined #mojo
03:22 kaare joined #mojo
04:04 dboehmer joined #mojo
04:24 inokenty-w joined #mojo
04:55 abracadaniel joined #mojo
05:09 kaare joined #mojo
05:42 dod joined #mojo
05:49 dod joined #mojo
06:01 ranguard fyi: grep.metacpan.org is in beta atm
06:18 prg joined #mojo
06:26 aborazmeh joined #mojo
06:49 Vandal joined #mojo
06:57 AndrewIsh joined #mojo
07:23 trone joined #mojo
07:41 dotan_convos joined #mojo
07:43 dod joined #mojo
07:46 dod joined #mojo
07:46 aborazmeh joined #mojo
08:01 karjala_ joined #mojo
08:37 CHYC sri: Keep pestering me :)
09:03 cheako joined #mojo
09:14 rshadow joined #mojo
09:19 irqq joined #mojo
09:41 sri oh, i will!
09:41 sri bit of a bummer that there's no perl binding for tensorflow yet
11:42 stryx` joined #mojo
12:09 gizmomathboy joined #mojo
12:12 tchaves joined #mojo
12:45 marcus genio: Are you planning on sending a PR for #1077?
12:51 genio marcus: I made a couple of attempts but I don't know enough of the internals to make a complete, working PR
12:51 stryx` joined #mojo
12:52 genio sri looked over a few attempts and there were some pretty bad edge cases for everything I tried that made them a no-go
12:52 marcus Why can't things just be easy? ;-)
12:53 genio The conversation about and links to my attempts should be in the channel logs
12:53 marcus Cool, will search it up later.
12:58 genio 2017-04-03, 2017-04-04    https://irclog.perlgeek.de/mojo/search/?nick=&q=https%3A%2F%2Fgist.github.com%2Fgenio%2F
13:00 rshadow joined #mojo
13:26 gryphon joined #mojo
13:44 mishanti1 Wasn't there som $ENV-variable one could set to get som diagnostic information on ssl-connections when using Mojo::UserAgent? Or is my memory failing me here?
13:50 batman mishanti1: i don't think so :/ I *always* hack something like this into my apps: `$IO::Socket::SSL::DEBUG = $ENV{SSL_DEBUG} if $ENV{SSL_DEBUG};`
13:55 mishanti1 batman: Thanks anyway. :) Glad I'm not the only one who has been looking for that.
14:03 Pyritic joined #mojo
14:16 Armen gooden mornings
14:21 mishanti1 \o
14:24 * jberger discovers that N was a 5.12 feature
14:24 jberger https://metacpan.org/pod/perl5120delta#\N-experimental-regex-escape
14:25 jberger welp, Mojolicious::Plugin::RevealJS is 5.12+ now :-P
14:27 Armen as cool as that is --- does revealJS even need back-end support?
14:38 perlpilot joined #mojo
14:39 jberger no, certainly you can just do revealjs by hand
14:39 jberger mine is a preprocessor, mostly to support the way I like to write and structure talks
14:39 jberger including that I want all the code samples in my talk to run as shown
14:40 jberger which means I never copypasta code into my talks, they are inlined from runnable files
14:40 jberger I don't want to risk skew between the slides and the sample files
14:40 maschine joined #mojo
14:41 jberger I did finally introduce a compromise in the latter few releases, which is that I allow comments in the code to mark out sections that get extracted for slides
14:41 jberger because including an entire file was sometimes too long but shortening it to one slide was impossible
14:42 jberger parsing those tokens required the \N metacharacter though, so ... here we are :-D
14:45 haarg well, "require" is a bit strong.  there are plenty of ways to do that that would work on 5.10 if you cared.
14:46 jberger if someone asks, I'll remember that and come ask you for options
14:47 jberger but yes, "requires" would better have been stated "was implemented by"
14:48 jberger haarg: your travel back from pts was uneventful I hope?
14:48 haarg mostly
14:49 haarg trains from the airport to amsterdam centraal were all cancelled, so i had to bypass a bit
14:49 jberger ugh
14:49 jberger seems like plenty of people having issues
14:51 haarg it was only like 20-30 minutes out of the way.  pretty minor compared to what other people have hit.
14:52 jberger sri: looks like they provide an interface intended for FFI
14:52 jberger https://www.tensorflow.org/extend/language_bindings
14:52 jberger I wonder how quickly something could be wrapped together using https://metacpan.org/pod/NativeCall
14:53 jberger which is really just sugar over https://metacpan.org/pod/FFI::Platypus
15:13 PryMar56 joined #mojo
15:18 Pyritic joined #mojo
15:35 mcsnolte joined #mojo
15:38 Armen haarg: you're dutch?
15:39 VVelox joined #mojo
15:39 Armen jberger: so... will you be doing a talk about how Mojolicious::Plugin::RevealJS enabled you to do the talk?
15:39 jberger yo dawg
15:40 Armen I was going to go with an inception joke, but xhibit works
15:47 Pyritic joined #mojo
15:57 jberger Armen: this is the talk that I most recently wrote with it
15:57 jberger and the first one that uses the code sections: https://github.com/jberger/VueChat/blob/master/templates/presentation.html.ep
16:04 haarg Armen: no, i just live here
16:13 sh14 joined #mojo
16:31 Armen haarg: nice. I'm dutch but I *don't* live there :P
17:21 cheako joined #mojo
17:38 rshadow joined #mojo
17:40 tchaves joined #mojo
17:53 irqq joined #mojo
18:02 disputin joined #mojo
18:05 tchaves joined #mojo
18:12 Janos joined #mojo
18:17 simbabque if I only redirect to another page at the end of a route handler, do I have to have a template? my app says 404 but the routing is correct. I don't have a template file for that route, and I don't want one.
18:18 simbabque I'm not really sure what to google for... I have a controller Foo with a sub bar, and I route ->post('/foo/bar')->name('foo_bar')->to('Foo#bar')
18:19 simbabque other actions like GET baz and GET qrr are working, but the POST bar is not
18:19 TBSliver joined #mojo
18:19 simbabque in the route list output on the 404 page it also shows up
18:24 Armen what did you expect instead of the 404?
18:24 disputin joined #mojo
18:24 Armen not a template so.. json output?
18:25 simbabque a redirect
18:25 purl a redirect is a specific status
18:25 simbabque to another route
18:25 simbabque the same one I came from
18:25 simbabque this is basically the save action for an edit form, and when you save, you go abck to the edit
18:26 simbabque but it never enters the route
18:26 Armen oh, I see
18:26 simbabque I added $c->app->log->warn('foo') to the route, never gets called
18:26 simbabque I also tried die
18:26 simbabque it never enters that code
18:27 Armen so you're doing something like this? http://www.pastebeest.com/103
18:30 Armen looks like redirect_to defaults to status 302, if you don't set it to 30x yourself
18:36 kyclark joined #mojo
18:36 simbabque no I don't set the status
18:36 simbabque Armen
18:36 Armen ok, but you do use redirect_to and pass the name of your named route
18:36 simbabque I do $c->redirect_to('foo_edit', id => $id)
18:36 Pyritic joined #mojo
18:37 Grinnz 404 probably means your route didn't match
18:37 simbabque but how does that matter if the route handler itself never gets called
18:37 simbabque yeah Grinnz that is what I think too, but I don't understand how to debug that
18:37 kyclark I'm having a consistent problem with "too many open files" in Mojo.  A colleague ran a spidering test while watching "lsof" and eventually Mojo hits it's max and just dies.  What files are being left open?  How can I fix this?
18:37 Grinnz or it means that it didn't find the Foo controller or bar action
18:38 simbabque yeah... the other action that sent the user there is in the same controller though
18:39 simbabque I copy/pasted the name from the route setup a couple of times
18:39 simbabque anyways I need to have dinner, will be back later, thanks
18:39 Grinnz make sure the ->post is called on the parent route you expect
18:39 stryx` joined #mojo
18:40 Grinnz i think more debug messages as far as missing routes would be nice, but due to how automatic rendering works, it would be hard to make it not annoying
18:49 dod joined #mojo
18:49 jberger kyclark what is your system's file limit and how hard are you spidering?
18:49 jberger the immediate thing that comes to mind is HTTP keep-alive
18:50 jberger (though I think there are protections against that)
18:51 kyclark 200K soft and hard limits.  I noticed the site under normal strain (a few hundred hits a day) will hit this limit more than once a week.  Under strain it will occur in about an hour.
18:51 jberger yeah, nm, that is controlled by the server: http://mojolicious.org/perldoc/Mojo/Server/Daemon#max_requests
18:51 kyclark I put a Mojo restart into cron to restart every midnight, but it doesn't solve the problem.
18:51 jberger what application server are you using?
18:52 simcop2387 does the cookbook have an example of a scaper using Mojo::DOM etc?
18:52 kyclark Hmm, not sure.  Do you mean Nginx or Apache?  I'm using Nginx.
18:52 simcop2387 scraper*
18:52 jberger kyclark: that's the reverse proxy server
18:52 jberger I'm asking about daemon, morbo, prefork, hypnotoad
18:52 kyclark Oh, sorry, hypnotoad.
18:53 jberger no need to apologize :D
18:53 jberger are you doing anything that would hold open the filehandles? that would probably wouldn't be normal application-style code
18:54 jberger or maybe, do you see memory usage going up long term too, meaning are you leaking memory (and perhaps in doing so holding the connections, though I don't know if that's possible)
18:56 jberger I guess what I should say is, we haven't seen a problem like this before (that I'm aware of) which makes me suspect your application
18:57 jberger also, hypnotoad has even more protections by killing off worker processes after some number of requests
18:58 ribasushi kyclark: if this is linux, this may probe instumental in figuring out what leaked: ls -l /proc/<various PIDs>/fd
18:58 ribasushi s/probe/prove/
18:58 jberger (on the assumption that most applications will leak because in user code in a ref counted language, not leaking is hard)
18:58 jberger ribasushi++ good idea
19:00 kyclark What is the default number of requests before Hypnotoad reaps a child?  How can I control that?  As for opening files, I only read my config and have db (mySQL) connections.
19:01 jberger http://mojolicious.org/perldoc/Mojo/Server/Hypnotoad#accepts
19:02 Janos joined #mojo
19:02 kyclark Do I have to move to Prefork to use this setting?
19:03 jberger no
19:04 jberger curious, what made you think that? (so as to improve the documentation if necessary)
19:05 kyclark I've passed the /proc stuff to my colleague who was stressing it.  I'll see if he can find anything there.
19:05 kyclark Back in a bit.
19:17 zivester joined #mojo
19:31 dantti_laptop joined #mojo
19:31 kyclark joined #mojo
19:33 dod joined #mojo
20:23 simbabque Grinnz: ok, I double-checked that I'm using the right parent route. my route gets listed in the list, the URL I am calling is created by url_for() in the template with the right name for the route. I do not understand this.
20:23 Grinnz and it's called via POST?
20:24 simbabque it says so in the 404 page
20:24 simbabque and in the form I also have the method="post"
20:24 Grinnz does the URL match what you expect it to be?
20:24 simbabque yes
20:25 Grinnz and you're sure the action method name is correct?
20:25 maschine converting my mongodb to postgresql, and am so close..  I have the module basically working: https://tinyurl.com/kmkl6pd
20:25 simbabque you mean the one behnid the # ?
20:25 maschine I added the "say $users..." line to verify it's working there
20:25 Grinnz yes
20:25 simbabque I copied that at least five times by now
20:26 simbabque I've also replaced it with foo and renamed the sub
20:26 Grinnz does the debug log say anything about routing?
20:26 maschine but when I go to use the hashref in the template, it's empty.. I'm sure I'm passing it or using it wrong somehow
20:26 simbabque I know how to write foo :)
20:26 Grinnz maschine: you are returning %users which will get flattened into a list, with $count at the end, thats not really usable
20:27 simbabque it says POST "/stuff", template "not_found" not found twice for two 404 templates, rendering inline template twice, then 404
20:27 maschine ah dang I just changed it for that example
20:27 maschine I had it as \%users
20:27 Grinnz give example code, get example help :P
20:28 simbabque not_found.development.html.ep and not_found.html.ep are not found
20:28 simbabque which sounds reasonable
20:28 Grinnz sounds like it didn't find the controller
20:29 Grinnz is the controller class inheriting from Mojolicious::Controller?
20:29 simbabque but it came from the same controller
20:29 simbabque the action that sends the user there is the same one, and that's working
20:29 simbabque it's like get /edit/:id and post /edit/:id with sub edit and sub update
20:30 Grinnz well i dont have any other ideas based on that
20:30 simbabque it's not inheriting, it has use Mojo::Base 'Mojolicious::Controller';
20:30 Grinnz yes that's inheritence
20:30 simbabque which probably inherits under the hood
20:31 simbabque it's version 5.77 and I can't update it, but I don't think that makes a difference
20:31 Grinnz that's pretty outdated
20:31 simbabque I know
20:31 simbabque not my call
20:33 maschine I'm passing %users to stash as a reference too (/%users), but I think I've got something wrong there.  https://tinyurl.com/mghyd6k
20:34 simbabque ok I renamed the controller to verify that the get /edit/:id fails, which it does
20:34 maschine $users{$count}->{'name'} works in Users.pm
20:34 Grinnz you set $usercount to 1 and then never increment it
20:34 maschine it does just not in that example (I cut out most of the template)
20:34 maschine I also set it to 1 first
20:35 Grinnz also why not just iterate through the keys of %$users
20:35 simbabque huh, ok pointing the post action to the same sub as the get action also results in 404, it really must not find the thing -.-
20:35 maschine I think it just morphed from some different code but yes I should try that, however, I'd like to better understand hash references and why it's not working the way I think it does
20:36 Grinnz simbabque: is there a parent route restricting it to GET requests only?
20:36 simbabque let me check, how would that look?
20:36 Grinnz my $subroute = $r->get(...); my $getroute = $subroute->get(...); my $postroute = $subroute->post(...);
20:36 simbabque ouch
20:36 Grinnz the post route would never be reached
20:36 simbabque yeah, that needs under, right?
20:36 Grinnz ->any
20:36 simbabque (facepalm)
20:37 Grinnz under would be if the parent route also calls a controller action itself to decide whether to continue
20:38 Grinnz maschine: i haven't seen anything in your examples so far that wouldnt work
20:39 Grinnz but defining the %users hash in the template is pointless, just call $users->{...}
20:39 Grinnz like you do in the last line there
20:39 simbabque Grinnz: that did it, thank you :)
20:39 Grinnz cool, ive definitely done that before...
20:40 maschine tried that, the output is still empty
20:49 maschine figured it out and I should have known better
20:50 maschine since I was passing a hashref, I needed to do $self->stash(users => $users) not \%users
20:51 Grinnz right, if you're getting $users back from your function
20:52 Grinnz strict vars should catch that...
20:52 Grinnz unless you were also defining %users for some reason
20:58 maschine yeah I was; my ($users, $count) = MyApp::Model::Users::list_users($self);
20:58 maschine used to be %users
20:58 maschine so no warnings
20:58 sri re documentation, perhaps it is time to come up with a few rules for linking to guide sections from the reference docs
20:59 sri that topic keeps coming up
20:59 sri and i have a feeling being more liberal with it might help a lot of beginners that end up in the ref docs first
20:59 Grinnz i agree
21:00 Grinnz not sure specifically what ref docs need it, though
21:01 jberger +1
21:01 purl 1
21:01 sri yea, like Mojolicious::Validator linking to the rendering guide section
21:01 sri right now we handle it mostly like this http://mojolicious.org/perldoc/Mojo/UserAgent#DESCRIPTION
21:01 sri "See "USER AGENT" in Mojolicious::Guides::Cookbook for more."
21:02 sri the tutorial has a few different ones http://mojolicious.org/perldoc/Mojolicious/Guides/Tutorial#Stash-and-templates
21:02 sri "For more information about templates see also "Embedded Perl" in Mojolicious::Guides::Rendering."
21:02 sri all those link to "major" sections though
21:04 sri form validation does not have that, just a few "minor" sections http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Form-validation
21:04 rshadow joined #mojo
21:04 sri http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Adding-form-validation-checks
21:04 sri http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Cross-site-request-forgery
21:04 sri would those have to be combined to a new major section?
21:04 sri what would that look like?
21:05 Bloke joined #mojo
21:27 jberger could you just make the `=head2 form validation` just above that into =head1?
21:44 stryx` joined #mojo
21:47 mattp joined #mojo
21:53 maschine how much do data types matter when using Mojo::Pg?  For example, if I have some boolean values, does it really matter if they're text/int if it's just 1s and 0s?  Perl doesn't care anyway, right?
21:55 jberger when postgres knows how to do a type conversion it should just work
21:56 jberger if that doesn't quite work you might have to give it a hint
21:56 jberger '?::BOOLEAN' or something
21:56 Grinnz see https://metacpan.org/pod/DBD::Pg#Datatype-bool
21:57 jberger oh I guess I didn't realize how much the driver was actually doing that
21:57 jberger Grinnz++
21:58 maschine ah so it would appear it does matter, thanks Grinnz
21:58 maschine I just wanted to be sure before I plowed ahead converting to psql
21:59 Grinnz yeah if you're converting from something else, postgres has a specific bool type
21:59 Grinnz you can use it, or not, but its probably a good idea to use it where it makes sense
23:02 rshadow joined #mojo
23:09 kgoess are settings like this http://mojolicious.org/perldoc/Mojolicious#max_request_size settable in the MOJO_CONFIG file, or just in perl code?
23:09 preaction kgoess: you can make them settable in the config. also, i believe it's settable via environment variable
23:09 preaction i think the docs for that are in Mojo::Server
23:10 kgoess under any key in the config, or just in the top level hash?
23:10 Grinnz you can set it when you read the config however you want
23:10 Grinnz it won't be set automatically
23:11 kgoess can I put it *in* the config is what I mean? or is it a matter of calling $app->max_request_size(whatever) ?
23:11 Grinnz the linked http://mojolicious.org/perldoc/Mojo/Message#max_message_size mentions the env var that will be used for the default
23:11 Grinnz $app->max_request_size($app->config->{whatever})
23:11 kgoess ah, ok
23:11 kgoess thanks
23:13 kgoess FYI mojo is apparently truncating at the default size of 16mb, not returning an error to the user
23:14 Grinnz kgoess: yes, you need to check ->is_limit_exceeded on the request
23:16 Grinnz briefly mentioned here, https://metacpan.org/pod/Mojolicious::Guides::Tutorial#File-uploads
23:17 Grinnz you can return whatever sort of error you want in that case
23:17 Grinnz i have that in my main under route used for auth
23:19 sri you're welcome to open a feature request for handling transport errors automatically in the framework
23:19 sri it's a complicated topic though, and your proposal needs to consider all cases
23:26 punter joined #mojo
23:35 Peppaq joined #mojo
23:49 Janos joined #mojo
23:54 stryx` joined #mojo

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