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

IRC log for #mojo, 2014-12-09

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

All times shown according to UTC.

Time Nick Message
00:16 absolut_todd joined #mojo
00:41 disputin joined #mojo
00:45 meshl joined #mojo
00:47 disputin joined #mojo
01:18 jamesw joined #mojo
01:26 woz joined #mojo
02:01 davido__ joined #mojo
02:04 wim joined #mojo
02:37 woz joined #mojo
02:53 klapperl_ joined #mojo
03:14 noganex joined #mojo
03:27 tencendur joined #mojo
03:31 bobkare joined #mojo
03:37 Eke- joined #mojo
04:02 good_news_everyon joined #mojo
04:02 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/QQNqEw
04:02 good_news_everyon mojo/master 761137b Sebastian Riedel: added following, following_siblings, preceding and preceding_siblings methods to Mojo::DOM
04:02 good_news_everyon left #mojo
04:02 sri the functionality was basically already there, seemed like a waste not to expose it with a public api :)
04:05 sri wish i could switch the meaning around though
04:06 sri preceding for nodes, and preceding_siblings for elements
04:06 sri but next and next_sibling already work opposite
04:06 sri i remember i wanted to switch those around in 5.0... but it would cause too much breakage
04:07 nicomen what you mean opposite?
04:08 nicomen sibling for nodes?
04:08 sri i mean switch the methods
04:08 sri i want next to be next_sibling and next_sibling to be next
04:08 nicomen aaah
04:09 nicomen I think it will be really confusing to have them be opposite :-)
04:10 sri might be worth deprecating this one though http://mojolicio.us/perldoc/Mojo/DOM#siblings
04:11 nicomen Mojo::DOM->siblings is elements and not nodes also?
04:11 nicomen ah yeah...
04:11 sri it has very few uses... and i think most are covered by the new methods much better
04:11 zivester joined #mojo
04:11 nicomen when you deprecate things I often wished you added docs on how to accomplish the same
04:12 sri when i deprecate something and nobody says anything i assume it's mostly unused and it's not worth the effort
04:13 nicomen I don't think most users of mojolicious are here, or follow the repo closely
04:14 sri well, if they don't participate they can't expect me to put in extra effort for them
04:14 nicomen true, but then if the stuf they are usingis changing very fast, AND there are no easy ways to change their code, you can't expect them to continue using mojolicious?
04:15 sri if they don't say anything, how do you know they are unhappy?
04:15 preaction they use something else
04:16 sri you're making assumptions about hypothetical users
04:16 nicomen the only proof I have is people complaining to me mojolicious changes things too fast, I think having at least a perldoc on how to do things that were previously possible is an easy mean to stay
04:16 sri nicomen: where did they complain?
04:17 preaction no, i see it happen to my code all the time. i am literally 20 feet from some of my co-workers, and rather than waddle over to ask me to fix something in my code, they will rewrite it, wasting hours of their own time
04:17 nicomen at my office? in perl meetings
04:18 sri if you want to volunteer, be my guest
04:18 sri if those hypothetical people have a problem they can come to me directly
04:19 nicomen ok
04:21 sri but honestly, whenever i see a complaint regarding backwards compatibility, those people never even bothered looking at Changes
04:21 sri so, more details wouldn't help those i know about
04:22 sri of course, this is only people who actually talk
04:23 nicomen I think I pay close attention and there were some Mojo::DOM changes a year ago that were quite disruptive, I had to dig a long time to find a way to accomplish the same I was doing (sorry I don't remember now), but if the changes entry had "if you want to still do X, you need to do Y now"
04:23 nicomen I think the rewrite of MojoØØDOM fixed that issue for me actually
04:25 nicomen So, just to not get misunderstandings: 1) quick evolvement is good, 2) your stuff is awesome, 3) I think quick)simple migration instructions upon deprecation helps keeping the user base happy
04:25 woz joined #mojo
04:26 franzkafka joined #mojo
04:28 franzkafka mst: Ya know what I dislike more than this brogrammer thing? The whole cool geek programmer with his macbook in a guitar case just waiting to pull it out into this crazy looking terminal, h4x0r it up real quick, do genius shit that's beyond the ability of anyone to understand, all while drinking a coffee...
04:29 franzkafka I can't stand any of the stereotypes really, but that one especially irks me. The programmers I work with are all normal people, many with families, BBQs on the weekend, that kind of shit. Your average Joe/Jane pretty much. Not some rockstar genius.
04:29 * sri pushes his guitar case under the table
04:31 sri you can be a hollywood hacker too! http://hackertyper.net
04:31 franzkafka :D
04:31 akhasanov joined #mojo
04:32 franzkafka haha, that is awesome.
04:33 preaction be careful, with your ray-bans and black trenchcoat, you may not notice them calling the cops on your leet skillz
04:34 franzkafka I'd never even heard this term brogrammer, and I don't think I've ever met a programmer whose like, "Dude, after I watch this game of football and drink this keg of beer, let's fucking rock this program bro!"
04:34 franzkafka I can't even imagine that person
04:35 firnsy lol ... you just described most of my weekends
04:35 franzkafka It's a paradox so great that to imagine that may make your mind explode.
04:35 franzkafka firnsy, wait, you're him?
04:36 franzkafka the mythical brogrammer, firnsy, the one.
04:36 firnsy i watch football (most sports), drink by the barrel and am all about the code
04:36 * preaction cues the angelic choir
04:36 firnsy ... i ain't no brogrammer though
04:37 franzkafka firsy, I imagine you hitting the last keystroke and then crushing a can of beer against your forehead
04:37 franzkafka s/firsy/firnsy
04:37 firnsy come get some</duke>
04:38 franzkafka My neighbor dropped his spider off at my house thinking my 5 year old son might be interested in having one as a pet, therefore a trial run of a week would be a good idea. I now have the most annoying cricket chirping and a spider that I haven't even seen yet.
04:39 franzkafka I think my neighbor is going out of town and I'm watching his spider. That or it's a cage with nothing but a cricket, and he thinks this is a great joke.
04:39 preaction that's kinda weird
04:40 firnsy the cricket is lunch?
04:41 franzkafka my neighbor is weird. A good guy, but weird.
05:02 good_news_everyon joined #mojo
05:02 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/LF8Olw
05:02 good_news_everyon mojo/master 6030b08 Sebastian Riedel: test root node too
05:02 good_news_everyon left #mojo
05:05 sri does anyone actually have a use case for Mojo::DOM::siblings?
05:05 sri otherwise, i think it might get deprecated
05:06 preaction i can't think of anything I couldn't just as easily do via adjacent-sibling selectors or "> *" or something
05:32 good_news_everyon joined #mojo
05:32 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/f6Xu9w
05:32 good_news_everyon mojo/master f308b6d Sebastian Riedel: deprecated Mojo::DOM::siblings
05:32 good_news_everyon left #mojo
05:41 good_news_everyon joined #mojo
05:41 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/HjPzXg
05:41 good_news_everyon mojo/master b8cd5da Sebastian Riedel: these two methods work on all node types
05:41 good_news_everyon left #mojo
05:50 good_news_everyon joined #mojo
05:50 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/tzcocg
05:50 good_news_everyon mojo/master 4b7c743 Sebastian Riedel: group related methods
05:50 good_news_everyon left #mojo
05:54 sri Mojo::DOM has quite a few methods now http://mojolicio.us/perldoc/Mojo/DOM
06:01 rem_lex|pivo joined #mojo
06:02 sri btw. the idea for preceding/following is from hpricot, saw it while browsing the code
06:03 sri it's dead, but i find the api more pleasant than nokogiri
06:14 woz joined #mojo
06:25 mattastrophe joined #mojo
06:38 jberger joined #mojo
06:42 ver joined #mojo
07:00 Eke- joined #mojo
07:16 meshl joined #mojo
07:28 franzkafka sri, with the latest commits are we going to see the speed increases you were talking about the other day?
07:32 batman franzkafka: if i have understood correctly, it's mostly coming from the latest perl dev release
07:33 Vandal joined #mojo
07:42 jamesaxl joined #mojo
07:55 denis_boyun joined #mojo
08:03 sugar joined #mojo
08:03 woz joined #mojo
08:10 dod joined #mojo
08:10 sugar_ joined #mojo
08:14 dod joined #mojo
08:16 eseyman joined #mojo
08:29 trone joined #mojo
08:35 sugar__ joined #mojo
08:45 amon joined #mojo
08:45 basiliscos joined #mojo
08:45 ver joined #mojo
08:48 basiliscos joined #mojo
08:49 fhelmberger joined #mojo
08:58 Eke|| joined #mojo
09:00 woz joined #mojo
09:08 fhelmberger joined #mojo
09:13 sugar joined #mojo
10:37 niczero joined #mojo
10:37 neyasov___ joined #mojo
10:37 niczero I love the idea of asking someone to look after an empty tank
10:38 niczero "Watch out for that dodgy catch on the lid.  Don't worry if you don't see him for a while, he's very shy."
10:39 niczero "But please be careful.  Once his venom is airborn it's game over."
10:40 niczero It would be great if we the people added wiki notes on how to upgrade across a deprecation
10:40 niczero sorry, on the phone
10:41 niczero "WHATDYAMEAN HE'S NOT IN THE TANK?!?"
10:44 apl sri: turns out, the performance problems had nothing to do with minion.
11:28 fhelmberger joined #mojo
11:48 meshl joined #mojo
11:51 denis_boyun joined #mojo
12:01 fhelmberger joined #mojo
12:18 asarch joined #mojo
12:39 meshl joined #mojo
12:46 punter joined #mojo
12:51 sugar_ joined #mojo
13:05 tencendur joined #mojo
13:19 ignacio_ joined #mojo
13:23 McA3 Hi all. A design question: When the result of a HTTP request is a change in the business model, how do you seperate the web server/web request stuff from the function/methods doing the real work. E.g. you want to be able to do the business logic via webserver (Mojolicious App) and on the commandline presenting all input variables there. What is your advice?
13:27 neilhwatson joined #mojo
13:29 moritz McA: have a module (or even service layer) with business logic
13:31 McA @moritz: Where do you all the parameter checking?
13:32 moritz McA: depends, but usually in the business model
13:32 McA moritz: Do you throw exceptions?
13:34 McA moritz: ...sorry, in case of invalid parameters to be able to react appropriatly
13:35 jberger_ joined #mojo
13:36 jberger_ McA: that is basically the definition of a helper in mojolicious
13:36 McA jberger: Hi
13:37 McA I'm just digging into Mojolicious...what is a helper in terms of MJ
13:39 McA jberger: Have you used a helper in 'Galileo' to see an example?
13:41 jberger_ There are many, but please, read the tutorial and the guides at mojolicio.us/perldoc
13:42 jberger_ When you have troubles please ask, but I'm sure you understand that we can't teach the basics I've person at a time
13:42 McA jberger: I found them. Thank you.
13:42 jberger_ s/I've/one/
13:46 jberger aha, got my main irc client back
13:47 McA jberger: Looking at the helpers you defined in Galileo I'm not sure whether this construct is made for calling seperated business logic based ob the parameters and request given.
13:47 McA s/ob/on/
13:48 jberger think of them as a way to wrap business logic into the webapp
13:48 jberger they are also useful to define shared functionality so you might see that too
13:49 McA How would you then communicate failures/exceptions?
13:50 jberger this is just perl, they are just functions
13:51 jberger again, lots of this is covered in the basic doc
13:51 jberger there is a lot in there, please read not just skim
13:52 McA jberger: Sorry, wehn you get the feeling I've NOT read the docs.
13:52 McA jberger: I want to get a feeling for the code style
13:54 McA jberger: E.g. oyu have a helper in Galileo 'get_user'
13:55 McA jberger: It's not wrapped up in an excpetion handling block. So I assume when there is trouble with the underlying DB this is shown as an ugly exception to the user.
13:56 jberger http://mojolicio.us/perldoc/Mojolicious/Lite#Built-in-exception-and-not_found-pages
13:56 doby joined #mojo
13:56 McA jberger: Yes, that is what I saying
13:56 McA jberger: The end user hets a stack trace and an excerpt of the source code
13:57 jberger prod 500 page does not have that dump
13:57 jberger and you can define your own
13:58 McA jberger: Would I have to put a try-catch-block around every helper-call or would you prefer the helper reacting on its own
14:00 moritz McA: yes, throw exceptions on invalid input
14:00 jberger "this is just perl, they are just functions"
14:01 jberger if an exception makes it to the io loop it catches it and renders a 500
14:02 jberger the only other architectural option would be for an exception to bring down the server
14:02 jberger which we wouldn't do
14:02 moritz McA: the alternative is to have a separate validation function for each business function/method you call
14:03 moritz McA: which comes down to more boilerplate code in the end
14:03 McA jberger: Thank you for your time and sorry for bothering.
14:04 jberger :-)
14:05 jberger remember that code that you didn't write might die too, so there always has to be exception handling
14:06 McA jberger: And TIMTOWTDI, I know.
14:21 punter joined #mojo
14:37 akhasanov joined #mojo
14:38 odc` joined #mojo
14:47 sugar_ joined #mojo
14:52 sri jberger: that's actually not true
14:52 crab what's not true?
14:52 sri if an exception reaches the ioloop you get a connection timeout
14:53 sri to get a 500 page Mojolicious needs to catch the exception
14:54 sri hahaha... PL_methstash
14:55 jberger sri: yeah, true
14:55 jberger close enough for McA at this point though
14:55 meshl joined #mojo
14:56 McA jberger: :))
15:04 mattastrophe joined #mojo
15:11 tbushell_ joined #mojo
15:13 tbushell_ joined #mojo
15:13 good_news_everyon joined #mojo
15:13 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/lg-z-w
15:13 good_news_everyon mojo/master 092b5da Sebastian Riedel: clean up connections a little more consistently (closes #715)
15:13 good_news_everyon left #mojo
15:13 tbushell left #mojo
15:14 tbushell joined #mojo
15:15 tbushell left #mojo
15:39 sh4 joined #mojo
15:52 nick joined #mojo
16:00 akhasanov joined #mojo
16:00 odc` so, i'm doing a classic '$c->delay(subs...)->catch(sub{})'  and when an error occurs, i get Can't call method \"catch\" on an undefined value
16:01 odc` any idea why this may be happening?
16:02 Grinnz_ because the thing before it is returning undef
16:03 odc` yes, but i can't find how is this possible
16:03 odc` i'm reading the ioloop::delay code...
16:04 * odc` is starting to suspect perl's memory management
16:04 mst ah, yes, "must be a bug in perl", the last resort of somebody failing to find the real bug
16:05 odc heh, exactly :)
16:05 mst maybe if you showed some code?
16:05 mst I still find delay a bit bizarre compared to futures but it's still a great improvement over debugging POE :)
16:06 sri http://mojolicio.us/perldoc/Mojolicious/Plugin/DefaultHelpers#delay
16:07 odc damn it! i'm using the helper
16:09 odc yhx
16:09 odc i mean thank you
16:09 mst you hate xml?
16:09 mst good
16:09 mst :D
16:09 Grinnz_ +1
16:09 purl 1
16:16 sri mst: i'm still waiting for someone to make promises look better than delays in actual code
16:17 sri and i don't think there's an implementation of promises that provides leak protection yet
16:18 mst sri: I find IO::Async + Future code to look better and be more readable than Mojo delay based code.
16:18 mst I know you don't
16:19 mst I suspect I'll have to find an excuse to write something using Mojo, and then see if that changes my mind
16:21 sri mst: you've got a non-trivial example that looks great and doesn't leak?
16:22 sri allright
16:22 sri lets take this one as an example
16:22 sri https://metacpan.org/pod/IO::Async::Resolver
16:23 sri lets say you want to call ->getnameinfo twice, but the second time after the first one was successful
16:23 sri how do you do that without leaking?
16:24 jberger mst: here is a demo app that I made for mojoconf: https://github.com/jberger/MojoForum/blob/master/lib/MojoForum/Helpers.pm
16:24 jberger I think that's decently readable if a bit repetitive with all the 'die $err if $err;'
16:24 mst sri's the one who seems to want to turn a matter of aesthetics into an argument
16:24 mst I'm happy enough with "different people have different opinions"
16:25 jberger notice also that some of those call eachother
16:25 * sri drops the mic
16:29 sri allright... lets just make fun of node.js together then :)
16:31 jberger I wonder if I can find the logs from back when sri almost took Mojo 5.0 to promises
16:32 sri promises in ghost certainly are beautiful ;p https://github.com/TryGhost/Ghost/blob/master/core/server/require-tree.js#L68
16:35 odc just wait for perl6, Delay is good enough
16:37 franzkafka so frustrating to start each day looking for my lighter.
16:38 franzkafka I think I have 15 lighters in this  house, at least; yet each day begins with looking for my lighter.
16:38 franzkafka All I want is some coffee and a cigarette.
16:39 jkramer Tie it to the coffee machine then
16:42 * sri is glad he quit smoking
16:43 * marty is still working on kicking the coffee habit.
16:43 * jkramer is glad he always knows where all his lighters are
16:44 mst the cleaners always leave them in a neat pile for me
16:44 mst so for the first half of the week or so it's easy
16:44 * jberger smokes his coffee, suspects he is doing it wrong
16:45 jkramer Or maybe you're onto something... caffein cigarettes!
16:46 jkramer The best two neurotoxins combined
16:47 sri maybe you can fill those e-cigarettes with coffee
16:48 Grinnz_ and throw in some cocaine!
16:48 sri hahahaha
16:48 purl LOLCON 4 reached.
16:48 sri http://www.vaporboost.com/stamina-e-cigarette-e-liquid-juice-energy-caffeine-taurine/
16:49 sri SMOKE ALL THE THINGS
16:50 nicomen holy smokes
16:51 mst one of those loaded with that and a second one loaded with a nicotine+THC mix would be awesome
16:53 Ptolemarch joined #mojo
16:54 niczero A 2-cup-a-day drinker needs those two cups just to get their head to the level of someone who never partakes
16:55 mst it's more complicated than that
16:55 niczero If you drink above your average, you're just borrowing from the subsequent day when you drop your level again
16:55 nicomen is there some way to monitor steps and/or running delays?
17:00 hesperaux joined #mojo
17:11 mikegrb vaporized caffiene doesn't really work well because the dose you need via inhalation is high enough that you can't disolve it into the juice
17:12 mikegrb there's a company that uses a catalyst to get more of it disolved and then your dealing with more odd stuff in the juice
17:12 mikegrb I don't trust their mojo
17:23 * Grinnz_ not sure if intentional
17:35 sri hmm
17:35 sri prove -l t/mojo/websocket.t
17:35 sri that one results in a global destruction warning every now and then
17:36 sri but fixing it would be rather ugly
17:36 sri "(in cleanup) Can't call method "res" on an undefined value at /Users/sri/repo/mojo/lib/Mojo/Transaction/WebSocket.pm line 213 during global destruction."
17:37 sri it would be nicer if we could depend on ${^GLOBAL_PHASE}
17:38 Grinnz_ global destruction... the bane of my existence about a year ago :P
17:39 Grinnz_ i was using CGI::Session and it turns out it doesn't update the session well during global destruction, so you need to flush after any session change to prevent that, i eventually discovered
17:39 denis_boyun joined #mojo
17:39 Grinnz_ which is in the docs, https://metacpan.org/pod/CGI::Session#A-Warning-about-Auto-flushing
17:45 franzkafka mst, you said you like thinkpad keyboards. Are you talking about the laptop keyboards? I'm interested in what thinkpad keyboard you like.
17:46 good_news_everyon joined #mojo
17:46 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/QguKBA
17:46 good_news_everyon mojo/master 10b35cd Sebastian Riedel: wait for the connection
17:46 good_news_everyon left #mojo
17:46 mst franzkafka: they also do standalone ones
17:46 mst the key thing is the built-in trackpoint
17:46 sri didn't they stop making those?
17:46 franzkafka I think an e-cig filled with coffee would be the perfect way to start the morning.
17:48 * sri remembers lenovo getting a lot of hate for changing the keyboards
17:48 franzkafka mst, something like this: http://goo.gl/E0P4JN?
17:48 sri ah, they kept the trackpoint, but switched to macbook style keys
17:48 franzkafka I just got the Corsair K70 and I'm not a huge fan actually.
17:49 franzkafka It's a Cherry MX mechanical keyboard. I should have had some delayed gratification and ordered something online rather than needing it now and buying the first mechanical keyboard I found.
17:49 franzkafka What I really want is this: https://elitekeyboards.com/products.php?sub=pfu_keyboards,hhkbpro2&amp;pid=pdkb400b
17:49 mst franzkafka: right
17:50 franzkafka sri, did you come up with the Velociraptor Perl logo?
17:59 sri yes
17:59 sri kinda
18:00 sri http://blog.kraih.com/post/43196105956/a-logo-for-perl-5
18:01 sri drawing dinosaurs is actually something i did a lot as a child :)
18:01 franzkafka That's awesome. I love the logo, and now there's SotV too :D
18:02 franzkafka what young man didn't spend their days drawing dinosaurs?
18:02 franzkafka Though, you may have spent more days than most, because I cannot draw a dinosaur that well at all
18:03 mikegrb probably an armless young man
18:03 franzkafka That or you're a natural. It is your calling in life.
18:03 cfedde My theory about dinosaurs:
18:03 franzkafka mikegrb, good point
18:04 cfedde they are small at one end.  Get very large in the middle and then are thin again at the other end.
18:07 Grinnz_ mst: i miss my thinkpad's trackpoint... hate touchpads
18:07 Grinnz_ but, i generally keep a tiny external mouse around anyway
18:07 mst I hate mice as well
18:07 Grinnz_ heh
18:07 Grinnz_ i love mice
18:07 Grinnz_ especially small mice
18:08 Grinnz_ well, if they're good precision
18:08 * batman hate the clickpad as well
18:08 batman http://thorsen.pm/tech/linux/2014/09/27/thinkpad-x240.html
18:08 Grinnz_ oh god the clickpads
18:08 Grinnz_ lets take a bad idea and make it worse
18:09 denis_boyun_ joined #mojo
18:09 Grinnz_ though truth be told, when i use a touchpad, i usually do tap-to-click
18:09 Grinnz_ because having separate buttons at all is a pain
18:10 denis_boyun__ joined #mojo
18:11 franzkafka I always disable tap-to-click. If it's enabled, I'm scrolling around, clicking random things, doing crap I don't intend to do.
18:12 Grinnz_ well yes, it does cause me to accidentally click while typing, but i blame the touchpad as a whole for that
18:12 franzkafka Actually, I rarely use the trackpad. I just never got used to it. An external mouse is the way to go for me.
18:12 Grinnz_ one of my roommates in college played an MMO on a touchpad
18:13 Grinnz_ and it wasn't one of the new-age "console-friendly" ones
18:13 franzkafka batman, you look so happy with your cup of coffee. I see a french press in the picture as well. Good.
18:13 batman yeah. it's an old picture...
18:13 franzkafka Grinnz_, that would fill me with anger.
18:13 batman hehehe
18:14 batman i still drink coffee :)
18:14 franzkafka It's a good picture. That coffee has made your day.
18:14 batman indeed
18:14 franzkafka coffee is good. I stopped drinking coffee for 2 years. I don't know what I was thinking.
18:14 franzkafka Beer is good too, but I don't drink that anymore :(
18:14 Grinnz_ franzkafka: yeah we didn't understand why he tortured himself
18:15 franzkafka I live in a state with great beer too.
18:15 Grinnz_ but, he also ate ovaltine powder. so
18:15 franzkafka haha, just ate the powder?
18:15 Grinnz_ yeah...
18:15 franzkafka I wonder what he would have thought had someone introduced him to ovaltine + milk?
18:15 franzkafka You may have changed his life.
18:16 franzkafka batman, I also find the picture you have chosen for betsy rather interesting.
18:16 batman do you think it gets the point ahead?
18:17 franzkafka oh yes. You've tracked the bet and made absolutely sure they stand on that cliff butt naked.
18:18 * Grinnz_ thinks coffee is quite gross
18:18 franzkafka Had you not tracked that bet, this moment may never have happened :D
18:18 batman franzkafka ;)
18:18 batman exactly. hehe
18:18 franzkafka man, I hate work
18:18 franzkafka see ya all later
18:18 franzkafka :D
18:19 franzkafka or, I guess talk to ya all later is more apt.
18:19 Grinnz_ irc y'all later?
18:20 franzkafka Grinnz_, I like that. IYL!
18:21 franzkafka :( IRCYL I guess
18:32 neyasov___ joined #mojo
18:37 zackiv31 joined #mojo
18:43 mgrimes joined #mojo
18:53 ignacio_ joined #mojo
19:04 dod joined #mojo
19:09 akhasanov joined #mojo
19:09 sri interesting that nokogiri uses next_sibling exactly the way we do
19:09 sri except that they have next_element instead of next
19:09 [0xAF] joined #mojo
19:16 [0xAF] hi guys, i want to make a reusable block between templates, is there an easy way to achieve that ?
19:17 Grinnz_ i dont know mojo's templates, but i would guess an include function?
19:17 [0xAF] as i'm reading the docs it seems i can have block within the template itself
19:18 [0xAF] yeah, i was thinking of that... perhaps making an include template with no real html in it, only block to be reused later?
19:18 [0xAF] but i dared to ask here, since there could be more mainstream way of doing it...
19:19 [0xAF] another way would be a helper function, which can be used in any template, but this doesnt seem the right way, since i have to code the html in the perl modules, instead of the templates
19:19 Grinnz_ yeah thats not how you want to go about it :P
19:20 Grinnz_ in other template systems its generally through includes
19:20 [0xAF] yeah, i've used TT before... so i guess it should be this way
19:21 [0xAF] i'll stick around whild trying to make it with includes, perhaps someone can share another way.
19:21 [0xAF] thanks Grinnz_ :)
19:21 Eke- joined #mojo
19:25 jberger [0xAF]: include is the right thing
19:25 jberger what is in your template block that isn't largely HTML?
19:26 jberger I worry that you have too much logic in your view
19:26 jberger perhaps you should consider a helper
19:26 [0xAF] jberger: thanks, so include it shall be ;)
19:26 disputin joined #mojo
19:26 [0xAF] jberger: in this case it is a "product box", but it's reused almost in every template... so i want to have an reusable block for it ;)
19:27 [0xAF] not much logic inside ... just a little bit
19:27 disputin1 joined #mojo
19:29 jberger that sounds like an include then
19:29 [0xAF] thanks guys, i was making sure that i'm not going in the wrong way. the includes were my first idea, but since Mojo has many ways of achieving some stuff i was wondering if there is something else... (and given that i'm not so familiar with mojo...)
19:29 Grinnz_ theres always other ways, but this is what template includes are for :)
19:30 [0xAF] yeah, agreed ;)
19:32 [0xAF] so far i'm very impressed by the power of Mojo + DBIC... ultimate team i've seen so far ... not that I know many other frameworks, but so far this is much easier than catalyst
19:33 neyasov___ joined #mojo
19:35 marty joined #mojo
19:39 [0xAF] btw, since i'm here, what would be the way to throw error/warnings from template (the logic inside template)
19:40 [0xAF] like a warning for not supplied argument to the block... in case i recall the block from somewhere, but the arguments are not enough/correct ?
19:41 Grinnz_ i would guess regular die or warn?
19:41 [0xAF] hm... now i feel a bit stupid of not thinking of this ...
19:42 Grinnz_ heh
19:42 [0xAF] perhaps i should see mojo more like a regular perl than a specific interpreter inside perl...
19:43 Grinnz_ well, it's the mojo template system, specifically.. https://metacpan.org/pod/Mojo::Template
19:43 Grinnz_ personally i have my own handler that uses template toolkit so i dont know much about it, except that it's embedded perl
19:43 denis_boyun joined #mojo
19:44 [0xAF] yeah ... silly me ...
19:45 [0xAF] i should think twice before embarrassing  myself again ;)
19:46 denis_boyun_ joined #mojo
19:47 Grinnz_ anyway... personally you should probably try to have logic that can throw exceptions outside the templates if possible...
19:47 Grinnz_ by the time you get to the template, it should know the page is good to render
19:48 [0xAF] i want this just as safe case ...
19:48 [0xAF] in case i call the block with not fully filled hash with the required information for the block ...
19:48 [0xAF] in case the DB returns something null or something like that...
19:49 [0xAF] it shouldn't happen in production IMO
19:49 Grinnz_ well you should be checking for the DB to return null :P
19:49 [0xAF] but then i should have a wrapper functions for my resultsets instead using them directly from DBIC
19:50 [0xAF] or perhaps I dont know how to handle transparantly data from DBIC
19:50 Grinnz_ dunno... havent used DBIC in a while
19:50 [0xAF] anyway, another safe-case mechanism wont hurt
19:54 basiliscos joined #mojo
19:55 mib_qnd75g joined #mojo
19:57 denis_boyun joined #mojo
19:59 jamesaxl joined #mojo
20:03 denis_boyun_ joined #mojo
20:05 sri hmm, another fun hpricot idea
20:06 sri $dom->css_path
20:06 sri generates a unique css selector for the current element
20:06 Ptolemarch joined #mojo
20:06 sri foo > bar > baz:nth-child(23)
20:26 [0xAF] left #mojo
20:32 zz_[0xAF] joined #mojo
20:33 zz_[0xAF] it seems my problem is not going to solve with the includes ...
20:33 [0xAF] when i include another template, it does not include it's reusable template blocks (RTB)
20:34 ignacio_ joined #mojo
20:35 [0xAF] i.e. in blocks.html.ep i have a block called $block... then in my frontpage.html.ep i <%= include 'blocks' %> and try to call <%= $block->(params); %>, but $block is undefined in frontpage.html.ep
20:35 [0xAF] the %include helper does not include the blocks... only the pure html :(
20:35 [0xAF] so i guess i should go for helpers :(
20:35 [0xAF] btw, https://groups.google.com/forum/#!topic/mojolicious/UT5IpUNBxmQ i found the same problem in the ML
20:39 [0xAF] jberger: have you used the RTB via include into another template?
20:41 [0xAF] ohh, i just realized that i didn't explained myself correctly in first place ... i'm going to make a library of RTB in one template... which seems undoable ...
20:41 jberger [0xAF]: I understand that, but the include is basically a template block of its own
20:42 [0xAF] but perhaps if I put every RTB in separate template and include it later it would work ... though it wont be RTB in that case, just a regular template which is included
20:42 [0xAF] jberger: yeah... just realize my mistake while writing all this here...
20:42 [0xAF] s/mistake/misunderstanding/
20:43 jberger if you want to share functionality (rather than sharing template bits) those should be helpers
20:43 [0xAF] jberger: so any idea if there is a way to have one RTB library, or I should make every block in separate includable template ?
20:43 jberger [0xAF]: you are too focused on RTB
20:43 [0xAF] jberger: i want to escape from puting HTML in helpers
20:44 jberger the helpers can have templates!
20:44 [0xAF] i guess so ... that's my mistake in first place ...
20:44 [0xAF] now i realize, what you're telling me...
20:44 [0xAF] jberger: yeah, that too ... but rather i should do all my RTB in separate includable templates i guess...
20:45 jberger https://github.com/jberger/Mojolicious-Plugin-Humane/blob/master/lib/Mojolicious/Plugin/Humane.pm#L116-L1260xAF]:
20:45 jberger bblah
20:45 jberger copypasta fail
20:45 jberger [0xAF]: https://github.com/jberger/Mojolicious-Plugin-Humane/blob/master/lib/Mojolicious/Plugin/Humane.pm#L116-L126
20:46 jberger I think that without seeing some examples I can't be of any more help
20:47 [0xAF] jberger: i got the idea... finally ;)
20:48 [0xAF] jberger: you're right, i was too focused on RTB and got the wrong direction in first place ... i didnt got the right idea when i was thinking of RTB...
20:48 [0xAF] now i have to decide if i want helper with template or i want separate template to be included later (sort of RTB)
20:49 jberger when you include a template, it can get stash values too
20:49 jberger which get localized
20:49 jberger include 'mytemplate', some => value
20:49 [0xAF] that's nice... i haven't thunk of...
20:50 [0xAF] i can use these for passing my params to the so called my-way-of-RTB
20:50 jberger and of course it inherits the existing stash (other than what you have localized)
20:50 jberger exactly
20:51 [0xAF] yeah, i see the idea now ...
20:51 [0xAF] sorry for loosing your time on this ... i was stupid to not see it in first place...
20:51 [0xAF] thanks for the help ;)
20:51 jberger [0xAF]: I had a tough time grokking that at first
20:52 jberger I specifically remember trying to RTB too many things
20:52 [0xAF] RTB is cool, but would be cooler if you can reuse them in another templates too... would be easier for newbies like me ... and it's kind a first thing to try
20:52 good_news_everyon joined #mojo
20:52 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/xbfCQw
20:52 good_news_everyon mojo/master 2ae98d3 Sebastian Riedel: mention what template blocks are most commonly used for
20:52 good_news_everyon left #mojo
20:53 jberger truth be told I rarely use them now
20:53 [0xAF] i guess they are not so usable only in one template ...
20:53 jberger [0xAF]: under the hood, they become lexical sub refs
20:54 jberger does that make it more clear why they are not shared?
20:54 sri you're not the first to get it wrong, i hope that addition clarifies it
20:54 [0xAF] now when i remember my experience with TT, i used BLOCKs, but only in one template... perhaps once or twice ... not so useful this way
20:54 [0xAF] sri: yeah, now i got it right eventually ;)
20:54 [0xAF] jberger: i realized that while talking with you in last 2 mins ;)
20:57 [0xAF] so glad there is IRC and people like you guys ... not that i wouldn't make my way through, but it feels warmer when someone explains your mistakes right away...
20:57 jberger [0xAF]: glad to help, but don't abuse it either :-)
20:58 [0xAF] thanks for all your effort on the project and on me and my stupidity lately ;)
20:58 [0xAF] jberger: of course not ;)
20:59 [0xAF] sri: and thanks for updating the docs ;)
21:10 mojobot17705 joined #mojo
21:14 irc8055 joined #mojo
21:19 irc8055 joined #mojo
21:22 tttkkk101 joined #mojo
21:23 tttkkk101_ joined #mojo
21:27 [0xAF] left #mojo
21:27 tttkkk101 joined #mojo
21:29 mst sri: specifically for *decoding*, is there any noticeable difference in the results between JSON::PP and Mojo except for booleans?
21:29 mst (a pointer to where I should've looked that up would also be fine, of course :)
21:31 Grinnz_ nothing i've seen
21:31 Adura joined #mojo
21:32 Grinnz_ unless JSON::PP's tag stuff is on of course :P
21:32 Grinnz_ or is that JSON::XS specific?
21:32 mst tag stuff?
21:33 Grinnz_ "allow_tags" -- strings may be decoded into objects
21:34 Grinnz_ oh, nevermind... tagged "objects" are apparently not standard JSON
21:34 Grinnz_ never used that...
21:38 Grinnz_ also, i should probably set allow_unknown in Mojo::JSON::MaybeXS because apparently filehandles are treated separately from blessed objects, and Mojo::JSON stringifies those too
21:39 Grinnz_ doesn't open just give you an IO::Handle now though?
21:39 mst it gives you a glob, with the fh slot set, which incidentally behaves as an IO::Handle
21:39 Grinnz_ ["GLOB(0x99fd78)"]
21:39 Grinnz_ yeah guess thats not a blessed object heh
21:39 mst http://trout.me.uk/tys.txt
21:40 Grinnz_ :P
21:41 Grinnz_ encountered GLOB(0x1743d78), but JSON can only represent references to arrays or hashes
21:41 Grinnz_ from JSON::PP
21:42 Grinnz_ would this apply to anything other than filehandles?
21:42 Grinnz_ thats the only example given in JSON::PP docs
21:46 tttkkk101 joined #mojo
21:50 sri mst: this module actually has a list with differences https://metacpan.org/pod/Mojo::JSON::MaybeXS
21:50 dex4er joined #mojo
21:50 mst sri: ta
21:50 sri i think it was pretty complete and even listen easy to overlook stuff
21:51 sri Cpanel::JSON::XS behaves a little different from JSON::PP too though
21:52 bwf joined #mojo
21:52 Grinnz_ (this is the doc i'm updating as we speak ;)
21:53 Grinnz_ but yeah, still no differences decoding i can see
21:57 sri jberger: some folks even dare to extend Perl::Tidy :o https://metacpan.org/release/Perl-Tidy-Sweetened
22:02 jberger people are still using MX::D? :o
22:02 mst http://shadow.cat/blog/matt-s-trout/mstpan-7/ # JSON
22:04 jberger mst: btw advent planet doesn't understand your no weekend policy
22:04 mst what's advent planet?
22:04 jberger http://www.lenjaffe.com/AdventPlanet/2014/index.html
22:05 jberger not sure if you care
22:05 jberger fine if you don't
22:05 dex4er hi, i programming a lot of mock http servers and a lot of clients which tests some other servers and i needed to write some non-default asset class which completely ignores body of http message
22:05 dex4er it is something like "lwp-request -d" option
22:05 dex4er https://gist.github.com/dex4er/757a8ec653d01cb5f192
22:06 mst jberger: len emailed me to thank me for writing it
22:06 mst I'll email him back asking about that
22:06 sri mst++ # the whole series has been good so far
22:06 dex4er would it be possible if Mojo::Asset::Null would be in standard Mojo?
22:07 jberger mst: I enjoy them too, I wouldn't want your readership to go down because people assume you gave up
22:07 sri Mojo::JSON happens to be a few times faster than JSON::PP, but i guess that's not as important
22:08 sri (last benchmark has been a few years ago... i don't even remember the numbers)
22:08 mst jberger: OTOH it'll look totally right afterwards
22:08 mst so dunno
22:08 mst sri: I kinda ssumed it would be; actually, my decoding question is because one of my current projects is hitting JSON::PP as a bottleneck but I still want to fatpack it
22:08 mst so either Mojo::JSON or JSON::Tiny is going to get trialled
22:09 sri i've been wondering for some time if merlyn's single regex approach could be faster
22:09 sri never got around to trying though
22:10 Grinnz_ by the way, the one difference i have listed between Cpanel::JSON::XS and the other modules may be going away soon: https://github.com/rurban/Cpanel-JSON-XS/issues/29
22:10 Grinnz_ thanks niczero for putting that in
22:14 dex4er $ perl mojo-ua-benchmark.pl -v
22:14 dex4er 544 Mb/s with Mojo::Asset::File
22:14 dex4er 843 Mb/s with Mojo::Asset::Null
22:17 dex4er RAM: 30MB w. Null, 800MB w. File  :)
22:17 Ptolemarch joined #mojo
22:18 sri dex4er: i doubt it, that doesn't seem like a very common use case
22:19 mst dex4er: seems like a useful thing to exist on CPAN, but I don't think it makes the bar for core - mission creep bad.
22:19 * mst throws a chair at systemd
22:20 dex4er ok, I could upload it to CPAN as separate package
22:20 dex4er after adding some docs
22:20 dex4er tests, etc.
22:21 depesz joined #mojo
22:21 depesz hi. is there any simple way to get application root directory?
22:21 alnewkirk joined #mojo
22:22 depesz it seems that mojolicious detects it while creating $app (so it pushes default paths to publci and templates)
22:22 depesz but I can't figure out if it's available anywhere for user
22:22 dex4er $ENV{MOJO_HOME} ?
22:23 depesz I don't see MOJO_HOME in %ENV :(
22:23 depesz tried: $app->log->debug( "ENV " . $app->dumper( \%ENV ) );
22:23 sri app->home
22:24 dex4er yup, MOJO_HOME can change it, AFAIK
22:24 depesz sri: thanks. is it new? if not -I can't see it in perldoc Mojolicious, is it documented somewhere else?
22:24 sri http://mojolicio.us/perldoc/Mojolicious#METHODS
22:24 depesz i don't see it there :(
22:24 sri oops
22:24 depesz but it works.
22:24 sri actually http://mojolicio.us/perldoc/Mojolicious#ATTRIBUTES
22:25 sri read that
22:25 sri first line
22:25 purl it has been said that first line is query = query.execution_options(stream_results=True) and it's the one they wanted to remove
22:25 depesz sri: ah, so I should perldoc Mojo...
22:25 jberger purl: forget first line
22:25 purl jberger: I forgot first line
22:25 depesz thanks a lot
22:26 sri btw. i've benchmarked Mojo::JSON against merlyn's regex :)
22:26 Grinnz_ mst: actually there is one potential difference in decoding, if allow_nonref is disabled then JSON::PP et al will blow up when trying to decode a bare value (Mojo::JSON always allows these)
22:26 mst Grinnz_: that doesn't stop me replacing JSON::PP with Mojo::JSON
22:26 mst Grinnz_: so I care not :)
22:26 sri using the example from the JSON spec, Mojo::JSON: 9832.84/s, merlyn regex: 6944.44/s
22:27 Grinnz_ which as a corollary, is apparently a part of the new JSON spec (bare values)
22:27 asarch joined #mojo
22:27 Grinnz_ whcih i see the Mojo::JSON docs explicitly mention :)
22:27 Grinnz_ http://tools.ietf.org/html/rfc7159
22:28 sri it was a huge pita when they changed that in the new rfc
22:29 sri mlehmann almost god a seizure i imagine, when he noticed that the new rfc broke his streaming json parser
22:29 sri s/god/got/
22:30 Grinnz_ hahaha
22:30 Grinnz_ what's the syntax for an external link in pod?
22:31 sri L<Foo|http://foo>
22:31 Grinnz_ ty
22:32 neyasov___ joined #mojo
22:33 dex4er my $port = Mojo::IOLoop->acceptor($id)->handle->sockport
22:33 dex4er oh god why?
22:33 purl god why is it so painful to work with hashes in java? please god kill me now
22:35 mattastrophe joined #mojo
22:35 Grinnz_ lol
22:38 jberger purl: botsnack
22:38 purl :)
22:39 sri actually, scratch my earlier benchmark for the json regex
22:39 sri i didn't realize it bailed out on a newline
22:40 sri (a valid newline)
22:40 sri anyway... with minified json that it can handle... we have Mojo::JSON: 9832.84/s and json regex: 1663.89/s
22:41 Grinnz_ heh
22:41 absolut_todd joined #mojo
22:43 sri for completeness sake, JSON::PP: 3095.91/s
22:43 sri (spec example with newlines removed)
22:43 sri i guess calling out to perl from within the regex engine is still pretty damn expensive
22:45 akhasanov joined #mojo
22:48 sri dex4er: why what?
22:51 woz joined #mojo
22:53 sri that sure is a nice landing page for a package archive https://www.npmjs.com/
22:53 dex4er why i have to check via ->handle method to get the port number of the server?
22:54 sri dex4er: make a better proposal
22:54 sri the api is pretty new, so not polished
22:55 dex4er it was $server->generate_port;
22:55 dex4er so perhaps $server->generated_port; ?
22:55 sri we don't generate ports anymore
22:55 dex4er OS generates port
22:55 sri the port may also have been specified
22:56 dex4er $server->port ?
22:56 sri what if we want to support unix domain sockets?
22:57 dex4er undef for unix socket?
22:57 dex4er plack servers had the same problem
22:57 dex4er i need to check it out
22:57 sri i don't know, that's the stuff that needs to be cleared up before we can take a proposal serious
22:57 jb360 joined #mojo
23:00 dex4er Starman: SERVER_PORT     => $self->{server}->{sockport} || 0,
23:00 dex4er Starlet the same
23:00 sri that's good information
23:02 dex4er $server->proto == 'unix' for unix sockets
23:03 dex4er Starman too
23:04 dex4er ssl for SSL and tcp as default
23:06 dex4er Mojo::Server might have own $server->proto: http, https, websocket, etc.
23:10 disputin joined #mojo
23:14 good_news_everyon joined #mojo
23:14 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/q4IS6Q
23:14 good_news_everyon mojo/master f9e6638 Sebastian Riedel: added port method to Mojo::IOLoop::Server
23:14 good_news_everyon left #mojo
23:17 good_news_everyon joined #mojo
23:17 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/lQid2A
23:17 good_news_everyon mojo/master 5a763de Sebastian Riedel: no need to mention tests
23:17 good_news_everyon left #mojo
23:17 Grinnz_ mst: you should have an index of these mstpans and forward/back links :P
23:18 sri dex4er++ # and done
23:19 Grinnz_ mst: greatly enjoyed the XML one
23:24 dex4er thanks :)
23:28 marty joined #mojo
23:30 jberger oh hey, I hadnt' seen that marcusr's post is up!
23:30 jberger http://perladvent.org/2014/2014-12-09.html
23:30 * jberger reads
23:31 sri ohoh, there's a typo
23:31 sri foreach my $row ($res->hashes) {
23:31 sri needs to be $res->hashes->each
23:33 sri this one looks a little odd too
23:33 sri ->map(sub { [ $a—>{0} + $b->[0] ] })
23:33 sri or am i missing something?
23:34 sri i think that was supposed to be a reduce
23:35 neyasov___ joined #mojo
23:35 jberger marcusr: you might want to mention transactional DDL, but perhaps that's out of scope
23:37 neyasov___ joined #mojo
23:37 neyasov___ joined #mojo
23:48 disputin joined #mojo
23:55 disputin joined #mojo

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