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

IRC log for #mojo, 2014-11-07

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

All times shown according to UTC.

Time Nick Message
00:02 mattastrophe joined #mojo
00:03 good_news_everyon joined #mojo
00:03 good_news_everyon [mojo] kraih tagged v5.58 at 9698f33: http://git.io/wQBFXQ
00:03 good_news_everyon left #mojo
00:05 good_news_everyon joined #mojo
00:05 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/NRyXsw
00:05 good_news_everyon mojo/master 9a407b7 Sebastian Riedel: bump version
00:05 good_news_everyon left #mojo
00:06 neyasov_ joined #mojo
00:18 rawler joined #mojo
00:24 hoppie joined #mojo
00:28 hoppie One day will use flow_demo.pl as a starting point to use many cores on the box with Mojolicious: https://gist.github.com/marioroy/37817977b4e101f3e880
00:30 hoppie Sereal 0, fast 0:   4.703s      # Serialization via Storable
00:30 hoppie Sereal 1, fast 0:   3.926s      # Serialization via Sereal
00:30 hoppie Sereal 1, fast 1:   2.092s      # Enable fast optimization; crazy :)
00:31 hoppie Simulation for 2 million rows. That is it as far as overhead goes. 1 million per second.
00:37 disputin joined #mojo
00:56 bwf joined #mojo
01:05 laouji joined #mojo
01:07 neyasov_ joined #mojo
01:19 disputin joined #mojo
01:43 chickadee joined #mojo
01:45 chickadee In a table > tr each loop, given one child looks like this '<td><a href="link">text</a></td>, how to extract the link and text?
01:49 chickadee I was trying a $_->find('td a')->pluck('text'); in the loop, but that returns nothing.
01:52 chickadee I see, is pluck deprecated?
01:53 sri https://github.com/kraih/mojo/blob/master/Changes#L10
01:53 chickadee Alright, well that's a good start then.
01:54 chickadee I take it backwards compatibility wasn't really a concern on this one?
01:54 chickadee I'm going to have to stop updating Mojolicious after I get things working.
01:55 sri if backwards compatibility wasn't a concern it would have been removed instead of deprecated
01:55 chickadee Well, this did work, and it no longer does after an upgrade.
01:55 chickadee Oh well, do an upgrade and figure out what breaks.
01:55 sri what did?
01:56 sri please open an issue if something broke
01:56 sri http://mojolicio.us/perldoc/Mojolicious/Guides/FAQ#What-about-backwards-compatibility
01:56 chickadee I will, just as soon as I can figure out exactly what part of it broke. A test with Mojo::DOM shows that $_->find('td a')->pluck('text'); still works, so some other aspect of the script broke.
01:58 sri then maybe don't start blaming before you've figured it out
01:58 chickadee Well, the script worked up until yesterday when someone update Mojolicious.
01:59 chickadee It's pretty safe saying it is Mojolicious. It's just a matter of figuring out what's been changed that caused it.
01:59 sri no, it didn't work before
01:59 chickadee Yes, it has worked for months, doing what it was expected to do.
01:59 sri nope
02:00 chickadee You're a fucking idiot.
02:00 sri i was making a point... that i can throw around claims like that too
02:00 chickadee It's not a surprise you're so loathed in this community.
02:00 chickadee Later
02:00 sri but i won't allow abusive behavior
02:01 sri i hate people
02:01 bpmedley It’s unfortunate that people can’t be plucked away for good.
02:02 franzkafka Hey, too bad s/he left, I have a perfect example using Mojo::DOM with a table.
02:03 franzkafka bpmedley, is convos your creation?
02:03 franzkafka Who exactly is Nordaaker?
02:03 bpmedley I wish
02:03 tianon it'd be hilarious if the problem was really that someone added a <tbody> or something, so the "table > tr" didn't match properly anymore
02:04 bpmedley I think it’s batman
02:04 sri tianon: almost certainly is the problem
02:04 tianon when in doubt, blame the CSS selector specificity :)
02:04 franzkafka Actually, even if a tbody was in there, wouldn't a table > tr match still?
02:05 tianon nope
02:05 tianon > means direct descendent
02:05 sri mind the combinator
02:05 franzkafka ohh right, a 'table tr' would work though.
02:05 tianon but would also match other trs in nested tables
02:05 tianon but who would nest tables
02:05 tianon run
02:05 franzkafka haha
02:06 sri hahahaha.... and then the complaints started coming in and i had to handle nested tables correctly in Mojo::DOM::HTML... :(
02:06 franzkafka I have been working with Mojo::UserAgent / Mojo::DOM a ton the past few weeks and it has made life so much simpler. I love it.
02:06 franzkafka So there's that for you sri
02:07 sri it gets really funny with the special cases
02:07 sri self closing elements in nested tables
02:07 sri optional end tags
02:08 sri all special cases ;p https://github.com/kraih/mojo/blob/master/lib/Mojo/DOM/HTML.pm#L50-L102
02:09 tianon yeah, it's insane how much handling has to go into a proper HTML parser
02:09 tianon but Mojo::DOM really is awesome
02:14 * sri is glad is has gotten so clean over the years
02:16 neyasov_ joined #mojo
02:26 Kripton_ joined #mojo
02:27 KCL_ joined #mojo
02:27 sri wait...what...i...don't...wat...? https://fosdem.org/2015/schedule/event/get_ready_to_party/
02:30 alnewkirk joined #mojo
02:30 bpmedley Is that for real?
02:57 sri :D https://github.com/kraih/mojo/issues/704
03:08 firnsy \o/
03:17 sri the one-liner to install rakudo these days is this btw.
03:17 sri git clone git://github.com/tadzik/rakudobrew.git ~/.rakudobrew && export PATH=$HOME/.rakudobrew/bin:$PATH && rakudobrew build moar
03:17 neyasov_ joined #mojo
03:38 jzawodn ooh
03:48 hahainternet hey sri
03:48 hahainternet i guess this means you're cool with p6?
03:49 hahainternet i'm super excited to see an implementation of Mojo in it
03:53 jberger Christmas is next summer?!
03:53 jberger I'm going to take all the credit there ;-P
03:54 jberger I asked jnthn if it could be and otherwise please give us our version number back
03:54 jberger actually I thought it ended up being a good conversation
03:55 jberger but hey, there you go
03:56 hahainternet jberger: i came across https://github.com/masak/ipso and it blows my freaking mind
03:56 hahainternet shame i can barely parse the grammar
03:57 preaction lines 3-9 in lib/Ipso.pm? that's the grammar
03:58 hahainternet haha yeah and when i learn what %% is in p6
03:58 hahainternet then i might know something
04:02 sri i might have gotten a little too excited there
04:03 hahainternet i'm mostly interested in all the little things you'll find that are broken if you do put any time into trying to port it
04:04 disputin joined #mojo
04:05 * sri would love to actually try porting, but realistically that's a lot of resources that might be better spent on perl5 mojo
04:08 hahainternet i can't really say anything, i've not really contributed to Mojo in any way, i'm just an enthusiastic user
04:08 jberger my only request is that p5mojo not be abandoned one the p6mojo would arrive
04:08 hahainternet indeed
04:09 * sri closes the perl6 port issue again
04:10 hahainternet aww it even emailed me
04:10 hahainternet you're such a party pooper ;)
04:11 sri :P
04:11 hahainternet there are still things i want perl6 for though, which really is a criticism of all other languages
04:12 sri if anyone feels like sponsoring a perl6 port, get in touch! but i gotta prioritize the perl5 version
04:12 hahainternet like i've been writing some python to run a few gstreamer threads in the background and a web framework frontend
04:12 hahainternet and all i can say is ugh
04:12 sri especially with http/2 next year
04:12 hahainternet for the most part i can just hook AE in with Mojo and do anything I want, but threading isn't solved in p5 and mojo doesn't exist in p6
04:13 jberger isn't threading worse in python?
04:13 * jberger doesn't really understand GIL
04:13 hahainternet well i don't require parallelism
04:14 hahainternet just the illusion of concurrency
04:14 jzawodn wat.  that ipso thing is lisp.  or is perl6 actually lisp?
04:14 jzawodn oh, I get it.
04:14 * jzawodn reads the page better
04:14 jberger it's a p6 lisp interpreter, no?
04:14 jzawodn nod
04:14 hahainternet pretty much, although it uses the same mechanisms as p6 does itself
04:15 hahainternet (as far as i understand)
04:15 sri GIL protects internal data structures from race conditions basically
04:15 * jzawodn gets to learn about CORS this evening...
04:15 hahainternet regardless, i don't even think any of my Perls are built with threads, i doubt it
04:15 hahainternet and i'll probably just use Go, which is quite lovely
04:15 hahainternet but it's no Perl
04:16 sri bad part: it can block threads from doing stuff parallel, good part: a lot of stuff can actually happen parallel, like i/o
04:17 hahainternet python in general is just kinda frustrating
04:17 hahainternet they've solved basically none of the issues they needed to solve
04:17 hahainternet it's not particularly fast, it's not particularly elegant
04:17 hahainternet it's just another dynamic language
04:17 hahainternet also u"lol what are you kidding me"
04:17 jberger hahainternet: well said
04:18 hahainternet i've been writing django, i'm seriously holding back
04:18 hahainternet not that i want to slander anyone, because the guy who writes it is ernest, but django-rest-framework is about the most ridiculous thing i've ever seen
04:18 neyasov_ joined #mojo
04:18 jberger hahainternet: try tornado, it seems to be the most mojo like from what I read
04:18 hahainternet its complexity and obscurity has probably added a good 1/3rd to the dev costs of latest project
04:19 hahainternet jberger: i'm abandoning python almost entirely
04:19 hahainternet Flask uses some utterly ridiculous global variable nonsense
04:19 jberger Well that's a better option
04:19 hahainternet Cherrypy is too busy trying to be cool to eb good
04:19 hahainternet Perl for AE and Mojo
04:19 hahainternet Go for fast
04:19 hahainternet a fantastic combination
04:19 jberger hahainternet++
04:19 hahainternet now if only we could use nativecall in p5 my life would be complete
04:20 jberger and there are some parallel options for Mojo
04:20 hahainternet hmm? hypnotoad or something else?
04:20 jberger batman and I each have forking modules
04:20 jberger each for slightly different purposes
04:20 hahainternet yeah forking and job serving is a good strategy
04:20 hahainternet you lose a tiny amount of efficiency but gain a much simplified and more resilient model
04:21 hahainternet even Go with its ridiculously tiny featureset has issues with concurrent access and requires a mutex 'class'
04:21 jberger https://metacpan.org/pod/distribution/Mojo-IOLoop-ForkCall/README.pod
04:21 hahainternet my problem is that i need to do this in AE
04:21 * tempire loves sri
04:21 hahainternet and AE::Subprocess::RPC or whatever the heck it is
04:22 hahainternet is frustratingly difficult to dive into
04:22 hahainternet i haven't had long to look into it anyway
04:22 jberger https://metacpan.org/pod/Mojo::IOLoop::ReadWriteFork
04:22 hahainternet i know what i want to do is possible, but the descriptions are frustrating
04:22 hahainternet oh interesting jberger
04:22 hahainternet a friend was asking me about something to do with the latter the other day
04:22 hahainternet i shall link
04:22 bwf_ joined #mojo
04:23 jberger they both do essentially the same thing, the difference is in how much you need to communicate with the child
04:23 mtj- joined #mojo
04:23 jberger mine is a very simple fork and get a response when done
04:24 jzawodn is this CORS advice sound? https://groups.google.com/forum/#!topic/mojolicious/n4wcdMp3a18
04:24 jberger batman is rw as the name implies
04:24 tempire diving into a perl6 port interests me quite a bit.
04:24 hahainternet have you read jnthn's talk on reactive programming in p6 jberger?
04:25 hahainternet http://www.jnthn.net/papers/2014-nlpw-reactive.pdf
04:25 hahainternet believe this is correct
04:25 sri he gave a similar talk at mojoconf
04:25 jberger no, but I was at his talk of the same name at mojoconf
04:25 jberger similar name?
04:26 jberger jzawodn: resorting to hooks is terrifying imo
04:26 hahainternet i found it really intriguing, the ease at which a series of complex issues was handled
04:27 jzawodn jberger: any way to do that in a template?
04:27 jberger I do use an event driven db at work though and ... let's just say that that isn't always all is cracked up to be
04:28 jberger jzawodn: the controller can set a header of course
04:28 sri supply and promise are decent primitives for a mojo6 port
04:28 jberger I don't know anything about CORS
04:28 jzawodn jberger: I'm just learning myself :-)
04:28 jberger I just know that hooks are usually too much power (read rope)
04:29 davido__ joined #mojo
04:29 hahainternet sri: it's the ability to treat them like you do channels in Go that's of interest to me
04:29 hahainternet idk if you've seen Go, i assume so
04:29 jzawodn jberger: noted
04:30 sri yes, i'm aware of parallelism in Go
04:30 hahainternet being able to pass around event driven handles is just endlessly useful
04:30 jberger hahainternet: I've tried, the class model is too hard for me to grok on the rare occasion that I try
04:30 hahainternet jberger: you've tried what sorry, Go?
04:31 jberger yeah
04:31 hahainternet cause i think even saying the words 'class model' in front of Go programmers is enough to make them shiver
04:31 hahainternet it has structs and basic types
04:31 hahainternet and they can implement interfaces
04:31 hahainternet end of class model :p
04:31 ryanc` joined #mojo
04:32 jberger I just never have understood how you the programmer can know if you have implemented the interface!
04:32 tempire jzawodn: It's ok, but it's usually brute force. Use a condition.
04:32 jberger you have to look, it's very manual
04:32 sri at least you have static analysis
04:33 laouji joined #mojo
04:33 hahainternet jberger: yes that is the point though, so interfaces are emergent rather than declarative (although you obviously do declare them once)
04:33 tempire jzawodn: this is the best CORS article, btdubs: http://www.html5rocks.com/en/tutorials/cors/
04:33 hahainternet so for example the typical Reader / Writer interfaces
04:33 jzawodn ah, cool.  I went mostly off the wikipedia page
04:33 hahainternet it would be really annoying and counterproductive to have to add 'implements Reader' every time you actually do
04:33 hahainternet but because they are implicitly satisfied, you can define your own willy-nilly
04:33 hahainternet and they often emerge just by design
04:34 hahainternet you realise 'oh this group of structs has a similar set of methods'
04:34 hahainternet and you use interfaces as choke points where everything conforms
04:34 hahainternet this helps stop sprawling interconnected codebases (which you can barely do with Go at the best of times anyway)
04:35 hahainternet i love the opposite philosophies though with Go / Perl
04:35 hahainternet they complement each other exceedingly well
04:35 jberger hahainternet: I'm sure I would develop a knack for it, but I so rarely try that I probably just get to the precipice and then get frustrated
04:36 kmx joined #mojo
04:38 hahainternet jberger: well Go has its place where Perl finds it hard to compete
04:38 hahainternet so it's a question of need more than want
04:38 sri Go will have to compete with Rust
04:38 hahainternet nah, have you seen Rust code?
04:38 jberger which is why I've tried a number of times
04:38 hahainternet it's more linty than Perl and Lisp put together
04:39 hahainternet Rust is a C++ replacement, Go is barely a C replacement
04:39 sri ruby people are all over rust
04:39 sri python people seem to like go ;p
04:39 hahainternet Rust is awesome
04:39 hahainternet ugly, but awesome
04:39 hahainternet it's also quite a long way off being finished and really usable
04:39 hahainternet Go is awesome, and fairly pretty, and solves a lot of arguments, and works at scale right now
04:39 hahainternet they're very different imo
04:40 sri i for one still believe javascript is the end all language
04:40 jzawodn I've found Go to be surprisingly approachable in my limited experience.
04:40 hahainternet jberger: next time you give it a try, shout at me btw
04:40 mtj- joined #mojo
04:40 hahainternet jzawodn: i love how you basically don't have a choice
04:40 hahainternet it's what happens when you take python's mantra seriously
04:41 sri i found go quite boring
04:41 hahainternet sri: imo that is about the highest praise you can give it
04:41 sri go makes programming feel like work :o
04:41 hahainternet well, i disagree there
04:42 hahainternet just a matter of perspective i guess, you know Perl better than i know procrastination
04:43 hahainternet i'm not particularly interested in a language that feels like i'm conquering amazing challenges in a single line, already have Perl for that
04:44 basic6_ joined #mojo
04:44 hahainternet kinda drifted off topic though
04:44 hahainternet port mojo to p6 after http2 :)
04:45 hahainternet ok time for sleep, if i do have spare money in a few months i'll throw it in
04:45 hahainternet Mojo is seriously the only web framework i recommend offhand at any point
04:46 jberger hahainternet: nn
04:46 jberger me too actually
04:46 jberger nite all
04:46 firnsy o/
04:46 hahainternet o7
04:53 Eke- joined #mojo
04:59 * sri still hasn't finished porting minion to postgres
05:07 sri too bad minion got sidelined when i had to give up on mongodb
05:07 sri mongodb was the biggest mistake i've made in a long time :S
05:10 firnsy sri++ # you're still awesome
05:10 irq joined #mojo
05:11 saki thank you for telling us about the landmines the rest of us need to avoid
05:11 sri http://www.youtube.com/watch?v=StTqXEQ2l-Y
05:11 sri \o\
05:11 sri /o/
05:14 firnsy lol ... my 4yo races in everytime i click on that link
05:14 sri :D
05:18 franzkafka sri, what was wrong with mongodb?
05:18 franzkafka I seem to recall you being a bit of a zealot about it
05:19 sri https://groups.google.com/d/msg/mojolicious/GFsXFQF3t-k/Tchin2EhJqgJ
05:20 sri i never actually defended mongodb, i just said it has potential
05:21 neyasov_ joined #mojo
05:21 sri anyway, the lesson is AGPL means it might as well not be open source
05:27 bwf_ left #mojo
05:30 sri ❤️ postgres
05:33 sri btw. i've stopped adding stuff to the shop (for those that wanted me to say when)
05:33 franzkafka PostgreSQL has been the obvious choice for years, but people have always went with MySQL, or whatever the latest buzz is. It's good to see that people are finally starting to give postgres the recognition it has deserved for a very long time.
05:33 sri it's funny postgres gets all the buzz for adding nosql features now
05:34 sri but i'm not gonna complain, jsonb in 9.4 looks great
05:34 franzkafka that and json types, then jsonb
05:34 franzkafka yeah, but I'm not complaining. I've been using it since ~2001 or so, and it's always been awesome.
05:35 franzkafka I wanted the when, thanks sri
05:35 franzkafka I'm going to get a few things this weekend
05:35 franzkafka that hoodie is a must
05:35 rem_lex|pivo joined #mojo
05:58 tempire I'm glad mango happened.
05:58 tempire It made me learn mongodb
05:58 tempire And now I know.
06:07 neyasov_ joined #mojo
06:36 amon joined #mojo
06:57 Eke- joined #mojo
07:20 damaya joined #mojo
07:54 dod joined #mojo
08:03 Andreas joined #mojo
08:04 batman any idea how postgres identifies the user when connecting though a socket on the same host?
08:04 batman i don't get how it can know my username though the socket...
08:05 bpmedley Did you setup your pg_hba.conf ?
08:06 Andreas2 joined #mojo
08:10 damaya batman, are you using ident in pg_hba.conf?
08:11 batman oh. it's working, i'm just curious about the actual code that identify me
08:11 bpmedley Depends on your pg_hba.conf and access methdology.
08:12 batman it uses "peer" over unix domain socket
08:12 bpmedley http://serverfault.com/questions/470420/what-does-peer-authentication-mean-for-postgresql
08:14 basiliscos joined #mojo
08:14 damaya I only know ident, which uses the username from the OS.
08:14 Vandal joined #mojo
08:14 batman yeah "obtaining the client's operating system user name from the kernel" <-- how does that work?
08:15 bpmedley Does the OS know who open’ed the unix domain socket?
08:15 damaya I think it uses getpeereid() which returns the UID for the user connected to the socket.
08:15 damaya ident that is, not sure about peer
08:18 bpmedley https://www.freebsd.org/cgi/man.cgi?query=getpeereid
08:18 damaya Anyone here using Awesome?
08:18 damaya FreeBSD has the best documentation.
08:18 damaya It's also my favorite OS.
08:19 bpmedley batman: Does that make sense?
08:20 batman i guess it does. wonder if i can do that i perl...
08:20 damaya batman, getpwuid is probably the closest I can think of in Perl.
08:22 damaya I believe that getpwuid is a userspace function whereas getpeereid is kernel space. Then again, I may be talking out my ass.
08:28 batman damaya: but you can't do getpwuid on the server side
08:29 zz_Foxcool joined #mojo
08:34 denis_boyun joined #mojo
08:34 damaya I don't know if Perl has anything like getpeereid for sockets. I know Haskell does, but that doesn't help you much.
08:35 batman found it now :)
08:35 damaya batman, please share.
08:35 damaya I was looking at IO::Socket::INET documentation and I saw nothing.
08:35 batman ($not_sure, $uid, $gid) = unpack('i*', getsockopt($c, SOL_SOCKET, SO_PEERCRED));
08:35 batman it's not for INET. only for UNIX sockets
08:35 batman http://www.perlmonks.org/bare/?node_id=881003
08:36 batman at least the method above gives me (16648, 0, 0) when i'm root and (16648, 1000, 1000) when i'm myself :)
08:37 batman the first number 16648 vary... not sure what it is
08:37 batman ah! it's the PID :)
08:39 Shaeto joined #mojo
08:43 neyasov_ joined #mojo
08:45 bpmedley my ($pid, $uid, $gid) = IO::Handle::Record::peercred(\*Client);  <— Another way
08:45 bpmedley Doh; I see it’s the same module, sorry
08:53 zackiv31 joined #mojo
08:54 batman :)
08:55 damaya batman, what OS?
08:55 batman linux
08:55 batman doesn't it work for you?
08:57 fhelmber_ joined #mojo
08:57 damaya yeah, I tested in FreeBSD and it works as well.
08:57 batman cool
08:57 batman https://gist.github.com/jhthorsen/e058dec38c7678259686
09:01 batman this is pretty cool. now i can make a unix socket to tcp socket proxy, where the command line user doesn't have to authenticate him/herself :)
09:01 bpmedley That is cool.
09:03 denis_boyun joined #mojo
09:09 Dandre Hello,
09:10 bpmedley https://gist.github.com/brianmed/0e73292da11940a95b98  <— This might be handy; it auto updates a timestamp when a row is updated in postgres
09:10 bpmedley Dandre: Morning
09:13 Dandre I want to trigger some code when my http client has read some response from my server (sent with respond_to). I plan to  use on(finish=>sub{...}).
09:13 Dandre I want this callback to know whether my client has read all data and no time out occured. How can I do that?
09:13 Dandre Can I get some status code for the write operation on this connection?
09:14 bpmedley Can you read it from the $tx (assuming the $tx is still defined)?
09:15 bpmedley $c->res->code
09:16 Dandre ok I'll try
09:18 d4rkie joined #mojo
09:22 irq joined #mojo
09:32 batman Dandre: $ua->once(start => sub { my ($ua, $tx) = @_; $tx->res->on(progress => sub { my ($res, $chunk) = @_; .... }) });
09:32 batman not sure if i understood correctly, but the inner on("progress") will fire when the server writes data to the client
09:32 batman iirc
09:34 batman oh it's "my ($msg, $state, $offset) = @_;" not my ($res, $chunk)
09:34 batman Dandre: http://mojolicio.us/perldoc/Mojo/Message#progress
09:37 Dandre ok this will help me to trace my timeout issues. Thanks!
09:39 denis_boyun joined #mojo
09:41 batman not if you have an inactive timeout issue
09:46 bowtie_ joined #mojo
09:52 bowtie_ joined #mojo
10:05 Dandre batman: oh! How can I debug those inactive timeout issues?
10:05 batman sri: how about making a t-shirt with http://mojolicio.us/mojo/failraptor.png and no "mojolicious" ?
10:05 batman Dandre: no idea. it's the nature of the issue: there's no activity :)
10:06 batman Dandre: i usually just add a bunch of warn "ASKDLNJAKS"; in my server side code to see where it stops
10:06 bpmedley Dandre: It’s difficult to answer without seeing any code
10:11 batman sri: sorry. forgot about the quality again. (nevermind)
10:28 mojobot19638 joined #mojo
10:36 bowtie_ joined #mojo
10:50 denis_boyun joined #mojo
10:54 neyasov_ joined #mojo
11:19 Guest-quest joined #mojo
11:28 neyasov joined #mojo
11:30 Eitz joined #mojo
11:39 Guest-quest hi, on mojolicious server error page (dev mode) i have unicode chars but they not properly ut8::decode for DBD::Pg(pg_enable_utf8 => 1) ---> http://pbrd.co/10DyXPs
11:48 hernan604 did you specify your source code is utf8 ?
11:48 hernan604 use utf8;
11:48 Guest-quest hernan604: i always use Mojo::Base -strict;
11:49 hernan604 do you have special characters on the source code ?
11:49 hernan604 ie accents
11:50 hernan604 if so, add 'use utf8' in that class
11:50 Guest-quest the unicode chars of perl code shown properly
11:51 hernan604 where us the source ?
11:51 hernan604 show some code...
11:54 Guest-quest here unicode of perl code exeption http://pbrd.co/10DCZYb
11:55 hernan604 right
11:55 hernan604 on the top ot that sourcecode, add: use utf8
11:56 hernan604 does it fix ?
11:57 Guest-quest use utf8 included then use Mojo::Base -strict; Yes?
11:57 hernan604 doesnt matter
11:58 hernan604 try to add "use utf8; use Mojo::Base -strict;"
11:58 hernan604 and test if that works
11:59 Guest-quest not fix
11:59 hernan604 ok
12:00 hernan604 order by....
12:00 hernan604 where is that source ?
12:00 Guest-quest i want utf8::decode <pre><%= $exception->message %></pre>
12:01 hernan604 you dont need to use utf8::decode everywhere
12:01 hernan604 it should be transparent
12:01 hernan604 no need for utf8::decode
12:03 hernan604 do you utf8::decode everywhere ?
12:03 Guest-quest no
12:03 hernan604 ok]
12:04 hernan604 so would be nice to see the code which includes 'order by' clause
12:05 Guest-quest the DBD::Pg driver die with raw chars
12:07 hernan604 yes
12:07 hernan604 where is the order by clause ?
12:07 hernan604 you cant show ?
12:07 hernan604 or what? rasnattt
12:11 Guest-quest latest img show mix of raw chars from DBD driver and right unicode simbols from the perl code
12:12 hernan604 did you add "use utf8" in Contract.pm ?
12:13 Guest-quest of course)
12:14 hernan604 it seems like a double encoding your columns names
12:14 hernan604 or misencoding
12:14 Guest-quest no, strongly no
12:15 hernan604 order by "D'DÑD" its not getting the column names correctly
12:16 Guest-quest the problem not in mojo but in DBD )
12:16 hernan604 definately not mojo
12:17 hernan604 and probably not DBD
12:17 hernan604 you are telling the DBD to select column "XXXXX" and it understands "YYYYY"
12:18 hernan604 so it seems you are not properly encoding
12:18 Guest-quest in my code i tell right names and all things work
12:19 Guest-quest but exceptions on the raw bytes
12:24 Eitz Don't know if someone already asked but, are your sources saved as utf8?
12:24 mst did you pass pg_enable_utf8 to DBD::Pg ?
12:24 mst doesn't it encode/decode in that case
12:24 Guest-quest yes pg_enable_utf8
12:25 Guest-quest sources is utf
12:25 mst ok, so please show us the whole of Contract.pm
12:26 mst ah. you're using utf8 in a column name. that probably requires an encode() call
12:26 mst also whoever designed the database schema should be punched
12:43 ignacio_ joined #mojo
12:49 Guest-quest so, i copy the exception.development.html.ep and append 2 lines http://paste.org.ru/?6e7963 ))
12:51 hernan604 you are trying to fix the error message ?
12:51 Guest-quest yes, but i work
12:51 Guest-quest it works fine)
12:54 Guest-quest many times of utf8::decode also works
12:54 denis_boyun joined #mojo
12:55 mst you might want decode() from Encode.pm
12:55 mst using utf8.pm functions is almost always wrong
12:57 Guest-quest utf8 is nice)
13:00 mst Encode is correct
13:00 mst utf8.pm is wrong
13:01 mst except for plain 'use utf8;', you wanted Encode.pm not utf8.pm
13:02 Guest-quest ok, where is proof? ))
13:02 mst either take the advice or don't
13:03 moritz Guest-quest: social proof: I agree with mst
13:03 mst all the people who understand unicode better than me recommend Encode.pm
13:04 neilhwatson joined #mojo
13:05 jberger hernan604: for the record, Mojo::Base does import utf8 into the caller
13:05 Guest-quest I'll continue time to think
13:06 hernan604 oh did know that, thanks jberger
13:07 jberger Guest-quest: Mojo::Util has encode and decode functions. trust them if you don't trust mst
13:07 * jberger trusts mst
13:08 Guest-quest i trust everybody
13:08 chansen Guest-quest: mst is correct, Encode should be preferred if you care about proper Unicode
13:09 Guest-quest everybody thanks
13:10 jberger Guest-quest:
13:10 jberger oops
13:26 bwf joined #mojo
13:30 mib_t0gvds joined #mojo
14:20 sri Mojo::Util::encode/decode caches the objects returned by Encode::find_encoding
14:23 Eke- joined #mojo
14:27 KCL joined #mojo
14:29 amon joined #mojo
14:51 mgrimes joined #mojo
15:08 mattastrophe joined #mojo
15:32 sri hmm, looks like that perl6 talk might not be very serious... that's gonna end well
15:33 sri if the goal was to make me feel silly for still getting excited for anything coming out of the perl6 camp, i guess it worked
15:41 mst sri: oh?
15:43 mic joined #mojo
15:45 mattastrophe joined #mojo
15:48 mic is there a space missing? https://github.com/kraih/mojo/blob/master/lib/Mojolicious/Plugin/TagHelpers.pm#L657
15:59 sh4 joined #mojo
16:03 maze joined #mojo
16:08 ryozi joined #mojo
16:14 neyasov joined #mojo
16:24 o3u joined #mojo
16:33 hasan joined #mojo
16:33 hasan hello everybody
16:34 hasan I try to call a JSON with Mojo::UserAgent from another route within a route in the same app. is this possible in general?
16:34 hasan when doing this, I get an error message: 'message' => 'Premature connection close'
16:35 hasan the second route I try to call with $ua is my API in My::Mojo::API::Whatever and the $ua caller is in My::Mojo::SomeRoute
16:37 hasan I wanted to avoid duplicate code, because the API has all my DBI calls in it. and instead of writing the SQL query again in SomeRoute I thought of fetching the results with $ua since the API is available via url.
16:39 o3u Is there a way to make Mojo::JSON use JSON::XS ? (or does it when JSON::XS is installed)
17:03 disputin joined #mojo
17:07 nicomen hasan: how are you mojolicious?
17:07 nicomen hasan: how are you _RUNNING_ mojolicious?
17:11 hasan nicomen: I fixed it. $ua went out of scope too early
17:15 mattastrophe joined #mojo
17:15 * bwf thinks the Mojo::JSON and JSON::XS topic needs to be added to FAQ http://irclog.perlgeek.de/mojo/search/?nick=&amp;q=JSON%3A%3AXS
17:39 hasan I am trying to bridge a route to "prepare_foo" and in this sub prepare_foo I make a $ua get request to another route. it seems that this request within a request is blocking.
17:40 hasan so far no problem if I make it non blocking with a callback sub of $ua. but then I can't prepare my stash in prepare_foo. because the bridge already returns
17:40 hasan how can I solve this problem?
17:41 ua left #mojo
17:42 hasan so my goal is: before routing to /mylist, bridge it to prepare a stash with a GET request to /api/v1/list to get some db entries, then put $list into the stash and return and continue to /mylist.
17:43 hasan $ua with a callback (for non blocking) works, but the bridge returns too quickly, so no stash content. the blocking version blocks the whole /mylist route.
17:45 o3u bwf: ?
17:48 o3u how do i "monkey patch" it in any advice?
17:53 sri bwf/o3u: multiple people here have promised to release a module for it
17:53 sri like jzawodn
17:54 sri i would have done it myself, but it's such an easy task, i was hoping someone would actually deliver
17:55 * sri would be surprised if it was more than 10 lines of code
17:56 jzawodn yeah, it's quite simple.  I'm hoping to exctract that into a tiny CPAN module next week
17:56 * sri cracks the whip
17:56 jzawodn ow!
17:58 sri little unfortunate that the Mojo::JSON::XS namespace contains a bad module
17:59 jzawodn o3u: https://gist.github.com/jzawodn/8cc6365e8bcecba9b0bb -- that's an early version.  only handles encode (not decode) and probably has a needless sub def.  but it works until I clean it up and make the decode bit too
18:00 o3u http://i2.kym-cdn.com/entries/icons/original/000/011/976/lumbergh.jpg
18:00 o3u jzawodn: Thanks ! will check out
18:00 o3u i need decode though
18:01 jzawodn I suspect that if you peek inside Mojo::JSON you'll see that it's just as simple.  one more sub to override.  (but I haven't done it yet.. I needed encode badly at the time)
18:01 o3u lol ok, just saw it
18:01 jzawodn should have time once I finish up prep for this: http://www.meetup.com/San-Francisco-Perl-Mongers/events/215733252/
18:02 irq joined #mojo
18:22 disputin joined #mojo
18:36 sri really too bad the core team has voted against dpeending on IO::Socket::IP, don't think i can +1 a non-blocking resolver patch like this https://github.com/olegwtf/mojo/commit/74dc69d7482549e037eb4733c4998d3a8b8cf2ff
18:38 sri jberger, tempire, marcus, batman, crab: ^
18:40 sri that's 41 additional lines of code for not having to install IO::Socket::IP on older perls
18:41 sri and much less test coverage
18:51 * sri has officially voted -1 https://github.com/kraih/mojo/issues/700#issuecomment-62193030
18:51 dod joined #mojo
18:52 sri jberger, tempire, marcus, batman, crab: if you feel my concerns are unwarranted and vote +1, i will not veto, so it's up to you
18:52 * sri still stands by his earlier proposal
18:55 dod joined #mojo
18:57 disputin joined #mojo
19:11 batman sri: sorry! i haven't been around... why have people woted against IO::Socket::IP ?
19:14 batman i don't get it
19:15 Vytas joined #mojo
19:20 sri because installing it before Perl 5.16 requires a compiler
19:20 sri especially crab didn't like that
19:20 sri and tempire i think
19:20 batman not sure if i agree
19:21 batman did they have specific usecases, when a compiler was not available?
19:22 sri nope, they did not qualify their votes further
19:22 sri (i believe)
19:23 sri crab, tempire: please correct me if i'm wrong!
19:23 batman i commented on #700
19:24 batman can i edit my comment, or is that bad?
19:25 sri http://irclog.perlgeek.de/mojo/2014-11-06#i_9621000
19:25 sri tempire was the strongest defender
19:25 sri crab not so much
19:27 sri jberger, tempire, marcus, batman, crab: in case you didn't actually check, IO::Socket::IP only requires a compiler before Perl 5.16
19:28 sri IO::Socket::IP requires Socket 1.97, which shipped with Perl 5.15.6
19:28 sri Net::DNS::Native already requires Socket 1.94
19:29 sri soooo, on Perl 5.16 and 5.18 a hard dependency on IO::Socket::IP would just be a pure-perl dep
19:32 sri batman: i edit comments all the time
19:32 batman ok :)
19:32 sri (but i usually keep the core message the same)
19:33 sri if the core message changes it's usually best to make a note describing the edit
19:34 batman ok
19:35 batman i'll keep it as is
19:36 sugar joined #mojo
19:38 tempire oh
19:38 tempire I thought it was 5.20
19:38 tempire 5.16, I'm ok with that.
19:39 tempire to be honest, I'm not sure that non-blocking name resolution is all that big of a deal.
19:39 tianon but IO::Socket::IP is ♥!
19:40 tempire Requiring a dependency for Perls 3+ years old, though is fine.
19:40 tempire We are the poster children for pushing forward
19:41 tianon iiuc, it's in-core in 5.20, but pure-perl down to 5.16, right?
19:41 tianon and earlier than that requires compiler?
19:41 tianon so it's still technically a dep, but it's pure-perl and thus fatpackable
19:46 good_news_everyon joined #mojo
19:46 good_news_everyon [mojo] kraih created net_dns_native_again (+1 new commit): http://git.io/XXfZPA
19:46 good_news_everyon mojo/net_dns_native_again bbe3c42 Sebastian Riedel: added support for non-blocking name resolution with Net::DNS::Native
19:46 good_news_everyon left #mojo
19:46 sri that is option 3, Net::DNS::Native support tied to an optional IO::Socket::IP
19:47 sri only Oleg was against that, but he didn't have good reasons
19:47 sri https://github.com/kraih/mojo/compare/net_dns_native_again
19:53 sri first freebsd result http://www.cpantesters.org/distro/N/Net-DNS-Native.html?oncpan=1&amp;distmat=1&amp;version=0.11
20:04 sri jberger, tempire, marcus, batman, crab: so, we now have 4 options... 1) make IO::Socket::IP a hard dep, 2) do the workaround dance and support ::IP and ::INET with NDN, 3) keep ::IP optional but tie NDN to it, 4) don't support NDN at all
20:04 denis_boyun joined #mojo
20:20 basic6_ joined #mojo
20:24 good_news_everyon joined #mojo
20:24 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/kFt-3Q
20:24 good_news_everyon mojo/master 687905b Sebastian Riedel: false positive constants do not seem like a problem anymore
20:24 good_news_everyon left #mojo
20:25 denis_boyun joined #mojo
20:26 sri anyway, i guess we have 3 +1 votes for option 1 now
20:55 good_news_everyon joined #mojo
20:55 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/iReuuA
20:55 good_news_everyon mojo/master 5180ae3 Sebastian Riedel: added support for non-blocking name resolution with Net::DNS::Native (closes #700)
20:55 good_news_everyon left #mojo
20:55 sri ok, that was exhausting
20:55 tempire woo
20:56 good_news_everyon joined #mojo
20:56 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://github.com/kraih/mojo/commit/6b7b60019c6e0f62b66beced454efb3ddbe0f15a
20:56 good_news_everyon mojo/master 6b7b600 Sebastian Riedel: install Net::DNS::Native on Travis
20:56 good_news_everyon left #mojo
21:13 jberger_ joined #mojo
21:14 jberger_ I have been +1 for a long time
21:14 jberger_ sri++
21:15 jberger_ Oleg++
21:15 jberger_ Recall also that mojo isn't fat packable as is anyway
21:21 jberger_ Look at that line diff! +132 -218
21:24 sri just hope no IO::Socket::IP bugs or platform specific quirks pop up on cpan testers -.-
21:24 jberger_ hmmmmm
21:24 jberger_ There is always that
21:25 sri at least it's easy to address if it happens
21:25 jberger_ I know it's rare for us, but do you want to ship a trial release?
21:26 sri http://www.cultofdusty.com/wp-content/uploads/2011/08/shirt_oreilly.jpg
21:29 jberger_ Oh man, I really need to open my convos though my nat
21:29 jberger_ I miss inline images on my phone at $work
21:31 jberger_ http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-32-02-metablogapi/8054.image_5F00_thumb_5F00_35C6E986.png
21:37 sri yea, this is gonna end well... http://www.reddit.com/r/programming/comments/2llk74/larry_wall_retracts_perl6_release_date_says/
21:47 hoppie joined #mojo
21:49 sri hoppie: you should try mojolicious master with Net::DNS::Native 0.11
21:49 sri non-blocking resolver should work fine with fork now
21:50 hoppie Just read the irc log. Thank you for non-blocking name resolution with Net::DNS::Native. I was feeling bad about the whole thing and thinking perhaps not going to be able to use Mojolicious for the type of apps I write (powerful apps utilizing 20+ cores).
21:50 hoppie And wow... It's in.. Gosh, am very happy.
21:51 hoppie Thank you.
21:55 hoppie It's in master... Yeah... \O/
22:01 bpmedley joined #mojo
22:07 bpmedley hasan: Did you get your route question answered?
22:32 hasan bpmedley: no. I found the solution on my own
22:32 hasan why?
22:32 bpmedley I was going to try and help, if need be.
22:32 hasan bpmedley: would love to hear some hints
22:33 hasan the problem I've described is clear and can occur?
22:34 bpmedley I think.  You want to do a GET reqest before a particular route.
22:35 hasan yes
22:35 bpmedley Give me a few moments.
22:35 hasan to fetch some data from my db (done by my API where the request is sent to) and come back to continue to route
22:35 hasan ok
22:39 jberger_ joined #mojo
22:40 jberger_ hasan/bpmedley: http://mojolicio.us/perldoc/Mojolicious/Guides/Routing#Under
22:40 jberger_ example of Nonblocking bridge
22:43 hoppie am amazed with diff output from Net-DNS-Native-0.10 and Net-DNS-Native-0.11
22:44 hasan so I the under sub I could easily say "$self->stash( foo => $hashref )" and I would get it in the destination route?
22:44 hasan s/I/in/
22:44 sri if anyone here has some *BSD boxes, some test runs for Net::DNS::Native 0.11 would be nice
22:46 sri looks like there's win32 problems http://www.cpantesters.org/distro/N/Net-DNS-Native.html?oncpan=1&amp;distmat=1&amp;version=0.11
22:46 sri Native.o:Native.c:(.text+0x1872): undefined reference to `pthread_atfork'
22:47 * sri suspects the fork stuff needs to be disabled on windows
22:47 sri pass on cygwin is nice though
22:48 hoppie will try on TrueOS 10.0 and DragonFly 3.8.2 (will build a VM and test this one).
22:49 hoppie Not sure how far it will go, but will also test on Solaris 11.2.
22:49 hasan sri: will it compile with perl-5.18.0?
22:49 hoppie Saw __NetBSD__ checks, thus the reason will test on DragonFly.
22:49 hasan I have a fbsd box here. could test.
22:50 sri my main worry is that it installs fine but breaks once you use it with mojolicious :o
22:50 sri if it doesn't install that's ok
22:51 sri hopefully the segfault test will ensure that
22:52 damaya joined #mojo
22:52 hasan http://nopaste.info/97dd2693e7.html
22:52 hasan freebsd.
22:53 sri thanks, that's a good result
22:54 sri Oleg++ # printing perlbrew instructions
22:55 hoppie Will test on these platforms: CentOS 7 (Perl 5.16.3), Solaris 11.2 (Perl 5.12.5), TrueOS (Perl 5.16.3), not sure Perl version on DragonFly (vm not built yet)
22:55 * sri has never heard of TrueOS
22:56 hoppie PC-BSD
23:03 bpmedley hasan: https://gist.github.com/brianmed/af56c0b5fe5ca30e094f
23:05 hasan wonderful
23:05 hasan thank you very much.
23:05 hasan this will help me.
23:06 bpmedley You are welcome.  Was there anything else?
23:06 hasan thanks :)
23:08 jberger_ bpmedley: that's a blocking request in the bridge
23:08 bpmedley I agree.  How to improve?
23:09 jberger_ Did you see the link I posted a few minutes ago
23:11 hasan jberger, bpmedley: right. there are two ways of doing the non blocking version afaik. pass a callback to Mojo::UserAgent or use Mojo::IOLoop::Delay.
23:11 jberger_ joined #mojo
23:12 bpmedley Yes; however, I wasn’t sure how to translate that to the situation here.
23:12 jberger_ Sorry I missed any response until that last message
23:12 jberger_ Elevator
23:13 jberger_ Pass a callback to the get call which calls continue if desired
23:19 mattastrophe joined #mojo
23:20 bpmedley http://pastie.org/9703878 <— What am I doing wrong?
23:21 hasan you don't see the stash right?
23:22 bpmedley (in cleanup) Can't use an undefined value as a HASH reference at shimmy.pl line 31.
23:22 hasan or to be more precise: $number is not defined?
23:22 hasan yes. that's because you are returning before $mojo finishes.
23:24 hasan but I only guess. had the same problem. I guess the callback is delayed so return 1 is reached. but I had the version without continue and return 1 instead.
23:25 hoppie for oleg: Use of uninitialized value in subroutine entry at /tmp/Net-DNS-Native-0.11/blib/lib/Net/DNS/Native.pm line 37
23:26 hoppie CentOS 7 (Perl 5.16.3)
23:26 hoppie make test
23:27 hoppie the warning ^^ is reported lots (cannot count, too many) during make test.  All tests successful, though.
23:28 bpmedley http://pastie.org/9703895 <— See the error?
23:32 hoppie oleg: the warning is seen with /usr/bin/perl (5.16.3). No warnings with Perl 5.18.4 (compiled manually on same OS).
23:33 hasan bpmedley: yes. the same error I got. see above.
23:33 hasan where I am asking why the connection is closed premature
23:34 hoppie oleg: the warning reported "Use of uninitialized value .../DNS/Native.pm line 37" 227 times during make test with Perl 5.16.3 on CentOS 7.
23:35 jberger_ http://mojolicio.us/perldoc/Mojolicious/Guides/FAQ#What-does-Premature-connection-close-mean
23:35 jberger_ bpmedley: ^^
23:35 sri hoppie: not too bad ;p
23:39 hoppie oleg: same with TrueOS 10.0 (BSD) "Use of uninitialized value .../DNS/Native.pm line 37" 227 times during make test, also with Perl 5.16.3 on this OS
23:40 hasan bpmedley: can you report your success when you fix it?
23:40 hasan i have to go but would come back to you again.
23:40 d4rkie joined #mojo
23:40 bpmedley Sure
23:41 jberger_ The ua is going out of scope
23:41 jberger_ Keep the ua on the outer scope (file level)
23:42 bpmedley http://pastie.org/9703911 <— Is this an accepted way to do that?
23:43 hoppie oleg: line 37: _fd2socket $self->_getaddrinfo($_[0], $_[1], $_[2], GETADDRINFO);   Both $_[0] and $_[1] are not defined
23:43 jberger_ You can keep a ua in the stash if you want
23:43 sri hoppie: maybe collect those in a gist
23:43 jberger_ That's not the tx that you are interested in
23:47 bpmedley http://pastie.org/9703918 <— This is the latest version
23:48 hasan does that work?
23:48 bpmedley No, sorry, I should have related that.
23:50 jberger_ bpmedley: do you enter the callback?
23:50 hoppie sri: yea, started doing that, thought it was one or two things.  oleg: ^^ correction $_[0] is defined, not $_[1] and $_[2].
23:52 bpmedley Yes.  I see the code in the debugger.  Let me post a log.  Also, I’m removing my helper that was overwriting the defualt helper.. egads, my bad.
23:54 jberger_ Also, why make a mojo url object from to_abs?
23:54 bpmedley http://pastie.org/9703925 <— This is the log of $ curl -v http://localhost:3000/list
23:55 bpmedley If you can, over-engineer.  The next version will have lasers.
23:55 bpmedley I wanted the script to work in dev and prod mode without any modifications.  Is there a better way?
23:57 jberger_ Why does mode matter?
23:57 bpmedley Port 3000 vs 80?
23:59 jberger_ url_for returns a mojo url object
23:59 bpmedley Doh

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