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

IRC log for #mojo, 2017-03-07

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

All times shown according to UTC.

Time Nick Message
00:16 zivester joined #mojo
00:22 pink_mist so, I just suggested someone take a look at Mojolicious::Command, and his first reaction was 'why the hell does it have "chmod_file"?' ... and I must admit I never noticed that before ... why does it? shouldn't those things be moved to Mojo::File?
01:57 itaipu joined #mojo
02:33 itaipu joined #mojo
02:40 Janos joined #mojo
03:00 asarch joined #mojo
03:14 noganex joined #mojo
03:25 Janos joined #mojo
04:55 polettix joined #mojo
05:04 dboehmer_ joined #mojo
05:06 miller joined #mojo
06:28 mtj joined #mojo
06:30 mtj joined #mojo
06:45 ashimema joined #mojo
07:05 dod joined #mojo
07:10 dod joined #mojo
07:14 simbabque joined #mojo
07:29 inokenty-w joined #mojo
07:31 bwf joined #mojo
07:42 marty joined #mojo
07:56 AndrewIsh joined #mojo
08:30 trone joined #mojo
08:55 Vandal joined #mojo
09:01 rshadow joined #mojo
09:11 rshadow joined #mojo
09:30 itaipu joined #mojo
09:34 prg joined #mojo
09:34 prg jberger: thanks for the release, seems to work fine
09:40 prg uh, maybe i spoke too soon...
09:49 prg ok, i'm not quite sure if the error is related
09:50 prg basically i'm doing $c->minion_notifier->on(job => sub { $c->send({ json => $job->info }) }); in a websocket endpoint
09:51 prg which works fine the first time (or as long as the websocket is still open)
09:52 prg when it closes (due to inactivity) and i reopen it and enqueue new jobs, i get "connection already closed"
09:52 prg given the callstack i still suspect it's related to Minion::Notifier
09:53 tyldis IS there a better way to define the name of an anonymous sub (like helper or event subscriber) than using "local *__ANON__"?
09:53 tyldis My logger uses caller to derive names
09:53 tyldis And they ar all __ANON__ unles I explicitly override them. Which si some dirty duplication...
09:55 pink_mist Sub::Name perhaps?
09:55 sri Sub::Util::set_subname
09:55 sri core in new perls
09:56 tyldis Interesting, thanks. I'll look into them
09:57 pink_mist Sub::Util::set_subname is documented to have been copied from Sub::Name::subname, just changed the name of the sub ;)
09:57 tyldis Sub::Util is core, as sri mentioned
09:58 pink_mist yes, just saying there's no difference in the implementation between them =)
10:04 irqq joined #mojo
10:37 itaipu joined #mojo
10:40 sugar_ joined #mojo
10:45 trone joined #mojo
10:47 sugar_ joined #mojo
11:32 kes joined #mojo
11:32 kes How to store datetime in jsonb field with Mojo::Pg?
11:33 mat to deploy a new version of my mojo app, right now, I go and run commands on the prod server, git pull, carton install --deployment, and kill/carton exec hypnotoad, is the something that could automate the process ? (a bit like capistrano does in the ruby on rails world)
11:34 sugar_ joined #mojo
11:35 nic mat: Do you currently have a script for start/stop/restart/reload/status ?
11:36 aborazmeh joined #mojo
11:36 mat nic, nope, I have a shell history ^^
11:37 nic well, if that's your preference, put all the deployment steps on a single line (remembering to use "&&" not ";")
11:37 mat (or set -e at the beginning)
11:38 mat well, I could do that, my question was if there was some Perl tool that could automate that
11:38 nic that depends.  using -e can be more trouble than it's worth when you need to work around it
11:40 mat (instead of me having to write the tool)
11:41 prg mat: don't know much about capistrano, but there's Rex. disclaimer: i haven't used it
11:41 prg but my colleagues use it
11:41 nic you've already typed more characters than are required to "write the tool" :D
11:44 mat nic, well, yeah, but the tool could also do other things, if asked, like put init scripts, manage the nginx configuration, and without much difficulties, manage a pre-prod thing
11:44 mat prg, mmm, heard of Rex before, I'll have a look, thanks :-)
11:52 prg jberger: so i noticed my "poor man's Minion::Notifier" suffered from the same problem i mentioned earlier, but it failed silently. i added $c->on(finish => sub { $c->minion->backend->pg->pubsub->unlisten('foo'); }) to my websocket endpoint, now everything seems to work
12:13 sugar_ joined #mojo
13:02 marty joined #mojo
13:20 sri prg, jberger: think i know a different solution, will try it after later after work
13:21 prg sri: great, thanks :)
13:25 stryx` joined #mojo
13:37 sugar_ joined #mojo
13:43 Janos joined #mojo
14:09 gryphon joined #mojo
14:14 gizmomathboy joined #mojo
14:19 jkramer_ joined #mojo
14:19 jkramer_ Ahoy
14:19 jkramer_ Is there an quick & easy way to render a template (to a string) in a Mojolicious::Command? It seems that Renderer needs a Controller for rendering?
14:23 jkramer_ Nevermind, $self->app->build_controller->render_to_string seems to work
14:56 ekjgn joined #mojo
14:56 ekjgn 9 11 attacks, Did USA do it itself or it just let it happen?
14:56 ekjgn Did USA administration murder 3000 American citizen in 9 11 attacks to justify starting a war against iraq?
14:56 ekjgn If al-qaeda did it, why go to kill 2 million Iraqi?
14:56 ekjgn http://creatvchaos.blogspot.com.eg/
14:56 ekjgn https://creatvchaos.wordpress.com/
14:56 ekjgn joined #mojo
14:57 pink_mist just spam, disregard
14:57 pink_mist ekjgn: please stop spamming
14:57 ekjgn joined #mojo
14:59 ekjgn joined #mojo
15:00 ekjgn 183.39.200.8
15:00 ekjgn 183.39.200.8
15:00 ekjgn 183.39.200.8
15:00 ekjgn 183.39.200.8
15:00 ekjgn 183.39.200.8
15:20 mcsnolte joined #mojo
15:28 perlpilot joined #mojo
15:32 vicash pink_mist: it must be a bot. one can maybe block that IP address that it came from 156.208.130.203
15:39 jabberwok Hmm, http://mojolicious.org/perldoc/Mojo/File documents the copy_to method altho that's not part of 7.27 ... is that from 'bleeding edge' ?
15:42 itaipu joined #mojo
15:42 pink_mist jabberwok: yes, mojolicious.org is updated from git
15:42 pink_mist iirc
16:06 zivester joined #mojo
16:09 sri should get released later today i guess
16:14 lluad joined #mojo
16:16 sh14 joined #mojo
17:16 howitdo joined #mojo
17:23 jabberwok in Mojo::File doc for tempfile method, »  my $path = tempfile(DIR => '/tmp');  « fails with error; you need to also pass e.g., » TEMPLATE => 'tempXXXXX' «
17:24 sri no, it doesn't
17:25 jabberwok hm,  as of 7.27 it does.
17:26 sri no
17:26 sri perl -MMojo::File=tempfile -E 'say tempfile(DIR => "/tmp")'
17:26 sri /tmp/K9xKLRH1jI
17:27 sri it's a test case for crying out loud
17:30 jabberwok Strange. That works.  Yet this happens:  http://www.pastebeest.com/FD
17:30 pink_mist that's not how you call it
17:30 pink_mist you did Mojo::File->tempfile() ... that's wrong
17:31 pink_mist what you did is the same as doing tempfile('Mojo::File', DIR => '/tmp');
17:31 pink_mist and that's not how you call that
17:32 pink_mist (it's a function, not a method)
17:34 jabberwok oops
17:35 jabberwok thank you pink_mist
17:35 rshadow joined #mojo
17:39 rshadow joined #mojo
17:40 stryx` joined #mojo
18:16 sugar_ joined #mojo
18:24 dod joined #mojo
18:28 dod joined #mojo
18:31 dod1 joined #mojo
18:31 dod1 joined #mojo
18:36 dod joined #mojo
18:39 sri jberger, prg: this should fix it https://github.com/kraih/mojo-pg/commit/dd85fee4aaff463397a95f988e98d7ce0abc666b
18:40 * Grinnz can never figure out how to do a diff from different commits in the github ui
18:41 sri you take the hash of the commit before the one you are interested in and then add ...$last_commit_im_interested_in ;p
18:43 Grinnz at what url?
18:44 sri https://github.com/kraih/mojo-pg/compare/$hash_before_commit_you_are_interested_in...$hash_of_last_commit_you_are_interested_in
18:44 Grinnz ah, /compare
18:45 Grinnz i feel like there used to be a UI for this, but i can never find it
18:45 sri yea, i don't even try to find it anymore :)
18:45 jberger if you use the drop downs and accidentally typo a ref it instead creates a branch for you
18:46 jberger because THAT's usually what you mean
18:46 jberger sigh
18:46 Grinnz https://github.com/kraih/mojo-pg/compare does work, though
18:46 Grinnz but no link to it that i can find from the repo
18:46 jberger it shows up when you are on a branch
18:46 jberger (non master)
18:46 Grinnz right
18:51 jberger sri: so that also checks on notification coming in
18:52 sri yes
18:53 dod1 joined #mojo
18:53 sri now that i think about it, i do wonder if it might steal notifications from the parent process
18:55 jberger if that's possible that sounds like perhaps what is going on
18:55 sri shit
18:56 jberger and in my (admittedly contrived) Minion::Notifier test that change doesn't fix my test
18:56 sri that means there is no solution but to use $pubsub->reset manually
18:56 sri so, you call $pubsub->_cleanup manually it works?
18:56 jberger yes
18:56 sri that sucks
18:56 purl The rock is now off.
18:57 jberger well, I do it by unlistening to a dummy channel (since that's public) but in my testing calling _cleanup is enough
18:57 jberger also explains why I couldn't replicate in small-scale
18:57 jberger I wasn't checking for the notifications in the parent
18:58 sri guess that means we need ->reset
18:58 jberger was a good thought though
19:08 sri suppose that settles it
19:12 sri jberger: please test the new version in master with ->reset
19:12 mcsnolte joined #mojo
19:18 rshadow joined #mojo
19:19 sri hmm, i never see the results of these perl surveys :S http://blog.builtinperl.com/post/perl-developer-survey-2017
19:20 tudorconstantin I think this is the first one from the builtinperl (aka evozon) people
19:24 jberger sri: that one doesn't seem to work :(
19:24 jberger I even reinstalled v3.02 and used ->_cleanup again and that did
19:24 jberger I'm just baffled
19:25 rshadow joined #mojo
19:25 tudorconstantin I just finished completing that survey, at the end it says that "If you listed your e-mail address we'll email you the results."
19:27 orev joined #mojo
19:29 sri jberger: must be the disconnect
19:30 sri jberger: you are calling ->reset after fork, right?
19:31 jberger Minion::Job does that
19:32 jberger I'm doing the PubSub reset via the job start event here: https://github.com/kraih/minion/blob/master/lib/Minion/Job.pm#L62
19:36 sri jberger: ok, another try
19:38 jberger yes that worked
19:39 rshadow joined #mojo
19:40 jberger I don't understand that commit
19:48 Pyritic joined #mojo
20:08 msestak_ joined #mojo
20:10 stryx` joined #mojo
20:15 sugar_ joined #mojo
20:26 irqq joined #mojo
20:30 itaipu joined #mojo
20:32 good_news_everyon joined #mojo
20:32 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vyEeh
20:32 good_news_everyon mojo/master d4eaf95 Sebastian Riedel: add realpath method to Mojo::File
20:32 good_news_everyon left #mojo
20:33 sri looks like that test passes on windows
20:33 good_news_everyon joined #mojo
20:33 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vyEvB
20:33 good_news_everyon mojo/master 466b3bb Sebastian Riedel: update Changes
20:33 good_news_everyon left #mojo
20:40 sri pink_mist: btw. re Mojolicious::Command::chmod_file and friends, they exist because we show what happens to the user on STDOUT
20:41 sri if the method did anything else that could be considered useful it would be in Mojo::File
21:11 sri suppose throwing an exception on error could be considered useful
21:11 PryMar56 joined #mojo
21:17 good_news_everyon joined #mojo
21:17 good_news_everyon [mojo] kraih created chmod (+1 new commit): https://git.io/vyELM
21:17 good_news_everyon mojo/chmod 0706a5a Sebastian Riedel: add chmod method to Mojo::File
21:17 good_news_everyon left #mojo
21:17 sri just curious if it builds on windows
21:19 sri look at that, you can test owner read/write permissions on windows
21:19 sri good to know for the future
21:31 sri curious, the test fails on cygwin, and passes on activeperl
21:33 good_news_everyon joined #mojo
21:33 good_news_everyon [mojo] kraih tagged v7.28 at 051cda1: https://git.io/vyEmn
21:33 good_news_everyon left #mojo
21:35 sri reading jberger's tweets recently, this is how i imagine him :D https://www.youtube.com/watch?v=8fSW3vmRpV0
21:37 good_news_everyon joined #mojo
21:37 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vyEYI
21:37 good_news_everyon mojo/master 900d81b Sebastian Riedel: bump version
21:37 good_news_everyon left #mojo
21:37 polettix joined #mojo
21:45 jberger recently?!
21:45 jberger I've been pretty unhinged on twitter since the primaries
21:46 jberger neilb challenged me to not tweet anything depressing for the entirety of last weekend, and I survived
21:46 genio heh
21:46 jberger but then the new immigration ban and healthcare and I ... I just can't
21:47 itaipu joined #mojo
21:52 jberger and all of a sudden haarg follows me :-D
21:52 jberger hahahaha
21:52 purl LOLCON 4 reached.
21:53 maschine joined #mojo
21:54 Grinnz i didn't know Jonathan Banks was in Community
21:56 maschine Does anyone know if Mango supports SSL connections?  I have tried a standard connection string with the SSL=true, and it doesn't seem to work.  I can't find anything in the documentation that says it does..
21:57 preaction Grinnz: yeah, he replaced Chevy Chase for a bit
22:00 jberger maschine: odc is the current maintainer of mango IIRC
22:01 odc yeah, more like ex-maintainer actually
22:01 odc maschine: officially no
22:01 odc and i have never tried
22:03 odc there might be a way by customizing the ioloop object @ maschine
22:08 maschine ok, yeah I knew sri had stopped maintaining it
22:10 maschine I thought the official MongoDB did but I was trying to avoid it if possible
22:12 odc maschine: time for you to adopt a package ;)
22:13 maschine oh if only I was that skilled..  but is Mango pretty much orphaned then?
22:14 odc i will probably make a last release and then it's over
22:15 odc unless someone offers me a job including mongodb ^^
22:25 maschine if I thought i could do it I would.. I'd probably just make a mess of things though. ;)
22:33 Grinnz maschine: not knowing that much about the clients, I would suggest using the official MongoDB module, as it is maintained by MongoDB themselves
22:34 maschine yeah I think unfortunately that will be my only choice.  I just thought Mango was cleaner and there were more examples of it using Mojo
22:35 maschine the other option is not using SSL but that doesn't seem like a good idea, and anyway my DB host requires it.
22:37 Grinnz it is generally not a good idea, unless your network connection is entirely over an internal or VPN network
22:38 Grinnz in that case it's still not ideal, but not terrible
22:42 sri or don't use mongodb
22:43 sri our official database is postgres
22:47 jberger its kinda amazing how much I used to be afraid of sql databases and between learning, postgres being awesome and Mojo::Pg::Migrations, I can't really imagine going back
22:49 maschine might be able to do something like that - but I'd have to set up my own database server, as it's not one of the current available options.  Thanks for the tip.
22:49 maschine TBH I'm a bit afraid of SQL too. :)
22:49 preaction it's not SQL, it's the implementations of it
22:55 Bloke joined #mojo
22:59 sugar_ joined #mojo
23:00 Grinnz i would use postgres for almost everything if i had access to it. i still would probably use redis for some things, because it is incredibly fast at what it does
23:00 Grinnz i also would probably still use sphinxsearch/elasticsearch for our needs in that area, but i haven't really explored what postgres can do there
23:01 lluad Postgresql has some nice features for full text search, especially faceted search. It's not an elasticsearch replacement, but does many things well enough and some things better.
23:02 pink_mist Grinnz: you didn't miss this link did you? http://renesd.blogspot.com/2017/02/is-postgresql-good-enough.html
23:02 Grinnz i've seen it. but i'm not convinced it can do redis better than redis
23:02 Grinnz (also, redis is very fun to use)
23:03 pink_mist never on a front-facing server though =)
23:03 Grinnz not sure what you mean by that
23:04 pink_mist lots of deployments of that are completely unsecured is what I mean
23:04 Grinnz that's an unrelated issue
23:04 Bloke Does redis even offer "security"?
23:04 Bloke since your password travels in the clear, you don't really have one.
23:04 Grinnz not anything very useful, you simply shouldn't expose the port to anything but your application
23:05 odc maschine: ping
23:05 Grinnz sphinxsearch offers even less
23:07 Grinnz with postgres, it's just more difficult to screw up the pg_hba.conf in that way
23:11 Bloke If i'm writing a renderer is it a bad idea to provide my own $c->render()?
23:11 Bloke It seems like someone will have to pay attention to each of those calls to update stuff for the new template either wya
23:13 Grinnz Bloke: generally you provide a handler, not a render method. but you could provide any method you like as a helper, i just wouldn't call it render
23:14 Grinnz https://metacpan.org/pod/Mojolicious::Guides::Rendering#Adding-your-favorite-template-system
23:15 Grinnz also, if you're writing it to use a particular template system, there might be a plugin for it already on CPAN
23:25 sri i just wish SQL::Abstract supported more postgres features
23:26 Grinnz multiple insert is the only thing i'd like to see added (from mysql/postgres/sqlite standpoints)
23:27 Grinnz the rest is too iffy
23:27 sri it can't pass through arrayrefs as placeholders yet
23:27 sri that's a big one for me
23:28 sri you can't just do $pg->db->insert('some_table', {foo => 'bar', baz => [1, 2, 3, 4], yada => 23})
23:29 sri really sucks, since arrays in postgres are so awesome
23:33 jberger sounds like you're thinking of "forking" the sql generation logic from SQL::Abstract?
23:33 jberger I haven't looked into the code, I wonder how possible that would even be
23:34 sri dunno
23:35 jberger https://metacpan.org/pod/SQL::Abstract#Inserting-and-Updating-Arrays
23:35 sri uh
23:37 sri how the hell did i miss that
23:37 sri *facepalm*
23:37 jberger I was reading through the code and I saw ARRAYREF in places
23:37 sri that will be in tomorrow's release of Mojo::Pg i suppose -.-
23:37 jberger hehe
23:38 sri to be fair, everybody i asked for SQL::Abstract options for a postgres config missed it too ;p
23:39 jberger I'm not throwing shade, I hadn't even looked
23:39 zivester joined #mojo
23:39 jberger I'm a little surprised that there aren't options bundles or something
23:40 jberger SQL::Abstract->new(option_defaults => 'postgres') or some such
23:43 jberger I wonder if setting sqltrue, sqlfalse to something simpler would work?
23:43 jberger postgres booleans can be 't' and 'f', they don't need to be 1=1 and 1=0
23:44 jberger oh, nm, that's not what it means

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