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

IRC log for #mojo, 2015-07-15

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

All times shown according to UTC.

Time Nick Message
00:02 Grinnz dave__, yes every request will be handled by only one worker
00:02 Grinnz websocket or otherwise
00:02 dave__ thank you :)
00:07 PryMar56 joined #mojo
00:13 jberger dave__: but that does not mean that other connections will be to the same worker process
00:13 jberger which is why you need a message broker to do things like chat properly
00:13 jberger (you might know/understand that, I'm just stating for completeness)
00:14 Adura joined #mojo
00:16 preaction you can use some databases as message brokers, if it just so happens you also need to record the event
00:16 Grinnz also, the only really reliable message brokers happen to already be databases
00:17 preaction pshaw. zeromq has been excellently reliable for me
00:17 preaction though i suppose the 0 means "is not a broker really"
00:17 Grinnz ah right, message queues
00:17 Grinnz never used them :P
00:18 preaction router/dealer topology in zeromq will wait until one dealer exists before trying to route any of the pending messages
00:18 preaction which means you can start the clients _before_ the server, and everything will work just fine
00:19 Grinnz cool
00:20 zivester joined #mojo
00:20 preaction activemq is a broker which has something called KahaDB for its persistence layer, but i wouldn't call it a database. it's also clearly an Enterprise Solution :p
00:20 kaare joined #mojo
00:20 Grinnz heh
00:20 preaction that said, it hasn't been too terrible for my use-cases
00:29 jb360 joined #mojo
00:41 mattastrophe joined #mojo
00:53 adnane joined #mojo
01:03 sri hehe, the reddit drama just never stops
01:20 bowtie joined #mojo
01:52 gryphon joined #mojo
02:10 noganex_ joined #mojo
02:53 kaare joined #mojo
03:03 dvinciguerra joined #mojo
04:00 davido__ joined #mojo
04:33 absolut_todd joined #mojo
06:01 lluad joined #mojo
06:28 trone joined #mojo
06:33 cpan_mojo Mojo-Redis2-0.22 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/Mojo-Redis2-0.22
06:49 dod joined #mojo
06:52 dod joined #mojo
06:55 AndrewIsh joined #mojo
06:55 anielsen joined #mojo
06:59 Grinnz batman, that is known behavior re: localizing $@: https://metacpan.org/pod/Try::Tiny#Localizing-silently-masks-errors
07:00 Grinnz though i don't think the workaround mentioned there is the best ;)
07:00 Grinnz what you did is more what i usually do
07:00 Grinnz make a subscope, and assign $@ to an outer-scoped variable, where it can be used in die
07:01 batman Grinnz: thanks :)
07:05 anielsen I have to redirect some old URLs containing an opening parenthesis (
07:06 anielsen but it seems like my route will match almost anything. example:
07:06 anielsen perl -E 'use Mojolicious::Lite; get "/(foo" => sub { shift->render(text => "hello world") }; app->start' get "/bar"
07:06 batman anielsen: have you tried "/\(foo" ?
07:06 anielsen I get a 200 but i would expect a 404
07:06 anielsen yes batman but with the same result
07:07 batman ok. (just guessing)
07:07 hshong joined #mojo
07:07 eseyman joined #mojo
07:10 batman anielsen: i think you're bitten by quote_end and quote_start... can you try this: $r = get("/(foo" => sub {...}); $r->pattern->quote_start('{');
07:11 batman or just  $r->pattern->quote_start('');
07:11 trone joined #mojo
07:21 anielsen I will try it batman
07:33 lluad joined #mojo
07:33 anielsen it seems like quote_start must be called before the pattern is parsed
07:33 amon joined #mojo
07:34 anielsen perl -E 'use strict; use Mojolicious::Routes::Pattern; my $pattern = Mojolicious::Routes::Pattern->new(); $pattern->quote_start("["); $pattern->parse("/(foo"); say "Match" if $pattern->match("/bar")'
07:34 anielsen ha!
07:34 Vandal joined #mojo
07:35 anielsen the example it just posted works except for the smileys :-)
07:35 anielsen it matches /(foo and not /bar
07:38 anielsen but I am not sure how to writes this in an app...
07:39 hshong joined #mojo
07:45 berov joined #mojo
07:54 bzero Hello. How to turn off template's caching?
07:56 batman anielsen: Not sure if it's a bug or not... I was also hoping /((foo) might work, but I don't think so
07:56 batman sri: got any input?
08:10 richard joined #mojo
08:15 richard batman, Grinnz: If you don't localise $@, in what ways can you be bitten?  (I'm wondering when it is useful)
09:06 lluad joined #mojo
09:14 jontaylor joined #mojo
09:31 salva joined #mojo
09:33 dp_ joined #mojo
10:12 absolut_todd joined #mojo
10:27 Amurita joined #mojo
10:29 Amurita joined #mojo
11:01 neilhwatson joined #mojo
11:04 mattastrophe joined #mojo
11:07 eitz joined #mojo
12:30 psimanx1 joined #mojo
12:39 Lee joined #mojo
12:45 dvinciguerra joined #mojo
13:00 lluad joined #mojo
13:01 Grinnz richard, if code runs between when an eval sets $@ and when $@ is used, and runs another eval, it will clobber whatever was in $@; this is only really a problem because that code can also be *a destructor from an object going out of scope*
13:02 Grinnz https://metacpan.org/pod/Try::Tiny#Clobbering
13:04 Grinnz that module's docs are really the main things you need to know: $@ is a global and everything that entails, localizing $@ will prevent dies in that scope from working properly, and the only proper way to test if an eval dies is to have it return 1 and test for a false return value
13:06 richard So if I'm doing eval {...; 1} or do {my $err = $@ // 'unknown'; ...} then I don't need to worry
13:06 richard cos nothing happens betwix setting $@ and using it
13:07 Grinnz no, you are still clobbering $@, and a destructor can still fire at the end of the eval block (but you can't avoid that part)
13:07 purl okay, Grinnz.
13:07 Grinnz if you don't need to die in that scope at all, the solution is simple: local $@ before the eval
13:08 richard ok, so I only need to worry if there could be an object going out of scope when $@ fires within the eval
13:08 Grinnz otherwise, it's more what batman did: my $err; { local $@; eval { ...; 1 } or $err = $@; } if ($err) { ... }
13:08 Grinnz you can be more defensive for false values of $@, but i find that's not usually necessary
13:10 richard I guess something I'm calling could fire $@ within a scope with lexically scoped objects (with destructors)
13:11 Grinnz (and Try::Tiny does all of this for you, if you don't want to worry about it)
13:11 genio or why not just use Try::Tiny that does that for you?
13:11 richard but then they should know about that cos their code would never supply $@
13:11 Grinnz you'd be surprised :/
13:11 Grinnz but yes i usually call that a bug in the other module
13:12 richard my problem with Try::Tiny is I often want to catch problems more general than exceptions
13:12 Grinnz i don't follow
13:13 Grinnz my problem with Try::Tiny is mainly that you can't directly return from the catch block
13:13 richard my $rs = eval { $dbh->selectall_arrayref ... } or do { ... }
13:13 richard I'm using the expression rather than 1
13:14 richard ie catch exceptions and cases of falsity
13:14 Grinnz if you want to be correct, you can't use the return value
13:14 richard ?
13:14 Grinnz you have to do my $rs; eval { $rs = $dbh->...; 1 } or do { ... }
13:15 richard oh, the return value from the eval -- why not?
13:15 Grinnz because the return value from the eval is the only foolproof way to know there was an exception
13:15 richard hm, I don't follow
13:16 richard Either I got a value in my expression or I didn't
13:16 Grinnz (moot in this case, since selectall_arrayref always returns true)
13:16 richard If I didn't, it's cos of an exception or something else unforeseen (ie weird data)
13:16 richard yeah, that was a bad example
13:17 Grinnz my point is, if you treat exceptions and bad data the same there is no way to differentiate
13:17 Grinnz which is ok for some cases, sure
13:17 richard ok, so if I don't need to differentiate, I'm ok
13:18 richard but I guess you're saying that "$@ // 'unknown'" is unreliable cos something I call might clobber $@
13:18 zivester joined #mojo
13:21 Grinnz in that case you wouldn't be able to do that, because $@ might be false because there wasn't an exception
13:21 Grinnz and you'd want to use || not //, errors are generally "false" not undef
13:22 Grinnz or lack of errors, as it were
13:23 richard my ($rv) = eval { $dbh->selectrow_array('COUNT * FROM ...') } or $self->report($@ || 'weird shit happened')
13:24 richard Thanks for explaining, Grinnz
13:24 Grinnz and that one wouldn't work because a count of 0 would also be false :P
13:24 richard yes, that's my point :)
13:25 Grinnz as long as you're expecting that, i suppose
13:25 richard yeah
13:28 richard Your comment about not returning from the catch block reminded me why I stopped using Try::Tiny
13:28 richard the majority of my cases I need/want to bail out upon critical errors
13:28 richard Is there any workaround, like using the return value from the 'catch'?
13:30 richard my $bail_out; try {...} catch {...; ++$bail_out}; return if $bail_out;
13:30 richard would get really boring
13:32 ajr_ joined #mojo
13:34 Grinnz dunno
13:47 ans joined #mojo
13:49 richard http://perldoc.perl.org/perl5140delta.html#Exception-Handling
13:50 Grinnz unfortunately, 5.14.0 is not the oldest version used :P
13:52 richard It is here \o/
13:52 Grinnz but yeah if you only support 5.14.0+ then it becomes a bit simpler: you can just local $@ and then die
13:52 gryphon joined #mojo
13:53 richard looks like I don't even need the local
13:53 Grinnz you should still localize, as it's a global variable
13:53 Grinnz the localizing is to prevent clobbering other $@s, not your own :P
13:53 richard ah, ok
13:55 richard that text seems to be suggesting that eval { local $@; ...; 1} or do { my $e = $@ || 'unknown'; ...}; should work
13:55 richard the location of the 'local' is a bit surprising
13:56 Grinnz erm, no, that would never work
13:56 Grinnz you'd lose $@ when exiting the eval
13:56 Grinnz i think the wording is wrong
13:57 Grinnz oh, i see what you mean, maybe
13:57 Grinnz but that would defeat the purpose of localizing $@
13:57 Grinnz since it would still be written globally outside the scope, if that did work
13:58 Grinnz i think it's talking about localizing $@ inside an eval when you want to call more evals
14:01 Grinnz and while destructors are the primary "surprising" reason your $@ might get clobbered in 5.10/5.12, it's sometimes easy to miss something like eval { ... } if ($@) { something_that_evals(); warn $@; }
14:01 Grinnz so in general assigning $@ to another var as soon as possible is a good idea
14:10 batman joined #mojo
14:11 batman anielsen: i'm back :) did you get any help?
14:42 arthas joined #mojo
14:43 vytas joined #mojo
14:45 eitz_ joined #mojo
15:07 PryMar56 joined #mojo
15:09 tencendur joined #mojo
15:10 anielsen no batman i didn't
15:13 mattastrophe joined #mojo
15:44 CandyAngel sri: My whitespacing may annoy you (though I am trying to change it), but at least I don't mix tab/space indentation :P
15:44 Grinnz_ there's a special place in hell reserved for that
15:45 Lee yeah, it's called legacy code that's been maintained by many different users :D
15:45 CandyAngel :P
15:45 * pink_mist suggests getting https://github.com/kraih/mojo/blob/master/.perltidyrc and running your code through perltidy
15:45 CandyAngel Wow, legacy code in a 0.01 release? Impressive :)
15:46 ans1 joined #mojo
15:49 Lee oh, 0.01? in that case mixed tab/space would be idiotic :D
15:50 CandyAngel Reading that perltidyrc reminds me that I thought of a reason I use 4space indent over 2space.. and now I don't remember it
15:50 Grinnz_ needed to make sure your files had enough bytes?
15:51 CandyAngel :P
15:51 CandyAngel Bigger script == better script, right?
15:51 CandyAngel Oh yeah.. it was really lame.. ternary switch alignment :P
15:51 Grinnz_ (i use 4-space tabwidth, it seems most readable to me)
15:52 CandyAngel ") ? " is 4 characters :P
15:52 CandyAngel I space things out a lot I guess
15:52 * Lee puts the ? on the next line
15:53 * Lee spaces things out *a lot* :)
15:53 Grinnz_ yeah, i've started doing the ? and : as start of next line when things get complex
15:54 CandyAngel http://codepad.org/SxXpJnWQ
15:54 CandyAngel That's how I lay simple ones out
15:54 Grinnz_ you have a strange definition of simple
15:54 pink_mist yeah that's not a simple one :P
15:54 CandyAngel Oh
15:57 CandyAngel Here's how I lay out simple-to-lay-out ones? :P
16:03 jberger well this is better than nothing I guess: https://github.com/isagalaev/highlight.js/pull/722#issuecomment-121572054
16:04 Grinnz_ nice
16:07 jberger dotan++
16:12 jonasbn joined #mojo
16:15 dotan Woah.
16:19 jb360 joined #mojo
16:22 jonasbn joined #mojo
16:22 dotan I started looking at prism.js, but got stalled figuring out how to do a simple build and test. It's a project that clearly comes from a front-end dev, so no CLI build process last I looked. Several people contributed grunt or gulp files, but the build process runs in a web page...
16:23 dotan And highlight.js won't help until this bug gets fixed: https://github.com/isagalaev/highlight.js/issues/725
16:23 Grinnz_ > the build process runs in a web page...
16:23 Grinnz_ DEAR GOD
16:24 dotan Frontend peoples, I tell you...
16:24 jberger wow and it breaks <% tags as well as {{ tags
16:25 jberger that's like, most of the tags
16:25 jberger except for the php tags which are essentially a language "feature"
16:31 marcus Vacation <3
16:32 jberger marcus: where do you find yourself?
16:34 sri we will never use highlight.js, no need for another mlehmann in our dep chain
16:35 sri also rather disillusioned with prism.js since the author called all germans nazis on twitter
16:35 jberger what, merge a simple patch 7 months later, after bitching about it, what isn't good software stewardship there?
16:36 jberger GODWIN!!!
16:36 purl godwin is at http://fr.wikipedia.org/wiki/Loi_de_Godwin or http://xkcd.com/c261.html
16:37 jberger purl: are you french?
16:37 purl jberger: bugger all, i dunno
16:45 punter joined #mojo
16:55 sri oh, jquery 3.0 will use promises/a+
16:56 dvinciguerra joined #mojo
17:09 disputin joined #mojo
17:20 jontaylor I’m wondering how cheap I can get away with for hosting on a new startup
17:20 jontaylor AWS was insanely expensive
17:21 jontaylor dedicated servers are loads cheaper, but even then, its hard to predict traffic or app load in advance
17:21 jontaylor i’d normally have seperate app and db boxes, but i’m wondering if just having two big beefy boxes would be best
17:22 jontaylor both running DB and APP, one DB replicates to the other
17:22 jontaylor during normal operation I can run web processes on the DB slave
17:25 CandyAngel That moment when your method names make everything line up <3
17:25 jberger CandyAngel++
17:25 mattp joined #mojo
17:26 jberger jontaylor: if you do it just right you might be able to launch for free using heroku and comparable db hosts
17:26 jberger otherwise, I have used Linode with no complaints and I know that there are several DigitalOcean users here (batman)
17:27 jontaylor jberger: our of those I think DigitalOcean looks pretty good, I might hit batman up for a review
17:27 jontaylor the other options i’m looking at are places like OVH
17:29 jontaylor you can get an 8 core server, with 96GB of ram, and SAS drives for like £50 a month ($80 ish)
17:29 jontaylor two of those would work great for ages
17:29 jberger http://galileo-cms.herokuapp.com/page/home is on heroku
17:29 jberger the ephemeral file system is great for demos, not so good for live apps
17:29 jontaylor i know i’m likely to have a DB that grows by about 7GB a month from my first customer
17:30 jontaylor this stuff is all so much more enjoyable when its at hobbyist level heh
17:30 Grinnz_ yeah storage would probably be your issue then
17:31 jontaylor i’m going to be getting about 30 million new rows a month, i’ve done the best I can to optimise the DB, having aggregate tables by minute, hour, day, week etc to keep performance up for reports etc
17:31 jontaylor but yeah I think i’m gonna have to pay out for something expensive
17:34 disputin joined #mojo
17:34 dod joined #mojo
17:52 sri aws is for companies that can spin up new servers automatically
17:52 sri like automatically growing and shrinking your server pool based on load
17:54 sri otherwise it's just a way way way expensive and underpowered server
17:54 ajr_ joined #mojo
17:59 batman i think heroku is awful.
17:59 batman digitalocean++
18:00 batman oh. jontaylor has gone :/
18:00 berov1 joined #mojo
18:00 mst yeah, though DO just raised a huge round of funding that worries me slightly
18:02 dvinciguerra joined #mojo
18:02 batman i will worry when that time comes. right now i will enjoy being a happy customer :)
18:07 mattastrophe joined #mojo
18:21 bin_005 joined #mojo
18:22 trone joined #mojo
18:27 meredith heroku's design is neat, but i think the price adds up quickly too
18:28 meredith i use DO and i'm pretty happy with the mildly-clunky scripted spinup you can do with it
18:34 batman meredith: yeah. not even the free instance is value for money :(
18:36 meredith I was actually playing around with https://github.com/progrium/dokku on a DO box like a month ago.
18:39 sri it's funny how you never hear anything about http/2 now, aside from  a few google evangelists yelling
18:42 sri jzawodn: are your slides available somewhere?
18:45 mst sri: btw, is there a comment or an issue somewhere to explain why you have an AUTOLOAD but no can() ?
18:45 pink_mist you're gonna make sri leave again!
18:45 sri i answered that before
18:45 pink_mist no you went to have lunch
18:45 pink_mist or something like that
18:45 purl something like that is totally possible
18:45 pink_mist foot at least
18:45 pink_mist *food
18:46 mst sri: no, you didn't, you said 'food now' and fucked off without answering
18:46 sri http://irclog.perlgeek.de/mojo/2015-07-12#i_10884573
18:46 mst ooh
18:46 mst so adding can() would let people accidentally route to a helper
18:46 mst which ... yeah, not a good idea
18:48 mst wow, stratopan is still in beta?
18:48 * mst wonders if I'll end up obsoleting it before it even launches
18:48 pink_mist I didn't think mstpan had quite the same goal :P
18:49 * mst laughs
18:49 mst not the same plan
18:52 dod joined #mojo
18:52 sri marcus: this weeks brawl is the worst!
19:05 martin joined #mojo
19:07 jberger joined #mojo
19:13 Grinnz_ hy you have an AUTOLOAD but no can() ?
19:13 Grinnz_ 14:45:26         <pink_mist> you're gonna make sri leave again!
19:13 Grinnz_ oops
19:13 Grinnz_ :select-clipboard:
19:13 Grinnz_ https://github.com/kraih/mojo/issues/821#issuecomment-121716774
19:13 Grinnz_ wtf, prettify.
19:14 sri yea, we've known that for a long time
19:14 sri still, prettify.js with google tracking is still better than the alternatives
19:14 Grinnz_ :/
19:24 good_news_everyon joined #mojo
19:24 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/vm4l0
19:24 good_news_everyon mojo/master 3c6b58f Sebastian Riedel: no need for heading elements to be displayed as inline-block (closes #821)
19:24 good_news_everyon left #mojo
19:45 ajr_ joined #mojo
19:49 bin_005 joined #mojo
19:53 disputin joined #mojo
20:10 ans joined #mojo
20:20 mattastrophe joined #mojo
20:33 jabberwok joined #mojo
21:05 bin_005 joined #mojo
21:07 Flying_Squirrel joined #mojo
21:10 punter joined #mojo
21:13 cpan_mojo Mojolicious-Plugin-AccessLog-0.010 by GRAF https://metacpan.org/release/GRAF/Mojolicious-Plugin-AccessLog-0.010
21:15 neilhwatson joined #mojo
21:17 genio any of you played with oboe.js?
21:51 mattastrophe joined #mojo
22:10 disputin joined #mojo
22:17 PryMar56 joined #mojo
22:50 punter joined #mojo
23:17 Dave do people use DBIx::Lite very much?
23:20 sri nope, it appears to just come up in api discussions every now and then
23:20 Dave you write your sql directly right?
23:20 sri in actual use i mostly see DBIx::Class and Mojo::Pg (and friends) around here
23:21 * sri does
23:21 Dave probably the fastest
23:28 disputin joined #mojo

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