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

IRC log for #mojo, 2014-02-18

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

All times shown according to UTC.

Time Nick Message
00:09 skullbocks joined #mojo
00:19 ilbot2 joined #mojo
00:19 Topic for #mojo is now The fun place to talk about Mojolicious, Perl and the web | http://mojolicio.us | http://irclog.perlgeek.de/mojo/today
00:20 jack joined #mojo
00:24 zM joined #mojo
00:29 bpmedley Before I upload to CPAN and do anything stupid; what do ya'll think of this VHost plugin?   http://pastie.org/8743708
00:30 Akron joined #mojo
00:31 czinczar joined #mojo
00:32 czinczar so how do I know if mojo is using say kqueue on freebsd10?
00:32 Akron bpmedley: Maybe you should wrap a log level specific if-clause before dumping anything - should be costly in a before_dispatch hook I guess.
00:33 czinczar is  there another perl module I need for that?
00:33 Akron Otherwise such a plugin is a good idea!
00:33 bpmedley Akron: Yes, the logging should go.
00:34 d4rkie joined #mojo
00:34 bpmedley As a plus; it appears to work.. :P
00:34 Akron Hehe.
00:35 Akron czinczar: You have to install EV.
00:35 Akron czinczar: Run "mojo version" and you see the optional dependencies.
00:36 dvinciguerra joined #mojo
00:37 russum Is there a way to limit the number of the return fields in Mango's find_one? The cpan page says my $doc = $collection->find_one({foo => 'bar'}, {foo => 1}); but the second parameter {foo => 1} doesn't really do anything whether 1 or 0
00:38 czinczar ah!
00:38 czinczar thx!
00:39 Akron np
00:41 russum the find_one's source code has my ($self, $query) = (shift, shift); so it looks like that projection parameter (if that's what it was suppose to be) is never even being used…
00:41 punter czinczar: Did you find a mojolicious forum?
00:45 yongbin joined #mojo
00:46 gnephiak joined #mojo
00:47 czinczar nop
00:56 beyondcreed joined #mojo
00:57 abra joined #mojo
00:57 jberger russum: https://github.com/kraih/mango/blob/master/lib/Mango/Collection.pm#L78
00:58 jberger projection is passed to find()
00:59 hotsnow joined #mojo
01:00 Stefan joined #mojo
01:01 jberger bpmedley: why not store the configuration in the app's config?
01:02 bpmedley I'm config ignorant.  Can you enlighten me on usage?
01:03 jberger config is just a hash-y attribute on every app
01:03 bpmedley http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Adding_a_configuration_file  <-- Would I just use a section called "vhost" in the app.conf?
01:03 jberger the Config and JSONConfig plugins just are setters
01:03 jberger that's my idea
01:03 bpmedley Moment
01:04 jberger http://mojolicio.us/perldoc/Mojo#config
01:04 jberger its just an idea
01:04 bpmedley It's a good one.
01:04 cpan_mojo Mojolicious-Plugin-VHost 0.01 by Brian Medley - http://metacpan.org/release/BPMEDLEY/Mojolicious-Plugin-VHost-0.01
01:04 jberger I don't hate the idea of a plugin object
01:05 Akron Yep. I often do it that way: https://github.com/Akron/Mojolicious-Plugin-CHI/blob/master/lib/Mojolicious/Plugin/CHI.pm#L15-L17
01:05 Akron The Plugin name is the top name in the config.
01:05 Akron I don't know if theres a best practice for it. Jberger?
01:06 jberger there's always risk of collision I suppose, but the CHI plugin seems fine
01:07 jberger bpmedley: I like the idea of storing (or closing over) a plugin instance when the configuration is really about the plugin, but when the configuration is really about the app, there is a POSSiBLE other way to do it
01:07 jberger again, either way is fine
01:07 Akron Yes - that's why I always use the plugin name. I read you are prefixing stash values with plugin name + '.'. That's a good best practice!
01:07 * jberger pats cpan_mojo
01:08 jberger Akron: yes, I think all plugins should use 'pluginname.<key>' for all its keys
01:08 jberger *stash keys
01:08 Akron I agree. That's a really good advice!
01:09 jberger actually sri++ started it
01:09 * jberger pokes sri
01:09 * jberger listens for a heartbeat
01:09 Akron Ah. ;) Is this somewhere in the doc?
01:10 jberger not as such
01:10 jberger http://mojolicio.us/perldoc/Mojolicious/Controller#stash
01:11 jberger 'mojo.' prefix is reserved for internal use
01:11 Akron But It's \emph{}ed in the plugin writing section of your book, right?
01:11 jberger of course :-)
01:11 jberger oh that's going to be a fun section to write
01:12 Akron Yeah - I know that, but I didn't think of it as "this won't be variablified in your templates".
01:13 basiliscos joined #mojo
01:13 Akron Yes. Plugin writing is so much fun for Mojo. Nearly all my cpan entries are Mojo plugins.
01:13 jberger indeed
01:13 jberger actually I guess I have several non-plugin things too
01:14 jberger I have a Command, a full bundled app, a few utilities: https://metacpan.org/author/JBERGER
01:15 Akron You've got alien::base - how far away of a plugin can you be?
01:15 TitanOfOld joined #mojo
01:15 jberger hahaha, I mean in the Mojo space :-)
01:16 bpmedley https://github.com/brianmed/mojolicious-plugin-vhost/blob/master/VHost/lib/Mojolicious/Plugin/VHost.pm#L12
01:16 jberger you wanna see far away: https://metacpan.org/pod/Physics::UEMColumn
01:16 jberger actually  a few of my favorite CPAN modules are Tie::Select and Tie::Array::CSV
01:17 Akron Ah, okay - yeah, I have commands bundled wth plugins ...
01:17 bpmedley jberger: How does that look?
01:18 Akron You are from the PDL departement, which is quite weird. I guess you are the only element in the intersection of the PDL and Mojo sets on a perl party.
01:19 jberger Akron: while that may seem true, I have been encouraging Mojo use in the PDL world, with the eventual hope for a in-browser REPL
01:20 jberger bpmedley: it does still close over the $vhost instance
01:20 Akron Well - somehow you have to make friends on such a party ... :-P
01:20 jberger bpmedley: maybe that is necessary though
01:21 jberger I'm a people person
01:21 jberger :-)
01:21 czinczar Ima solo worker and best not near people
01:21 czinczar ;)
01:21 Akron In fact I used PDL for some graph statistics in the past. And I kind of really liked ... well ... I am more of a beer person. ;)
01:22 czinczar is there anything like munin in mojo? but simpler? just disk cpu ram maybe open files?
01:22 bpmedley jberger: Sorry, close over the $vhost instance?
01:23 jberger https://github.com/brianmed/mojolicious-plugin-vhost/blob/master/VHost/lib/Mojolicious/Plugin/VHost.pm#L26
01:24 russum jberger: yeah, you are right, but for some reason I'm getting the whole doc instead of only what I want… and I don't really think passing the projection as the second parameter of find/find_one has ever worked for me
01:24 russum jberger: what always worked for me was find()->fields({}), i.e. specifying the projection in the fields, not as the second parameter of find()
01:24 jberger russum: I'm really not a mango expert either, I was just answering your direct question
01:25 jberger russum https://github.com/kraih/mango/blob/master/lib/Mango/Collection.pm#L62
01:25 cpan_mojo Mojolicious-Plugin-VHost 0.02 by Brian Medley - http://metacpan.org/release/BPMEDLEY/Mojolicious-Plugin-VHost-0.02
01:25 russum jberger: ok, cool, thx..
01:25 bpmedley Hrmm; I need to access the per host config every request.  How can I utilze the plugin object in a hook?
01:26 jberger bpmedley: if you have to do that then you have to, many of my plugins close over the instance
01:26 jberger it's just that you are so close to not needing to
01:26 bpmedley Ok, cool.  Thanks for the attention to detail.
01:28 Akron bpmedley: It's also enouh to dereference $c->app once. Although performancewise this should be a minor issue.
01:28 bpmedley I probably should save off $app somewhere.
01:28 jberger bpmedley: https://github.com/jberger/mojolicious-plugin-vhost/blob/master/VHost/lib/Mojolicious/Plugin/VHost.pm
01:28 jberger just a thought
01:28 Akron Yes. The same is true for single quotes instead of double quotes.
01:29 bpmedley jberger: It's cleaner.  Want to do a pull requets so you get credit?
01:29 Akron You could in fact reuse the register scoped $app I guess.
01:30 jberger bpmedley: sure
01:30 jberger wait just a moment
01:32 jberger bpmedley: I almost got it in in time
01:33 Akron The problem I see with the plugin is currently that you have to specify everything in the config, otherwise the defaults aren't triggered.
01:34 bpmedley Akron: Hrmm.
01:34 Akron Well ... not a problem.
01:34 Akron But you could introduce it as a feature.
01:36 Akron It depends on what you want to serve with the vhosts. In case they are completely separated that's fine. But sometimes you want to share the static path and the templates path.
01:37 Akron Just an idea for further improvements. I think the plugin is a very good idea and very useful!
01:37 bpmedley https://github.com/brianmed/mojolicious-plugin-vhost/blob/master/VHost/lib/Mojolicious/Plugin/VHost.pm  <-- VirtualHosts in 33 lines.. :)
01:38 bpmedley Akron: https://github.com/brianmed/mojolicious-plugin-vhost/blob/master/VHost/lib/Mojolicious/Plugin/VHost.pm#L59  <-- In the config file a path or namespace can be shared.
01:38 Akron ;) https://github.com/brianmed/mojolicious-plugin-vhost/blob/master/VHost/lib/Mojolicious/Plugin/VHost.pm#L25 is this line necessary?
01:38 bpmedley Akron: I don't know.  Should it use the $app as closure.  Is that the correct term?
01:39 Akron I don't know if this is necessary or if it otherwie may cause leaks.
01:39 ka2u joined #mojo
01:41 Akron Yes - but you have to specify everything for each vhost. Instead of, e.g., just specifying the routes per vhost while sharin everything else with the app defaults.
01:41 jberger I have a patch for this too :-P
01:41 bpmedley Akron:  That's a good point.
01:41 bpmedley jberger: Patch?
01:41 purl We don't need no stinking patch! or a little wrong, which i just noticed after pushing. fixing now
01:42 cpan_mojo Mojolicious-Plugin-VHost 0.03 by Brian Medley - http://metacpan.org/release/BPMEDLEY/Mojolicious-Plugin-VHost-0.03
01:43 jberger oh, oops, it all got lumped into my #2 pr
01:44 jberger oh well
01:44 hotsnow joined #mojo
01:44 Akron The solution is close to what I do in CHI ... but looks nicer ... :(
01:44 Akron Okay. I will steal it I guess!
01:44 Akron ;)
01:44 czinczar does that vhosts plugin work with the hypnotooooad?
01:44 czinczar :)
01:45 Akron Although I don't like "|| {}" that much.
01:45 Akron If the hypnotoad allows it to be its servant - sure.
01:45 bpmedley czinczar: I can test that, I believe it should.
01:45 Akron purl: What is hypnotoad?
01:45 purl ALL GLORY TO THE HYPNOTOAD!!!
01:45 Akron Oh - yeah - that was it.
01:46 bpmedley http://pastie.org/8743878 <-- Akron, thoughts?
01:47 Akron jbergers solution is shorter and more general - I would adopt his patch.
01:47 bpmedley I agree!
01:48 jberger \o/
01:48 jberger #mojo is really on a roll for code lately
01:48 jberger been a lot of f .... ALL GLORY TO THE HYPNOTOAD
01:48 Akron Or use mine - without non-necessary hash instantiation! :-P
01:49 Akron ALL GLORY TO THE HYPNOTOAD!
01:49 itcharlie joined #mojo
01:50 itcharlie left #mojo
01:52 Akron I think the problem with patches by jberger is ... these are all small steps to world domination by mad scientists! Which is the most delicious kind of world domination on the other hand ... beside world domination by toads.
01:53 zM joined #mojo
01:55 jberger damn you've caught on to me
01:56 Akron It's pretty obvious ...
01:57 czinczar zomg cygwin is working with cpanm
01:57 czinczar amazing
01:57 czinczar now getn perlbrew
01:57 czinczar :)
01:57 Akron jberger: So you want to have a web repl of pdl2?
01:58 jberger Akron: that is an idea
01:58 bpmedley czinczar: Seems to work with hypnotoad
01:59 jberger sadly I haven't put any effort into it
01:59 cpan_mojo Mojolicious-Plugin-VHost 0.04 by Brian Medley - http://metacpan.org/release/BPMEDLEY/Mojolicious-Plugin-VHost-0.04
01:59 Akron So all the visualization stuff would render to a web service?
01:59 jberger it really would just need a wrapper for the Devel::REPL shell, a websocket pass-through and a html5 terminal emulator
02:00 jberger a fancier one would feel more like a notebook ala mathematica
02:00 Akron Never used mathematica, but a web repl of pdl for beginners would be nice.
02:02 beyondcreed joined #mojo
02:02 Akron But wasn't the visualization stuff in PDL using a window system ... ?
02:03 abra joined #mojo
02:05 Akron By the way: bpmedley++
02:05 Akron :)
02:06 czinczar works?
02:06 purl i think works is one thing.
02:06 czinczar wow
02:06 czinczar run 100 websites on 1 toad!!!!
02:06 czinczar yeahheahe!!
02:06 jberger yeah, the newest PDL graphics system is using Prima toolkit
02:06 czinczar I am guna start the websits Ive always wanted
02:06 czinczar www.norecrutiers.com
02:06 czinczar www.politicsangerydebate.com
02:06 czinczar www.massproducedhousing.com
02:07 czinczar www.1lanerotariesarebest.org
02:08 bpmedley czinczar: Cool.  I'm glad you're starting with a modern web framework.
02:09 klapperl_ joined #mojo
02:09 czinczar anyone here ever play AD&D?
02:09 Akron Hypnotoad is also nice running on a raspberry pi. Whenever I'll think about something useful to do with my raspberry, I guess it will be a mojo service ...
02:09 purl okay, Akron.
02:09 Akron purl: Thanks for your agreement.
02:10 Akron jberger: And this can be easily served as images in a web repl?
02:10 Akron jberger: Or using canvas?
02:10 jberger Akron: unfortunately, I don't think so
02:11 jberger much more possible would be the gnuplot bindings
02:11 bpmedley Akron++ jberger++
02:11 Akron Yeah, possibly.
02:23 Akron Have to go. Night!
02:23 jberger Akron: o/
02:23 Akron o/
02:30 gnephiak Does PDL have something like cran?
02:30 gnephiak some finance related package?
02:47 jberger gnephiak: no
02:47 jberger no that I'm aware of
02:47 jberger actually ... it seems that I remember someone working on something
02:48 jberger gnephiak: https://metacpan.org/pod/PDL::Finance::TA
02:48 jberger this is the guy who has started working on something
02:48 jberger it doesn't seem like much yet
02:49 gnephiak jberger: yeah
02:50 gnephiak I recommended my girlfriend to learn R because there are massive amount packages on CRAN
02:51 gnephiak R language itself is actually not easy to learn
02:51 Stefan joined #mojo
02:53 jberger python pandas seems to be useful
02:55 yongbin joined #mojo
03:26 davido_ joined #mojo
03:35 rem_lex joined #mojo
03:38 D4RK-PH0ENiX joined #mojo
04:04 sandeep_ joined #mojo
04:21 jberger batman, btw, I'm just using Mandel for the first time
04:22 jberger I'm mostly liking it, I'm having a few issues with the relationships, but let me see if it's just my understanding first
04:24 thowe joined #mojo
04:26 thowe I'm a bit confused about one of the examples in Guides::Growing...
04:26 thowe At http://mojolicio.us/perldoc/Mojolicious/Guides/Growing#Simplified_application_class
04:26 thowe return $self->session('user') || !$self->redirect_to('index');
04:28 thowe So, does this say return the user or redirect to index?  Or return NOT the redirect to index?  What does the "!" do here?
04:29 jberger thowe: a bridge should return true if the route should continue
04:29 jberger so if there is a user it returns the user, a true value
04:30 jberger if not, it sets up a redirect
04:30 thowe and a redirect returns false?
04:30 jberger and since redirect_to returns the controller, which is itself true, it returns ! $c, or false
04:30 jberger a redirect returns true, but you want to return false, so !
04:31 thowe er, so do you redirect?
04:31 jberger yes
04:31 thowe then...  what does returning anything do?
04:32 jberger the bridge stops, so you would not continue to the protected route
04:32 thowe I don't know what a bridge is
04:32 jberger sorry, we're calling it 'under' here
04:32 jberger under is a type of bridhe
04:32 jberger bridge
04:32 thowe so $logged_in is false?
04:33 jberger no, $logged_in is a bridge that is only usable if you are logged in
04:33 jberger any route that uses it is protected by the session check
04:34 thowe so, this is some kind of "callback"?
04:34 jberger you get that $r is the basic router right?
04:34 jberger $logged_in is a kind of new router
04:34 thowe I get it is a router object, but that doesn't mean I get what that means at any deep level.
04:35 jberger I guess you can think of it as a dispatch-time callback
04:35 thowe I could if I knew what that meant...
04:35 thowe This idea of a callback is new to me.
04:35 thowe I'm not even sure I recognize it
04:36 jberger if that callback returns true, then may proceed to the routes that stem from it
04:36 thowe is that what this is:  $r->under(sub {})
04:36 jberger yes, that sub{} is a callback
04:36 thowe like a lambda function or some such?
04:36 thowe Is that like a functional programming thing?
04:36 jberger thowe what is your level of experience with Perl?
04:37 jberger yes, sub{} is an anonymous subroutine, which is like a lambda (but much more powerful)
04:37 thowe I started learning about a year or more ago.  I have written some simple stuff in Catalyst
04:38 thowe So $logged_in is a bridge route?
04:38 jberger anyway, when you request /protected first that sub gets called to check if you are allowed to proceed
04:38 jberger yes
04:38 thowe Oh, you said that
04:39 jberger if you are allowed, you move to the controller for /protected, if not you are redirected back to the index page
04:39 thowe I get that that is the intended functionality right away.  What I didn't grasp was why it would work.
04:39 jberger right
04:39 jberger its all about the return value
04:39 jberger return true and proceed, return false and stop
04:39 thowe but it would always be true....
04:40 thowe Er no... right
04:40 jberger if you only did that though, the client would get some kind of error
04:40 thowe but you don't stop, you go to index.
04:40 jberger so by setting up a redirect, its prettier
04:40 jberger its a very terse line
04:41 thowe I'm trying to wrap my head around how you return false and also redirect.
04:41 jberger that could easily be several lines
04:41 jberger redirect doesn't immediately redirect
04:42 jberger that's why you will see return $c->redirect_to(...) when you want to redirect early
04:42 thowe so, when does the redirect happen?
04:42 jberger think of it as telling the server to send a 302 if nothing else happens
04:42 jberger once nothing gets rendered
04:43 thowe Oh, so it is set up and ready to trigger if nothing else happens first...  Like a ready to fire default action.
04:43 damaya joined #mojo
04:44 jberger right
04:44 damaya bpmedley, I seem to be maxing out at 215,000 JSON requests per 30 seconds on this server
04:44 damaya It's not the T5
04:44 thowe Okay...  Well, I'll try to keep that in mind as I fill in more context...
04:44 damaya But it does have 12 Xeons with 128GB memory
04:45 damaya Maybe it is due to my latency... 15.96ms
04:46 jberger thowe: I actually remember when that line was written, I thought it was terse then too
04:48 jberger unless ( $self->session('user') ) { return $self->redirect_to('index') }
04:48 jberger oh even that wont work
04:48 jberger unless ( $self->session('user') ) { $self->redirect_to('index'); return 0 }
04:48 jberger then return 1
04:49 jberger anyway I'm headed to bed
04:49 jberger o/ all
04:50 thowe thanks
04:51 damaya \o
05:05 damaya well, on my system mojolicious beats go by 7,000 requests on the json test
05:09 crab you need gojolicious
05:09 thowe sounds like a new yogurt craze.
05:10 thowe or wolfberry yogurt
05:10 d4rkie joined #mojo
05:33 jack joined #mojo
06:20 phillipadsmith joined #mojo
06:29 bpmedley damaya: How many workers are you using?  Are the CPUs maxed in top?
06:36 damaya No, CPUs are not maxed. I was using 30 workers.
06:36 purl okay, damaya.
06:37 bpmedley In wrk or in mojolicious?
06:37 damaya and -t30 -c30 with wrk
06:37 bpmedley Are you using hypnotoad?
06:37 damaya Yes, hypnotoad, not morbo
06:38 damaya The best I was able to get was 235,000
06:38 damaya I requested the server today, so I should get it some time this week
06:40 bpmedley How many cores does the Xeon have?
06:40 damaya holy shit, now I am hitting my CPUs hard
06:40 damaya and wtf, 202,000
06:40 damaya I wonder if it is a limit of something
06:41 damaya http://ark.intel.com/products/47916/intel-xeon-processor-x5680-12m-cache-3_33-ghz-6_40-gts-intel-qpi
06:41 damaya not the nicest
06:41 damaya oh wait, there are 4 cpus
06:41 damaya haha, ok, well that may be my problem then
06:41 bpmedley cat /proc/cpuinfo| grep ^processor | wc -l
06:42 damaya 48
06:43 bpmedley Ok; try 96 workers..
06:43 damaya model name: Intel(R) Xeon(R) CPU           X5680  @ 3.33GHz
06:43 damaya ok, do I also do -c96 -t96 then?
06:43 damaya for wrk
06:43 bpmedley Sure, lets try that.
06:44 damaya 96 threads and 96 connections
06:44 damaya it's going
06:45 damaya 267299
06:45 bpmedley Craziness.  How did top look?
06:45 damaya I would expect much better results, but I'm getting roughly the same for the go test
06:45 cfedde joined #mojo
06:46 damaya well, with 96 top was going pretty good... with 250 (tried just a bit ago) top wasn't even refreshing anymore
06:46 bpmedley Oh, you're running the go benchmark on the same box?
06:46 dabudabu What does "Max CPU Configuration" mean on the Intel specs page?
06:46 damaya not at the same time.
06:47 damaya It means the max # of CPUs per mobo
06:47 bpmedley However, you are physically running go on the box every so often?  Sorry to be pedantic - I wasn't sure if you were running go or reporting other results.
06:47 damaya yeah, I have run it a few times
06:47 bpmedley That's cool.
06:47 damaya it out benchmarks go by a few thousand
06:48 bpmedley That's unexpected and awesome.
06:48 dabudabu so you have more than one mobo?
06:48 damaya I will wait for the other server, there may be something wrong with this one.
06:48 damaya dabudabu, why do you say that? I don't know the configuration of the inside of the box.
06:48 damaya I mean, beyond just what I can see at the OS level.
06:50 dabudabu Hmm, you've got 6 cores per CPU, with hyperthreading 12 cores, sort of, so you should have four CPUs, no?
06:50 damaya yeah, I believe it is 4 cpus.
06:50 damaya I just looked at the page and noticed it says max CPUs 2, so not sure how this is being accomplished.
06:51 damaya I don't know Oracle servers very well
06:52 bpmedley cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l
06:53 damaya 4
06:53 bpmedley My understanding is you have 4 CPU sockets
06:54 damaya I honestly have no idea. I will actually need to open this thing up to see what is going on, because now I'm puzzled.
06:54 damaya Is Max CPU a limitation of the CPU itself, or the motherboard?
06:54 bpmedley Dunno.
06:55 Vandal joined #mojo
06:55 damaya I don't know either. Now and then I get servers that never make it out the door (prototypes), and I've seen some other odd things; but nothing specific to intel, mostly stuff about Oracle's ILOM being really different, stuff like that.
06:56 damaya I get the servers from what is basically our recycle pile. I'm not allowed to take them out the door, but I set them up here and mess around with them, such as messing around with Puppet, etc.
06:56 dabudabu Please tell us when you do find out~
06:57 damaya Yeah, I will. If there are 4 cpus in there I'll take a picture so I don't sound full of shit :D
07:01 dabudabu The best I've had access to was 32 Opterons w/ 64 GB of RAM (but two of them)
07:01 bpmedley dabudabu: What did you do with 'em?
07:02 dabudabu Calculated distance tables with openstreetmaps
07:02 dpetrov_ joined #mojo
07:02 bpmedley Sweet
07:02 dabudabu Didn't take that long in the end
07:02 damaya I have a decent server at my house but it sounds like a jet and I can do nothing with it. I think I'm just going to sell it on EBay or something. You don't realize how loud a server really is until you boot it up in your bedroom.
07:08 fhelmber_ joined #mojo
07:22 skullbocks joined #mojo
07:32 batman joined #mojo
07:32 elvis joined #mojo
07:42 dod joined #mojo
07:52 mire joined #mojo
07:52 Negor|2 Is it possible to set default index route?
07:54 bpmedley Negor|2: For example, set the route for http://site.com?
07:55 Negor|2 yep
07:56 bpmedley Negor|2: $r->get('/')->to(controller => 'Index', action => 'slash');  <-- That's my favorite
07:56 basiliscos joined #mojo
07:56 batman joined #mojo
07:56 elvis joined #mojo
07:56 bpmedley Negor|2: https://github.com/brianmed/InfoServant-Feeds/blob/master/docroot/info_servant/lib/InfoServant.pm#L103
07:57 batman jberger: it's not impossible i screwed up with the relationships :/
07:57 batman jberger: let me know if you want to discuss anything
07:59 denis_boyun joined #mojo
07:59 eseyman joined #mojo
08:03 mire joined #mojo
08:06 kwa bpmedley: Or, if you cba creating a module: $r->get('/')->to(cb => sub { shift->render(text => 'roots and levis') });
08:06 bpmedley Yes, lots of options.. :)
08:06 bpmedley Negor|2: Do these make sense?
08:07 kwa I use that for my robots.txt :)
08:07 rawler joined #mojo
08:07 Negor|2 bpmedley: thx, thats it
08:10 dod joined #mojo
08:13 Stefan joined #mojo
08:19 sue joined #mojo
08:34 laouji joined #mojo
08:37 odc joined #mojo
08:45 mire joined #mojo
08:55 trone joined #mojo
08:59 mire joined #mojo
09:03 jack joined #mojo
09:06 dod joined #mojo
09:06 eugen_ joined #mojo
09:09 fhelmbe__ joined #mojo
09:11 sue left #mojo
09:12 GabrielVieira joined #mojo
09:19 Andy2 joined #mojo
09:23 punter joined #mojo
09:25 maxhq joined #mojo
09:31 dotan1 joined #mojo
09:41 ver joined #mojo
09:59 laouji joined #mojo
10:03 bpmedley http://pastie.org/8744817  <-- Seems to be a superior way to do vhosts for a few sites.  I wonder if Mount could be made dynamic.
10:05 bpmedley Appears to just work with hypnotoad, starman, daemon, and presumably other deployment options
10:06 Jonneh joined #mojo
10:08 lukep joined #mojo
10:19 bc547 joined #mojo
10:29 dod joined #mojo
10:59 dvinciguerra joined #mojo
11:02 sujithm joined #mojo
11:18 irq joined #mojo
11:31 denis_boyun joined #mojo
11:59 d4rkie joined #mojo
12:02 gnephiak can "under" used in Mojolicious::Controller?
12:03 gnephiak I have several methods that checks if request is a json, if not, then return a json indicates error
12:09 sujithm joined #mojo
12:10 d4rkie joined #mojo
13:04 kanishka joined #mojo
13:12 test123 joined #mojo
13:13 Stefan joined #mojo
13:18 dvinciguerra joined #mojo
13:19 bpmedley gnephiak: You might try: http://mojolicio.us/perldoc/Mojolicious/Guides/Rendering#Content_negotiation
13:37 jberger joined #mojo
13:41 skullbocks joined #mojo
14:04 eugen__ joined #mojo
14:06 jberger batman: in HasMany.pm shouldn't line 99 be using the accessor rather than the foreign_field?
14:08 batman i'm not sure if i follow.
14:08 batman can you tell me what you mean it should look like jberger ?
14:09 bpmedley http://pastie.org/8744817 <-- jberger thoughts on deployment with this?
14:10 jberger $obj->data->{$self->accessor} = ...
14:11 jberger If I have two relationships to the same table, using anything but the accessor will overwrite the other
14:12 jberger bpmedley out of my league
14:13 bpmedley Awright, who might have an opinion?
14:14 jberger Someone with more deployment expertise
14:14 batman jberger: but... $obj is the related object..?
14:14 batman jberger: so if $doc has many $obj, then $obj can only have one $doc
14:14 batman that's what i'm hoping for at least :)
14:15 jberger Hmmmm
14:16 jberger I have a class of users which has many threads
14:16 jberger Each thread has one creator
14:16 batman yup. then $user has many $thread
14:16 batman should just work... doesn't it..?
14:16 jberger On the thread data I end up with a key user not creator
14:17 jberger So if the thread also had a moderator
14:17 batman oh. do you worry about the autogenerated keys?
14:17 jberger Yes
14:18 batman ah! that's another issue. wait a sec...
14:18 skullbocks joined #mojo
14:18 bpmedley batman: How does http://mojolicio.us/perldoc/Mojolicious/Plugin/Mount compare to toadfarm?
14:19 batman bpmedley: toadfarm doesn't require code.
14:19 jberger I would think the keys should be the same as the accessor in the belongs to class
14:20 jberger Yes my original  suggestion is probably wrong too, it used the has many side's assessor
14:20 batman it's been a while...
14:20 batman i think my solution is that a User, Creator and Moderator is not the same thing
14:21 * batman need to think
14:21 sujithm joined #mojo
14:21 bpmedley batman: That's cool; can toadfarm change ENV per app?
14:22 jberger Right, but as they all point to a user class, it seems that they all get the same key, no?
14:22 batman jberger: let me try it out. *brb*
14:22 jberger Oh you would make different classes for each?
14:22 batman bpmedley: no. the reason is %ENV is messed up.
14:22 bpmedley Sorry, messed up?
14:22 batman jberger: maybe. i might be off.
14:23 batman bpmedley: how will you change %ENV in an async application?
14:23 batman bpmedley: your paste will never work
14:23 bpmedley It seems to
14:23 batman because you do blocking.
14:25 batman bpmedley: %ENV + blocking = one jumpy ride downtown buggywill.
14:25 batman buggyville? :)
14:25 * batman doesn't know. but it's going to be awful
14:26 bpmedley I really know know what will happen or expect if I set %ENV in an async callback.
14:26 bpmedley know know => don't know
14:27 batman i know exactly what will happen. at least if you add concurrency.
14:27 batman you're going to mess up one of the databases
14:27 batman or whatever %ENV is doing.
14:27 batman that's why we have stash(). sharing global stuff just doesn't work.
14:28 bpmedley Hrmm.  I need to figure out a clean way for my DBX.pm to access the stash.
14:29 batman app->helper(dbx_my_hostname => sub { state $dbx_my_hostname = DBI->connect() }); # ?
14:30 batman or app->helper(db => sub { shift->stash->{dbh} ||= DBI->connect($self->stash->{dsn}) });
14:30 batman note! DBI sucks. use something else so you don't get awful error messages
14:30 batman something else = dbix-connector, dbic, ...
14:30 Stefan joined #mojo
14:31 bpmedley I'm using DBIx::Connector
14:31 batman bpmedley++
14:33 batman jberger: does this mean i've got it backwards? do i need to reverse BelongsTo, HasOne and HasMany?
14:33 batman will that make it right?
14:33 batman jberger: my head is spinning :(
14:33 jberger That seems like a big step
14:34 batman why? any of these changes will break things.
14:35 jberger I'll have to look further
14:35 batman yeah. me as well...
14:35 bpmedley What are ya'll talking about?
14:35 batman bpmedley: Mandel.pm
14:35 russum left #mojo
14:35 jberger I'm on the train now, its too hard for a real code dive
14:35 batman i would rather break things a lot now and then have it right, then fixing it a little by little
14:35 batman jberger: no problem. i'm super tired, so my head is barely working.
14:36 jberger Cool, let's reconvene later
14:36 batman :)
14:36 jberger Me too
14:36 jberger # breaking things
14:38 jberger Actually what about one more arg to has_many?
14:39 batman jberger: it depends... if all is messed up, then i want to reverse them.
14:39 batman if only this is, then we can fix it
14:39 jberger has_many 'thread', class, 'creator'
14:39 batman yup
14:40 jberger Cool, sleep well, we'll talk soon
14:41 batman actually. that is already supported.
14:41 batman has_many owners => 'MyModel::Person' => (foreign_field => 'foo');
14:43 GabrielV_ joined #mojo
14:43 batman jberger: ^
14:45 jberger Oh! Will look
14:45 skullbocks joined #mojo
14:45 batman https://github.com/jhthorsen/mandel/blob/master/lib/Mandel/Model.pm#L157
14:46 batman just improved documentation. not sure when i will release it
14:50 batman jberger: let me know, and i will release it. it has one nice change: sub _build_data {} for default values in Mandel::Document
14:53 batman ...not related to relationships :)
14:57 sh4 joined #mojo
14:58 batman btw: it's 4pm, so i'm not going to bed just yet.
14:58 batman just overloaded by the 5000 loc diff in one day...
14:58 batman s/loc//
14:59 kanishka joined #mojo
15:00 btyler joined #mojo
15:06 Stefan joined #mojo
15:13 good_news_everyone joined #mojo
15:13 good_news_everyone [mojo] kraih pushed 2 new commits to master: http://git.io/twMnYQ
15:13 good_news_everyone mojo/master d0a7f5a Sebastian Riedel: document and test application access through mount plugin
15:13 good_news_everyone mojo/master 7c943f8 Sebastian Riedel: fixed bug in "user_agent_online.t"
15:13 good_news_everyone left #mojo
15:15 sh4 joined #mojo
15:18 good_news_everyone joined #mojo
15:18 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/3pc_lw
15:18 good_news_everyone mojo/master 7673fb0 Sebastian Riedel: more verbose bridge examples in growing guide
15:18 good_news_everyone left #mojo
15:25 gryphon joined #mojo
15:35 rem_lex|pivo joined #mojo
15:36 fhelmber_ joined #mojo
15:36 marty joined #mojo
15:36 meshl joined #mojo
15:37 marty joined #mojo
15:39 marty_ joined #mojo
15:46 skullbocks joined #mojo
15:56 sujithm joined #mojo
16:04 skullbocks joined #mojo
16:08 asarch joined #mojo
16:32 skullbocks joined #mojo
16:40 marty joined #mojo
16:44 tianon joined #mojo
16:45 fhelmber_ joined #mojo
16:48 bpmedley batman: I removed the hook requirement; now things should be less fickle.  I need to update some code based on my understanding of non-blocking; here is the paste: http://pastie.org/8745900
16:50 batman bpmedley: what am i looking at?
16:50 bpmedley Sorry, can you think of any further changes I might want to make?
16:50 batman no idea which feature set you're looking for :(
16:50 bpmedley Good point, so no obvious bugs like the $ENV thing..
16:50 batman i got what i want in toadfarm, so i'm not sure what to tell you...
16:51 batman no, that's good :) (no env)
16:52 batman i just don't want to code my vhosts, i just want to describe them... (might not be a big difference, but still)
16:53 bpmedley That makes sense.  I may switch to toadfarm after I figure it out.  I had forgotten about it, so I went a different route.
16:53 GabrielVieira joined #mojo
16:56 batman :)
16:56 batman that's fine. your module is far from useless :)
16:56 batman i could even use it in Toadfarm...
16:57 bpmedley Cool stuff
16:59 batman bpmedley++ # making stuff
17:09 fhelmber_ joined #mojo
17:15 maxhq joined #mojo
17:37 GabrielV_ joined #mojo
17:44 hummeleBop joined #mojo
17:45 kanishka joined #mojo
17:49 mire joined #mojo
17:57 Jonneh joined #mojo
18:01 gryphon joined #mojo
18:01 irq joined #mojo
18:02 fhelmber_ joined #mojo
18:06 mire joined #mojo
18:07 sujithm joined #mojo
18:11 gryphon_ joined #mojo
18:13 Stefan joined #mojo
18:15 punter joined #mojo
18:15 denisboyun joined #mojo
18:16 gryphon_ joined #mojo
18:45 irq_ joined #mojo
18:57 Stefan joined #mojo
19:04 skullbocks joined #mojo
19:13 skullbocks joined #mojo
19:13 trone joined #mojo
19:46 denis_boyun_ joined #mojo
19:53 skullbocks joined #mojo
19:57 Stefan joined #mojo
20:13 irq joined #mojo
20:22 meshl joined #mojo
20:34 denisboyun joined #mojo
20:35 Stefan joined #mojo
20:43 bpmedley_ joined #mojo
20:58 sujithm joined #mojo
21:06 Stefan joined #mojo
21:10 lukep joined #mojo
21:16 skullbocks joined #mojo
21:29 basiliscos joined #mojo
21:37 Stefan joined #mojo
21:38 Adura joined #mojo
21:41 mire joined #mojo
21:41 skullbocks joined #mojo
22:18 Stefan joined #mojo
22:23 Stefan joined #mojo
22:23 GabrielVieira joined #mojo
22:28 beyondcreed joined #mojo
22:50 rem_lex joined #mojo
22:52 paladinn joined #mojo
23:25 good_news_everyone joined #mojo
23:25 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/hIyhrw
23:25 good_news_everyone mojo/master 85fe227 Sebastian Riedel: added decode_json and encode_json methods to Mojo::JSON
23:25 good_news_everyone left #mojo
23:43 dvinciguerra joined #mojo
23:46 good_news_everyone joined #mojo
23:46 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/EyQ5aQ
23:46 good_news_everyone mojo/master e025126 Sebastian Riedel: fixed small decoding error bug in Mojo::JSON
23:46 good_news_everyone left #mojo
23:58 gryphon joined #mojo

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