Camelia, the Perl 6 bug

IRC log for #mojo, 2013-10-05

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

All times shown according to UTC.

Time Nick Message
00:11 jnbek joined #mojo
00:13 punter joined #mojo
00:22 rem_lex| joined #mojo
00:25 hpekdemir joined #mojo
00:25 hpekdemir hi
00:25 hpekdemir how can I use websockets to recevie data/messages without sending in first place?
00:26 hpekdemir let's say I open a websocket connection with javascript. what do I need in the route "websocket /receive" to be able to only send. without "on(message => sub.."
00:27 hpekdemir I guess the on condition is only for conditional operations. like "on message" is when the client has sent something. but I only want to open a connection, keep it open and send some messages from the server to the client
00:31 jberger hpekdemir, you can ->send from the action method connected to the websocket route, though you may want to check that the connection is established correctly, this can be accomplished by subscribing to any of the available ->on handlers
00:33 hpekdemir jberger: so the "on(message.." condition is not only for the condition that a message was received?
00:33 jberger no there are several
00:34 hpekdemir http://sprunge.us/MbcD?perl
00:34 hpekdemir see line 47-49.
00:34 hpekdemir I don't want to send, only receive from server. but this does not work.
00:34 jberger http://mojolicio.us/perldoc/Moj​o/Transaction/WebSocket#EVENTS and the parent class http://mojolicio.us/perldo​c/Mojo/Transaction#EVENTS
00:34 hpekdemir so it's enough just to send from within the route? it seems that the client doesn't connect, once no message is sent.
00:34 hpekdemir ok
00:36 jberger at the end of the websocket handler call  $self->send('my text')
00:38 hpekdemir alright. thanks
00:45 hpekdemir ok works. thanks :)
00:51 jberger cool
00:51 jberger enjoy
00:51 jberger websockets are one of my favorite Mojo features
00:52 jberger I'm always happy to see new users
00:57 mst jberger: be warned that hpekdemir is slow. he's annoyed the shit out of most of the freenode #perl regulars by not reading the POD properly. I've had to put him on tempbans for basic reference questions. BUT. He is trying to learn. Hence he's still welcome, we just have to balance things.
00:57 hpekdemir thank you for understanding me mst.
00:57 hpekdemir I appreciate this.
00:57 jberger well he hasn't annoyed me yet :-)
00:58 btyler joined #mojo
00:58 jberger hpekdemir, most of mojolicious is explained in the docs, but every so often, the docs could use clairification
00:59 mst jberger: it's a cumulative thing. I'm pointing this out in advance because I still believe he's trying to learn so I want to see him shouted at rather than evicted
00:59 jberger don't be offended if we point you to relevant doc, but its up to you to internalize it
00:59 jberger mst: hehe, understood
01:00 jberger hpekdemir, the thing most new Mojo users fail to do is read the Mojolicious::Lite doc thoroughly
01:01 jberger it is the tutorial and should be read several times, I still read it often
01:01 jberger once you really understand those concepts, move on to the Guides in the order seen here: http://mojolicio.us/perldoc
01:02 hpekdemir jberger: yeah Mojolicious::Lite is well explained. though I had problems switching to full apps. the Growing docs is ok, but I rather start with full app "syntax" and focus on building apps correctly
01:02 hpekdemir and testi driven.
01:02 hpekdemir *test
01:02 jberger hpekdemir, I always use full apps for anything real
01:03 rem_lex joined #mojo
01:03 jberger the reason lite is required for the doc is that it works so much better for self-contained examples, so you need those for the remainder of the docs
01:03 jberger but I agree, I prefer the full apps
01:04 hpekdemir jberger: I hope this app actually *is* a real app :) my goal is to have several subscribers receiving some data from a publisher (zeromq) over websockets (mojolicious) and all event based (anyevent or mojo::ioloop)
01:04 hpekdemir couldn't decide whether AnyEvent or Mojo::IOLoop. currently I'm using IOLoop
01:04 jberger IOLoop can interact with AnyEvent via EV
01:05 hpekdemir oh
01:05 hpekdemir ok
01:05 jberger I prefer the IOLoop syntax even when I use AnyEvent and even when I'm not doing web programming
01:05 mst it can also interact with IO::Async
01:05 mst which is a better API than AnyEvent
01:06 jberger mst: interesting, is there a Mojo::Reactor::IOAsync or is it via the ::EV reactor too?
01:06 mst basically: don't use AnyEvent unless you -have- to. the API is hostile and the author makes me look like the nicest person you've ever met.
01:06 mst jberger: via EV works fine
01:07 jberger I <3 Mojo::IOLoop so I'm happy to hear that it works in as many places as possible
01:08 mst it's not a bad API. eventually I want to see IOLoop::EV replaced with a backend that IO::Async and POE can share
01:08 jberger I know sri wants someone to step up on a Mojo::Reactor::UV, and I think I might finally know someone with enough libuv experience to help me with one (when I can find the time! ha!)
01:08 mst we worked quite hard on that but never quite finished it (sri, LeoNerd, dngor, me, couple others)
01:08 jberger Mojo::Reactor subclasses aren't hard to make, especially if you are fluent in the target library
01:09 mst basically we need a DBI for event loops
01:09 mst sadly AnyEvent isn't even within shouting distance of being one
01:09 mst and the author is too insane to understand that fact
01:10 hpekdemir "AnyEvent is different - it is a thin abstraction layer on top of other event loops, just like DBI is an abstraction of many different database APIs."
01:10 hpekdemir :D
01:10 jberger someone at $work has been working with libuv for some really intense stuff, so I have some hope
01:10 mst yes. it was *supposed* to be that
01:10 mst but he did it completely wrong
01:10 jberger hpekdemir, the author is a ... special ... kind of person
01:10 asarch joined #mojo
01:11 hpekdemir don't know him. but seems to be a german?
01:11 mst yes. also a colossal asshole.
01:12 mst I like germans. I've been the easily offended american perl hackers' interface to our german brethren for years
01:12 mst MLEHMANN is just an asshole.
01:12 mst every time somebody files a ticket on RT he sends them hate mail
01:12 mst but he won't fix his Makefile.PLs to specify he wants a different bug tracker
01:13 hpekdemir I'm german, too.
01:14 hpekdemir without being an asshole :=)
01:14 jberger so is sri, the fearless mojo leader, we like our german perlers
01:14 jberger but you will do well to steer clear of lehmann
01:15 hpekdemir oh and btw mst, I sent my first patch on a module on CPAN to the author. I make improvements. I like this.
01:16 jberger hpekdemir good for you! now just to check, did you provide good descriptions of your proposed changes and test cases?
01:16 hpekdemir no :(
01:17 hpekdemir no tests.
01:17 hpekdemir I will consider this next time.
01:17 jberger also did you talk with the author before sending an out-of-the-blue patch? for all but the most obvious of fixes, I always like to touch base with the author so I can ask what the right course of action should be. you never know when the author has a fix (possibly very different) in the works
01:18 jberger including test cases with patches helps the author to understand your purposes, and proves that your patch works/helps
01:18 hpekdemir jberger: I tried to send him an email to his cpan address. but got a "not deliverable" mail-daemon message back.
01:18 hpekdemir ok
01:18 jberger hpekdemir, may I ask, which module?
01:18 hpekdemir sec
01:19 hpekdemir https://metacpan.org/module/​Log::Log4perl::Layout::GELF
01:19 * jberger looks
01:19 jberger still good for you for contributing, there is no better way to learn than to do
01:20 jberger I've not heard of that author, he only has one module, last updated two years ago (only 3 versions)
01:21 jberger sometimes those authors are harder to track down
01:21 hpekdemir I've started a year ago. had never touched perl before. after a while I did more in perl. rewrote my bash scripts at the company, etc. convinced my boos to let me use my perl scripts in production, etc.
01:21 hpekdemir so I'm quite happy about perl. I enjoy scripting with it.
01:21 jberger hpekdemir++
01:22 hpekdemir but people on freenode had a really hard time with me. :/
01:22 jberger its a great language, then again, this is a perl irc server, so perhaps I'm biased
01:22 jberger freenode is lord of the flies
01:22 jberger and not always easy on noobies
01:22 jberger ("noobies" said with love, we were all there once)
01:23 dqw7 joined #mojo
01:23 hpekdemir they deserve my respect. some good pros on there.
01:23 jberger I learned a lot from stackoverflow, almost all of my questions were already answered on there, found with a quick search
01:23 hpekdemir never forget how "huf" made my 10 lines into 2 lines of code. :D
01:24 jberger and when you really can't find the answer, there are usually good voices there
01:25 jberger as long as those 2 lines is a good (for some definition of good) as the 10, then  yeah, thats fun
01:25 jberger and I love perl golf too, but some of that is how Perl got a bad name for non-readability
01:25 jberger there is always a balance
01:26 hpekdemir oh you mean the scripts like "just another unix hacker"?
01:26 hpekdemir or the quiz like tasks
01:27 jberger this one is one of my favorites: http://codegolf.stackexchange.com/que​stions/3679/codegolf-com-saving-time
01:28 jberger btw, my current JAPH:
01:28 jberger (*STORE,*TIESCALAR)=map{eval"sub{$_}​"}qw;map{print&&sleep$|}split//,pop bless\$|++;;tie$:,$::;$:="Just another Perl hacker,\n"
01:28 hpekdemir this is crazy stuff.
01:30 jberger and I am currently the leader on this one: http://codegolf.stackexchange.com/questi​ons/307/obfuscated-hello-world/3695#3695
01:30 jberger and though it may not look "short" it actually did take some golfing :-)
01:32 hpekdemir this scares me.
01:32 hpekdemir give me another year to get perl right. :D
01:32 hpekdemir then we can do some golfing
01:32 jberger sounds good :-)
01:33 jberger and remember, I would NEVER recommend that kind of code in production, but isn't it cool that one language can do all of this, TIMTOWTDI!!
01:33 hpekdemir yes =)
01:35 davido joined #mojo
01:35 jberger hpekdemir, https://github.com/cowholio4/log4perl_gelf
01:39 hpekdemir omg.
01:39 hpekdemir https://github.com/cechevarne/log4perl_ge​lf/blob/e679d726cb7fe94427bffb18c003a2cc8​9b2f24b/lib/Log/Log4perl/Layout/GELF.pm
01:40 hpekdemir that is my change.
01:42 hpekdemir ok cool. next time I will check out github. I made changes like the in the fork above, but also some more fields for graylog2.
01:44 jberger I googled the author name to see if there was other contact info
01:44 jberger I found the github and thus the repo
01:44 jberger perhaps the author will be interested in working with you on this
01:44 jberger and eventually perhaps get code back to CPAN
01:44 hpekdemir yeah I will contact him.
01:44 jberger cool, good luck!
01:45 hpekdemir thank you.
02:00 rem_lex|pivo joined #mojo
02:31 mibfawker joined #mojo
02:36 mibfawker While module/modules/(controller?) do I look inside to figure out how to serve static files with more than single file extension just like External static files are not limited to a single file extension
02:37 mibfawker Which module/modules/(controller?) do I look inside to figure out how to serve static files with more than single file extension just like External static which files are not limited to a single file extension
02:39 hpekdemir does Mojo::IOLoop->singleton->reactor->io() spawn a new thread? and if so, how can I pass over a filehandle to a socket from zeromq, if the method to retrieve the socket type gets undef on forking?
02:40 hpekdemir "ZMQ::Socket objects aren't thread safe due to the underlying library. Therefore, they are currently not cloned when a new Perl ithread is spawned. The variables in the new thread that contained the socket in the parent thread will be a scalar reference to undef in the new thread. This makes the Perl wrapper thread safe (i.e. no segmentation faults)."
02:41 hpekdemir nopaste: http://sprunge.us/YchP?perl
02:42 hpekdemir gives me: Use of uninitialized value in hash element at /home/hasan/perl5/perlbrew/perls/perl-5.16.​0/lib/site_perl/5.16.0/Mojo/Reactor/Poll.pm line 16.
02:42 hpekdemir I can debug print out the value on line 38. but I guess on line 39 reactor doesn't get the right socket filehandle.
02:44 btyler hpekdemir: no new threads. none of the event loop libraries in perl (as far as I know) make use of perl's ithreads.
02:47 davido joined #mojo
02:51 mibfawker how do I crank up the logging level to the max for an app?
02:53 jberger__ joined #mojo
02:57 mibfawker hmm, default debug is the most verbose available :/
03:59 preflex_ joined #mojo
04:03 jmmills joined #mojo
04:05 jberger_ joined #mojo
04:30 hesperaux joined #mojo
04:47 Adura joined #mojo
04:49 mibfawker in a lite_app how to elevate the precedence of a route?
04:56 Vandal joined #mojo
04:59 mibfawker is there a mojolicious diagram?
05:01 russum joined #mojo
05:03 jberger_ joined #mojo
05:10 dqw7 joined #mojo
05:20 basic6 joined #mojo
05:47 rem_lex| joined #mojo
06:02 dotandimet joined #mojo
06:03 russum1 joined #mojo
06:04 jberger_ joined #mojo
06:22 rem_lex joined #mojo
06:42 dotandimet1 joined #mojo
06:57 Adura joined #mojo
07:09 * sri yawns
07:10 ocke joined #mojo
07:10 ocke hey ppl
07:10 sri o/
07:10 ocke I am heavily confused by some things
07:10 ocke and i bet you guys know exactly what i'm doing wrong
07:11 ocke @els = $dom->find('a');
07:11 ocke foreach my $el (@els) { $el->remove); }
07:11 sri http://mojolicio.us/perldoc/Mojo/DOM#find
07:11 ocke if @els is empty i get the error 'remove doesn't exist'
07:12 ocke why would the code get there in the first place!?!?!?
07:12 ocke compiler i mean
07:14 ocke oh
07:14 ocke you got to be kidding me
07:15 ocke i figured it out
07:15 ocke i need to do ->each
07:15 ocke ok second problem :-)
07:17 ocke my $contant i pass into parse() has utf8 chars
07:18 ocke but when i ouput $dom it has converted those into lain1 chars, so now my påA~1s has weird characters
07:18 ocke print $content; works just fine.
07:18 ocke but print $dom->parse($content);
07:19 ocke gets me all kind of wrong chars
07:25 yakudza joined #mojo
07:25 ocke nobody?
07:26 avkhozov joined #mojo
07:29 crab you're doing something wrong
07:29 jberger_ joined #mojo
07:29 crab either your input isn't as utf-8 as you'd like, or something else.
07:29 crab print $domthingy->parse("some utf8 string") works fine for me
07:30 moritz or you don't understand perl's Unicode model (which is strange indeed)
07:30 moritz in that case, read http://perlgeek.de/en/arti​cle/encodings-and-unicode
07:30 crab or perl's unicode model just doesn't like you
07:30 crab that's always been my problem.
07:31 ocke well i guess i am doing something wonr
07:31 ocke wrong
07:31 ocke https://scoopon.cloudmetro.com/hc/en-us/search?​utf8=%E2%9C%93&amp;query=the&amp;commit=Search
07:31 ocke you can see the weird chars at the bottom
07:33 ocke but if it's not mojo, then why does print $content work just fine?
07:34 crab i suspect your content is latin-1, and you print it and it works fine because your locale settings expect latin-1, and when you print utf-8 output it breaks
07:34 ocke my content is utf8
07:35 ocke locale might be latin1
07:36 ocke https://scoopon.cloudmetro.c​om/hc/en-us/search?query=the
07:36 ocke that looks fine to me
07:37 sri your arbitrary use of utf-8 confuses me
07:37 sri (as a term)
07:37 crab yeah
07:39 sri Mojo::DOM only does characters, there is no charset handling at all, if something gets mangled then you passed in binary data that doesn't roundtrip well through perl text manipulation functions
07:39 ocke ha, this works
07:39 * sri is happy charset handling for removed in 4.0
07:39 ocke dom->parse( decode('utf-8', $content) )
07:39 ocke now it outputs in utf8
07:40 sri no
07:40 ocke yes
07:40 sri now it outputs in characters
07:40 ocke yeah utf8 characters
07:40 sri utf-8 is an encoding, perl characters have no encoding
07:40 ocke pff
07:40 ocke man this is confusing
07:40 ocke well it works
07:40 sri you mean unicode codepoints
07:41 ocke me happy
07:41 ocke you happy
07:41 ocke client happy
07:41 ocke me money
07:41 ocke everybody happy
07:41 ocke beer time
07:41 sri you were so close to leveling up your perl skills
07:41 ocke today was my first perl script
07:42 ocke probably my last too
07:43 d4rkie joined #mojo
07:44 d4rkie joined #mojo
07:44 ocke ahhhh you got to be kidding me
07:45 ocke man this is bs. i just spent 4 hours working on this perlscript
07:45 ocke because php was so slow
07:45 ocke and now perl is slower
07:46 ocke is there a quicker dom aprser?
07:46 ocke i bet that's why it's so slow
07:47 crab i recommend trying haskell, and then ditching it for scala two hours later.
07:47 rem_lex|pivo joined #mojo
07:47 ocke lol
07:48 ocke see as soon as i kick all the mojo::dom code out of the script it's super fast.
07:49 sri try C
07:49 ocke i don't know C
07:49 ocke I don't know perl either
07:49 ocke but it's easier to whip up some perl than C
07:50 crab as soon as you make your script not do what it's supposed to, it gets faster?
07:50 dotandimet joined #mojo
07:51 ocke much faster
07:51 ocke like we go from 15seconds to 1
07:51 ocke i can explain my situation so you get what i'm doing
07:51 ocke i have a reverse proxy which get's a thirds party website
07:51 ocke and i need to run a script over the page and then output that to the client
07:52 ocke i did that in PHP because I know php
07:52 ocke turns out to be pretty damn slow
07:52 ocke 110 sec for 1000 requests.
07:52 crab what do you have to do to the page before sending it?
07:52 ocke a bunch of really simple text replacements (that's easy) but also some dom manipulation
07:52 ocke i ahve to remove some elements
07:53 ocke i have to remove parent of parent of a with a certain href
07:53 ocke of '<a>'
07:54 crab if you can't stream the response, it's always going to feel slow, no matter how fast your DOM parser.
07:54 ocke yeah, it's going to much slower then native sure
07:54 ocke so anyway, i did some stress test
07:54 ocke turns out that *starting* php was the bottleneck
07:54 ocke a php script with just echo $content still took 95 sec for a 1000 request
07:55 ocke while perl with only print $content took 30 sec for 1000 request
07:55 good_news_everyone joined #mojo
07:55 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/4t25Ew
07:55 good_news_everyone mojo/master 003e48e Sebastian Riedel: use Mojo::DOM in Mojo::Collection example
07:55 good_news_everyone left #mojo
07:55 ocke so i was like, let's convert that shit into perl.
07:55 mibfawker joined #mojo
07:55 ocke but the perl dom parser is much much slower then php domdocument. I have to say it also does a lot more
07:55 ocke so it's not an honest comparison.
07:56 ocke i mean domdocument is pretty basic
07:56 ocke but it works
07:56 ocke and it's fast
07:56 ocke so if you guys got any ideas
07:56 crab maybe you should configure php so that it doesn't have to rerun your script each time
07:56 ocke hm
07:56 trone joined #mojo
07:56 crab use fastcgi and whatnot.
07:56 ocke yeah someone suggested a server
07:57 ocke so i don't have to 'start' php all the time
07:57 ocke which is by far the slowest thing of the whole process
07:59 crab there you go, problem solved.
08:00 ocke yeah
08:00 ocke so i just spent 5 hours on my first perl script
08:00 ocke to bin it all again
08:00 ocke well whatever, i acn put 'perl' on my resume now ;-)
08:00 crab cool.
08:01 ocke hey thanks man
08:02 ocke it's shower time
08:02 ocke and then beer
08:02 ocke and then 7:30 date
08:02 ocke with some kiwi chick
08:04 mibfawker how can I work this    Mojo::Loader->new->data('main')->{'foo.min.js'} = 'not template <%= localtime %>';  get '/foo.min.js' => sub { shift->render_static( '/foo.min.js' ); };
08:05 sri didn't you ask the same with a different nick before and i told you that it's not supported?
08:05 mibfawker yeah, different nick, but question was different
08:06 mibfawker same kinda goal though
08:07 mibfawker I can almost kinda make a go of it via get '/*fyle' => .... but the priority of my handler is too low
08:09 mibfawker or if there is a diagram of the mojo request loop ... so that I can figure out where to go monkeypatching ...
08:10 sri you're making false assumptions, render_static will never ever work with multiple extensions, because i've hardcoded a check for it there
08:13 mibfawker ok, i see sub _get_data_file { now, thanks
08:14 mibfawker how do I elevate my route above the default one for static files?
08:17 sri why would you want that?
08:18 sri (i'm asking because you can't)
08:25 sri anyway, these conventions are there for very good reasons, maybe you should try to understand them before monkey patching
08:27 mibfawker are these reasons spelled out someplace?
08:27 mibfawker @@ public/stat.ic.ic.ics.txt ... @@ template/fo.e.e.e.ep ... makes sense to me
08:28 mibfawker :)
08:29 jberger_ joined #mojo
08:30 sri you can deduce the reason from the explanation in the tutorial http://mojolicio.us/perldoc/M​ojolicious/Lite#Static_files
08:30 sri without prefixes it's the only way to know what is a static file and what is a template
08:31 mibfawker right, and I do my monkeypatching to add prefixes, then prefixes can be used to distinguish the difference ... one Loader for statics, one for templates
08:31 mibfawker and if i do ...
08:32 mibfawker then no special limitations for __DATA__
08:32 sri then you need to make your own Mojolicious::Static and Mojolicious::Renderer
08:32 sri having to type verbose prefixes all the time is also a limitation
08:33 sri once you reach the point where you would need that i don't consider your app suitable for a lite app anymore
08:36 mibfawker ok, thanks
08:54 denis_boyun joined #mojo
09:27 * sri wonders why 4.44 is hidden on metacpan
09:49 mire__ joined #mojo
09:49 dotandimet joined #mojo
09:52 jberger_ joined #mojo
10:00 sh4 joined #mojo
10:19 mire_ joined #mojo
10:47 Vandal joined #mojo
10:50 basiliscos joined #mojo
10:51 Phil21 joined #mojo
10:52 jberger_ joined #mojo
11:14 batman sri: i'm thinking about using Type::Tiny in Mandel, but it does not convert anything... so i'm guessing that i need to add extra coersion in my save() method or when saving fields data.
11:14 batman i'm thinking about delaying to actually doing save. does that make sense?
11:15 batman i guess it could mess up (delaying to save) if you do $doc->age("42"); and then try to use the raw data in a json doc...
11:17 batman i guess i could add my own set of coercion though.
11:20 dvinciguerra joined #mojo
11:52 jberger_ joined #mojo
11:58 tholen joined #mojo
12:16 batman sri: https://github.com/jhthorsen/mandel/commit​/ab601f6c5892e864042f2149daf69fffa89ef95d
12:16 batman i guess the unit test is kind of bad, but it was the best i could come up with atm :/
12:18 sri batman++
12:20 batman :)
12:21 batman got an idea on how to make the unittest better? i mean j($data), qr{...} is a bit hackish...
12:22 batman s/a bit/super/
12:22 batman next: i want to support sub documents as objects...
12:24 nicomen I get crosseyed waatching at line 89-97
12:24 batman nicomen: the inlineing?
12:25 batman you're welcome to make it more readable :)
12:25 nicomen yeah
12:25 batman but it needs to be inlined.
12:26 nicomen btw you want a json_contains("{ a: 1, b: 1 }", "{ b : 1 }") ?
12:26 batman no. i don't want json at all. i just want to check if it's really a number
12:29 sri batman: i wouldn't call it hackish, after all roundtripping through Mojo::JSON/Mango::BSON is the goal
12:29 batman that's true.
12:29 batman guess i'll just keep it then
12:30 batman wonder if there's anything else i should focus on... i just released 0.05 with belongs_to today
12:31 sri blocking support :)
12:31 batman haha.
12:32 batman i really don't care about blocking :/
12:32 batman blocking is soooo 2005
12:32 batman ;)
12:33 batman i will add blocking when someone who actually makes an app wants it.
12:35 sri it would be great for oneliners ;)
12:36 sri ./myapp.pl eval 'app->mandel->collection("foo")->create({...})'
12:37 sri *+->save
12:37 sri ./myapp.pl eval -v 'app->mandel->collection("foo")->count'
12:38 sri ./myapp.pl eval -V 'app->mandel->collection("foo")->all'
12:38 sri you get the idea ;p
12:38 batman yeah. but i would rather add -Mandel which handle blocking...
12:38 * batman will add andel.pm now :)
12:40 sri that won't help when you want to run code against your app though
12:40 batman ah. app->mandel... right
12:40 batman but i'm adding andel.pm anyway. just for the fun
12:40 sri yea, point is to have the whole app running with the eval command
12:41 batman i see. good point.
12:41 sri mojo eval -V 'app->validator->checks'
12:42 batman yup
12:49 hpekdemir joined #mojo
12:50 hpekdemir could someone have a look at this please? http://sprunge.us/PYOT?perl <- problem is the error message: Use of uninitialized value in hash element at /home/hasan/perl5/perlbrew/perls/perl-5.16.​0/lib/site_perl/5.16.0/Mojo/Reactor/Poll.pm line 16.
12:51 hpekdemir that is https://metacpan.org/source/SRI/Mojol​icious-4.43/lib/Mojo/Reactor/Poll.pm <- $self->{io}{fileno $handle} = {cb => $cb}; $handle is undefined.
12:51 sri the reactor doesn't accept file descriptors, just IO::Handle objects
12:51 hpekdemir but I saw one or two examples of people on gist which had there code similar using Mojo reactor io (with singleton or not).
12:52 hpekdemir sri: so pass $fd to IO::Handle and then pass that to the reactor?
12:52 sri oh, Mojo::IOLoop->new is also all wrong
12:52 hpekdemir oops. yes.
12:53 hpekdemir but the message was the same with Mojo::IOLoop->singleton->reactor->io()...
12:53 hpekdemir ok thank you
12:53 sri IO::Handle->new_from_fd($fd) or so
12:53 hpekdemir ok
12:54 sri while (1) { looks all wrong too
12:55 sri you also need to clean up after yourself
12:56 hpekdemir yes. $self->on(finish...) is not finished yet. zeromq docs suggest to use a while block when recv()'ing data. I guess this is not the case with Mojo::IOLoop anymore, since I'm watching the socket for readability, right?
13:00 hpekdemir ok it works.
13:00 hpekdemir thank you.
13:02 batman sri: https://github.com/jhthorsen/mandel/commit​/1202b3d67b4c8052474266dab89b44e197d8b4e5
13:02 batman haven't updated the pod...
13:03 batman added blocking support and -Mandel
13:04 sri \o/
13:16 hrupp joined #mojo
13:18 jberger_ batman++
13:18 jberger_ o/
13:19 batman :)
13:27 batman my blocking inplementation sucks.
13:39 asarch joined #mojo
13:47 jberger_ joined #mojo
13:58 batman better now... 0.06 in the wild :)
14:06 rem_lex| joined #mojo
14:22 dqw7 joined #mojo
14:37 jberger__ joined #mojo
14:38 batman sri: how about "Bool" ? should i do something special with that on save() ?
14:38 jberger__ batman, I'm looking through Mandel right now, its looking really great!
14:39 batman jberger__: thanks! :)
14:39 jberger__ I barely recognize it, you've done lots of work
14:39 batman any feedback is very much appreciated!
14:39 batman hehe... yeah. but you kind of kickstarted me :)
14:40 mst are you going to make it back onto multiple document stores like DBIC backs onto multiple RDBMSes?
14:40 jberger__ I'm just going to make a sample app using it to try to get the feel
14:40 jberger__ ooh, I recognize Mandel::import though ;-)
14:40 mst an object<->docdb mapper would seem like a really useful thing
14:40 sri batman: dunno, typecast to Mango::BSON::bson_true/false?
14:40 batman mst: i had an idea to make it work with redis, but i've not gone down that road yet...
14:40 asarch joined #mojo
14:41 batman sri: i was thinking something like that. but that would happen when i save() ? like a filter before actually pushing data into the store, or...?
14:41 mst right. just, I'm damned if I'm re-installing mongodb to try it
14:41 mst *rage*
14:41 jberger__ mst, the problem I think is that NoSQL document engines not only don't have a near-standard query language, some have very different models and feature sets
14:41 sri install tokumx instead :)
14:42 * sri still hopes that tokutek will become mongodb's innodb
14:42 mst oh, that's mongo but with the tokudb storage engine?
14:42 batman mst: haha. so what other options is there? i tried to think about not adding too much mongo/mango logic to the odm. at least not that i can't factor out
14:42 sri yea, it looks pretty awesome
14:42 * jberger__ has been plotting Alien::mongod
14:43 sri only a matter of time until 10gen rips out the horrible storage engine mongodb uses atm
14:43 batman :)
14:43 mst sri: are you sure? that would imply 10gen making the sensible decision
14:43 batman haha
14:44 mst I can totally see most clued users switching to the tokutek stuff
14:44 mst but 10gen have not had a great track record of making decisions that seemed obviously sensible to ... well ... anybody I know, honestly
14:44 sri well, i see lots of folks using tokumx already, they are forcing 10gen's hand
14:46 * batman need to add txn_do or something, since tokumx supports it...
14:46 mst I think they'll use the capital they raised to build another engine or rewrite their current one ... but that lots of people will keep using tokumx anyway
14:48 sri hopefully they'll just buy tokutek
14:49 sri they could use the talent
14:49 mst I remember thinking that about mysql and innobase
14:50 mst sri: that's the other problem. if they buy tokutek, will they put 10gen people in charge of the tokutek devs?
14:50 sri "tomorrows news: oracle buys tokutek" :o
14:50 mst because if they did that to me, I'd quit on the spot
14:57 jberger__ batman, I'm liking the distinction between Mandel::Model and Mandel::Document, cute
14:58 batman "cute" :D
14:59 jberger__ would you prefer "clever"?
15:00 batman yeah. but cute works as well ;)
15:00 batman jberger__: i've stolen most of the ideas from dbic. result, resultset, resultsource = document, collection, model
15:00 batman and of course the relationship things
15:00 mst please tell me you made relationships objects
15:00 batman haven't added might_have though. not sure if it makes sense in mandel...
15:00 mst I totally should've done that but everything was relying on them being a hashref by the time I knew
15:00 batman mst: oh! i will do that.
15:01 mst honestly, you probably only need two types of relationship
15:01 rem_lex joined #mojo
15:01 batman mst: it's still experimental. i can do whatever i like
15:01 batman mst: i got has_many, has_one and belongs_to
15:01 mst right, but has_many and has_one are effectively the same thing except that has_many is 0+ and has_one is 'exactly' one' - like might_have is '0 or 1'
15:01 batman crap! i'm late...
15:02 mst and belongs_to is a shit name, we stole it from rails and it makes me cry
15:02 mst we'll talk about it another time
15:02 batman mst: so you would kill "has_one" ? i guess i should have added might_have instead of has_one ...
15:02 batman mst: thanks
15:02 mst I'm saying that under the hood, has_one/might_have/has_many are all basically the same thing
15:02 batman yeah. i agree
15:02 mst in DBIC, they're "other side has a foreign key to me"
15:03 mst and belongs_to is "I have a foregin key to the other side"
15:03 batman i'm doing the same thing
15:03 mst even in a docdb that doesn't have foreign keys, the direction of the pointer still exists
15:03 batman i don't want to update two objects when adding relationship
15:04 mst you may find that you -do- want to, as a performance denormalisation, but there's no need for it to be the default
15:04 batman i don't see why i want to have two way keys. i think more can go wrong that way.
15:04 batman please don't answer!!! i need to go
15:04 batman :D
15:05 mst like I said - performance denormalisation, optionally
15:05 mst think about that and we'll chat later :)
15:06 sri do your relationships use actual dbrefs?
15:06 sri suppose there are some interesting possibilities for handling those transparently in an odm
15:08 sri http://docs.mongodb.org/manual/ref​erence/database-references/#dbrefs
15:11 batman sri: no. just _id_somename => ...
15:13 mst I thought dbrefs were one of those 'nice idea in theory, fuckton of sharp edges in practice' features
15:14 * batman thought so as well
15:14 batman don't really see the real usage
15:14 sri never had a problem with them
15:15 sri actually considered adding my $doc = $db->resolve($dbref);
15:15 batman not a problem. but not a huge gain either imo
15:16 sri well, they are a commonly used convention now... so odds are they will get more features in the future, perhaps server side constraints to enforce relationships
15:16 sri or server side resolving
15:16 mst server side constraints? I thought that was blasphemy for NoSQL db
15:18 sri well, you have unique indexes too
15:19 sri or ttl indexes for another kind of constraint
15:21 bowtie_ joined #mojo
15:39 jberger__ batman (probably gone by now), I'm not sure I'm convinced that the blocking logic works in all cases
16:41 sri batman: jberger is right, your way of blocking is flawed
16:59 dqw7 joined #mojo
17:12 jpn joined #mojo
17:24 dotandimet joined #mojo
17:45 dotandimet joined #mojo
17:47 denis_boyun joined #mojo
18:02 Phil21 joined #mojo
18:33 dotandimet joined #mojo
18:40 dod joined #mojo
19:03 jberger__ sri: when a cursor encounters an error, what documents are returned? none I would guess
19:03 jberger__ especially in non- blocking (not returned then, but provided to the callback)
19:05 btyler joined #mojo
19:12 dod joined #mojo
19:24 dotandimet joined #mojo
19:33 jberger__ sri: what does $coll->remove(...) return when it matches multiple documents? an arrayref of documents?
19:35 jberger__ sri: https://github.com/kraih/mango/blob/​master/lib/Mango/Collection.pm#L201
19:35 jberger__ just the first one? seems odd
19:35 jberger__ you cannot access the others nor count how many were removed?
19:59 D4RK-PH0ENiX joined #mojo
20:05 hummeleBop joined #mojo
20:11 dotandimet joined #mojo
20:12 d4rkie joined #mojo
20:24 rem_lex joined #mojo
20:34 damaya joined #mojo
20:34 damaya Hi guys.
20:34 damaya I am wondering if there are any really good explanations out there with regards to full apps vs lite apps. The advantages and disadvantages of each. Why go with a full app rather than a lite app.
20:35 damaya I know about tempire's example, but it doesn't really answer any questions for me other than how to do X in each.
20:39 cfedde The choice of one over the other has to do with scale of the abstractions involved.  My Mojolicious::Lite controlers tend to be more "scripty",  if that means anything.
20:41 damaya So, I have a single webapp that serves multiple functions. There is a DBIx::Class scheme and a sqlite3 database on the backend, but each page does something different with it. Also, I will be releasing this app to a team of people to maintain. I should go with a full app then?
20:41 damaya arg
20:42 damaya I wish there was a book on mojolicious. I am really trying to stick with it over going with Catalyst. The only draw Catalyst has over mojolicious for me is that there are published books. That's it. The only thing.
20:43 damaya Thus I am sticking with mojolicious, but I really wish there was a published book I could get on Safari Books Online.
20:43 damaya :D
20:43 jberger__ damaya, lite vs full is really only about size of application
20:44 damaya Nonetheless, with that said, I don't want it to sound like I am complaining, because I really love this framework and all the work that is being put into it is greatly appreciated.
20:44 jberger__ I only use lite for examples now, I like the full app syntax, but essentially its just syntax
20:44 damaya Ah, OK. I think I am going to migrate my lite apps to full apps, but I wanted to weigh the pros and cons before doing so.
20:44 jberger__ if it helps to see, look at the source for Mojolicious::Lite, you can see that its a really tiny sugar layer
20:45 damaya Great, that makes more sense. I will migrate to a full app then, because I like the syntax better as well.
20:45 jberger__ https://github.com/kraih/mojo/blo​b/master/lib/Mojolicious/Lite.pm
20:45 damaya I will have to look at the link when I am in a GUI. But I will write it down and do so. Thanks jberger.
20:46 damaya Actually, I can just pull source and open it in emacs. Thanks.
20:48 jberger__ and yes, looking at your use-case, I think full would be a good choice
20:51 damaya Thanks jberger__!
20:52 jberger_ Bender, share the love
20:52 jberger_ Bender, spread the love
20:52 jberger_ oh well one op is good enough for me
20:53 damaya exit
21:00 phillipadsmith joined #mojo
21:04 dotandimet joined #mojo
21:05 sixBB joined #mojo
21:08 denis_boyun joined #mojo
21:35 marty joined #mojo
21:50 Adurah joined #mojo
21:55 hpekdemir is there a possibility to use Mojo::IOLoop for each client connecting to a socket? currently everything works in my application, client connects, another one connects, both get same data if same subscription
21:56 hpekdemir but as soon as one of them disconnects (or closes the websocket), the whole socket is closed.
21:56 hpekdemir so currently I reactor->io() on socket. and each client connecting uses this one. is it possible to create a socket for each user?
21:57 hpekdemir so that every user is able to close his own socket.
21:59 hpekdemir I thought of something like for each $self->tx found or connected, spawn a child or something.
23:02 jberger_ sri: I know why I want ango.pm, it would make one-off checks so much easier
23:34 jberger_ sri, batman: the work in progress: https://github.com/jberger/mandel/compare/blocking
23:35 jberger_ batman, you had a failing test to I sent a pull req for that
23:37 Akron joined #mojo
23:50 jberger_ batman, I'm not a fan of the Linuga::Inflect use in dbic, but I think I like this even less: https://github.com/jhthorsen/mandel/​blob/master/lib/Mandel/Model.pm#L48
23:52 Akron I like the new validation mechanism. But how can I set error details in added checks for retrieval with ->error?
23:58 asarch joined #mojo

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