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

IRC log for #mojo, 2014-06-29

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

All times shown according to UTC.

Time Nick Message
00:24 punter joined #mojo
00:30 sujithm joined #mojo
00:53 d4rkie joined #mojo
00:54 d4rkie joined #mojo
01:06 klapperl_ joined #mojo
01:33 gryphon joined #mojo
02:09 sujithm joined #mojo
02:26 KCL joined #mojo
02:41 sujithm joined #mojo
02:58 KCL joined #mojo
03:34 KCL_ joined #mojo
04:20 preaction if i'm writing a blog, should the index page and archive pages not be indexed by the search engine? should i make it so that only the single page, full post is indexed?
04:20 preaction i'm trying to build a good robots.txt and sitemap.xml
04:55 sujithm joined #mojo
05:00 cpan_mojo Statocles 0.016 by Doug Bell - http://metacpan.org/release/PREACTION/Statocles-0.016 (depends on Mojolicious)
05:04 alnewkirk joined #mojo
05:56 Vandal joined #mojo
06:36 mattastrophe joined #mojo
06:38 sujithm joined #mojo
06:56 kyshtynbai joined #mojo
06:58 ryozi_ joined #mojo
07:04 mattastrophe joined #mojo
07:39 sujithm joined #mojo
07:40 sujithm joined #mojo
07:47 basiliscos joined #mojo
08:01 denis_boyun joined #mojo
08:20 dotan joined #mojo
08:37 rem_lex joined #mojo
08:38 dotan joined #mojo
08:41 dod joined #mojo
09:22 mire joined #mojo
09:48 neyasov___ joined #mojo
10:08 d4rkie joined #mojo
10:33 d4rkie joined #mojo
10:57 rawler joined #mojo
10:59 basic6 joined #mojo
11:46 abra joined #mojo
12:51 kyshtynbai joined #mojo
13:24 mire joined #mojo
13:31 gryphon joined #mojo
14:18 cpan_mojo Ado 0.48 by Krasimir Berov - http://metacpan.org/release/BEROV/Ado-0.48 (depends on Mojolicious::Plugin::DSC)
14:26 sri i think this is a problem we really need to address somehow https://groups.google.com/forum/#!topic/mojolicious/hHi5q9QWWLM
14:31 lb should a transaction belong to the connection in the first place_
14:31 lb ?
14:32 sh4 joined #mojo
14:32 sri i don't understand the question
14:33 stephanj is it detectable when the weakened ref is abbadoned?
14:34 sri neither do i understand that one...hmm
14:39 stephanj if i understand it correctly you pass around a weakened reference to $self?
14:44 sri https://github.com/kraih/mojo/blob/master/lib/Mojolicious/Controller.pm#L19
14:45 sri that attribute stores a weakened ref
14:45 sri and is weakened here https://github.com/kraih/mojo/blob/master/lib/Mojolicious.pm#L131
14:45 sri and here https://github.com/kraih/mojo/blob/master/lib/Mojolicious/Routes.pm#L156
14:48 sri a strong ref is being held here https://github.com/kraih/mojo/blob/master/lib/Mojo/Server/Daemon.pm#L186
14:48 stephanj what i wanted to know is, is it possible based on a weakened ref to detect if the referenced object is still active?
14:48 sri as long as the connection exists
14:49 sri question makes no sense to me
14:49 sri what makes an object active?
14:50 stephanj an active object in my eyes is one where the strong ref is still existent
14:51 stephanj active=connection exists inactive/abbadoned=connection closed
14:51 sri huh? if a strong ref exists the object is not garbage collected
14:51 stephanj yea
14:52 stephanj but the error occoures when it is garbage collected or?
14:52 stephanj because weak refs do not count for the garbage collector
14:52 sri the error occurs when it is garbage collected because the connection went away
14:52 stephanj yea
14:52 sri what s your question?
14:52 stephanj so is there a way to tell if it is garbage coleccted beforehand?
14:53 sri please elaborate
14:53 stephanj i.e. before calling $weakref->res is there a way to test if the object $weakref points is garbage collected or not?
14:54 sri $weakref is undef if it has been garbage collected
14:54 sri (which is pretty obvious from the error message)
14:55 stephanj okey, would it feasible to add a check if $weakref is undef in methods to die with a more meaningfull error message/catch the error?
14:56 sri i'm not interested in shitty bandaid hacks
14:56 stephanj ok
14:58 sri i think our biggest problem is that pretty much nobody actually understands the problem
14:59 KCL joined #mojo
15:00 Adurah_ Just an error message in a log, no big deal.
15:04 stephanj sri: true
15:13 mire joined #mojo
15:17 cousin_luigi joined #mojo
15:17 cousin_luigi Greetings.
15:17 purl somebody said Greetings. was anyone awake?
15:17 * cousin_luigi sincerely hopes so.
15:23 sri o/
15:24 * cousin_luigi has a couple of basic questions: how do you grab all the children of a div and populate another div in another file with them?
15:25 cousin_luigi Also how do you pattern-match a href using a substring of the link?
15:26 sri http://mojolicio.us/perldoc/Mojo/DOM#at http://mojolicio.us/perldoc/Mojo/DOM#children http://mojolicio.us/perldoc/Mojo/DOM#append_content
15:32 cousin_luigi sri: thanks, trying
15:33 sri what makes the weaken problem really annoying is that we have to keep a strong ref to $self here https://github.com/kraih/mojo/blob/master/lib/Mojolicious/Controller.pm#L100
15:33 sri $self->tx gets a circular reference there
15:33 sri but it's also the last reference to $self
15:42 kyshtynbai What is the default session expiration period in Mojolicious Lite?
15:45 kyshtynbai 3600.
15:46 good_news_everyon joined #mojo
15:46 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/EiwYwg
15:46 good_news_everyon mojo/master 153e22d Sebastian Riedel: improved error method in Mojolicious::Validator::Validation to return field names when called without arguments
15:46 good_news_everyon left #mojo
15:48 cousin_luigi I'm not quite sure I grasp the distinction between contents and children of a node.
15:51 sri mind the terminology, elements vs nodes
15:51 cousin_luigi right, element
15:52 kyshtynbai Guys where in code should I specify $self->session(expiration => 84600); ? At any sub describing route?
15:53 sujithm joined #mojo
15:58 camelo joined #mojo
15:59 Eke- joined #mojo
15:59 rem_lex joined #mojo
16:26 mire joined #mojo
16:51 bpmedley kyshtynbai, I think so.  Is everything working for you?
17:18 cousin_luigi sri: Those documents are beyond my comprehension.
17:38 bpmedley sri: For the undefined $tx issues, is it a possible workaround to put tx in the stash?
17:39 KCL_ joined #mojo
17:44 jberger Easier to just return early if the tx is not defined
17:48 bpmedley jberger, On a per request basis.  Not as a general fix.
17:48 jberger Right
17:48 bpmedley Oh, I see.   Put a check in the callback for an udefined $tx?
17:50 sri here's a oneliner if anyone wants to hack on the problem
17:50 sri MOJO_LOG_LEVEL=debug perl -Mojo -E 'a(sub { my $c = shift; Mojo::IOLoop->timer(1 => sub { $c->render(text => "test") }) }); my $d = Mojo::Server::Daemon->new(app => app)->start; Mojo::IOLoop->client({port => 3000} => sub { pop->write("GET / HTTP/1.1\n\n\n\n" => sub { shift->close }) }); Mojo::IOLoop->start'
17:51 sri hmm, i guess that can be golfed down a bit
17:52 jberger my ($ua, $tx) = @_; return unless $tx ...
17:52 jberger then again, with sub signatures it could be:
17:52 sri wrong $tx
17:52 sri ok, smaller oneliner
17:52 sri perl -Mojo -E 'a(sub { my $c = shift; Mojo::IOLoop->timer(1 => sub { $c->render(text => "test") }) }); Mojo::IOLoop->client({port => 3000} => sub { pop->write("GET / HTTP/1.1\n\n\n\n" => sub { shift->close }) }); app->start' daemon
17:54 jberger oops, I read the list posting too quickly
17:55 sri posted the oneliner to the list too
17:55 sri render_steps is kind of a neat workaround
17:58 jberger renderstep.depth <-- really a good thought
17:59 sujithm joined #mojo
18:02 crab pop->write!
18:06 crab for some reason, that makes me think of my dad. he has an excellent handwriting. but i don't think he'd approve of backslashes.
18:07 crab (i say "for some reason" because i've seen "pop" a gazillion times without making the same association.)
18:08 nishttal2 joined #mojo
18:08 nishttal2 hello ppl.. where do I tell hypnotoad to listen on 80
18:09 nishttal2 app->config(hypnotoad => {listen => ['http://*:80']}); in the cookbook says use Mojolicious::Lite
18:10 crab doesn't that answer your question, then?
18:10 bpmedley nishttal2, Are you trying to setup a full app with hypnotoad?
18:11 nishttal2 bpmedley, yeah
18:11 nishttal2 crab, i dont want to use Mojolicious::Lite
18:11 bpmedley In sub "startup" use $self->config(hypnotoad ... ).  Does that make sense?
18:11 KCL joined #mojo
18:12 nishttal2 bpmedley, so in myapp.pm file?
18:12 bpmedley Probably so.  Is it the one in lib?
18:13 nishttal2 yes
18:13 crab nishttal: anything you can do with Mojolicious::Lite, you can do with Mojolicious.
18:14 crab you can either call $app->config() from startup, or put a hypnotoad => ... section in your config file (depending on what config file type you use)
18:14 * sri wonders if render_steps has reached the point where it's ready for core
18:15 batman +1
18:15 purl 1
18:15 nishttal2 crab.. i cant seem to access the page.. let me review the wiki again
18:16 bpmedley nishttal2, Are you aware that the startup method is passed an application object?
18:16 batman sri: maybe it need more tests, but i would really like to have it in core
18:17 sri batman: tests are no big deal, i can write those, my main concern is how and where to explain it in documentation
18:17 nishttal2 bpmedley, not really
18:18 batman sri: hm... somewhere in Mojolicious::Guides::Rendering maybe?
18:19 sri batman: you know, the method description in Mojolicious::Controller, and if/how recipes like this should be modified http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Backend_web_services
18:19 batman yes, i really think those kinds of examples should be modified
18:20 sri right, or perhaps even a new recipe in the rendering guide
18:20 bpmedley nishttal2, Basically, the app->... stuff for Mojolicious::Lite goes in the "startup" method.  So, app->config would translate into $self->config in "startup".  I hope I said that decently.
18:20 batman from my experience, Mojo::IOLoop makes it so much harder to make memory leaks
18:20 batman instead of using plain callbacks
18:20 sri you mean delays
18:20 batman yes, that's what i mean :)
18:20 nishttal2 bpmedley, yes you did thanks.. i'm going to re-read some documents
18:20 * batman is not feeling well.
18:21 sri but yea, inside-out storage for callbacks rocks
18:21 batman maybe i should just shut up :P
18:21 rawler joined #mojo
18:21 sri marcus, jberger, crab, tempire: opinion on render_steps in core?
18:22 batman i was thinking about a change to render_steps... could the first callback get $c ?
18:22 * sri is +1-ish
18:22 batman no. nevermind
18:23 batman i was thinking shift->render_steps(sub { my ($delay, $c) = @_; ... }, ... ); but i'm not sure when that would really be useful.
18:23 sri i guess marcus will be +1 too ;p
18:23 sri batman: yea, i doubt it
18:24 batman :)
18:24 batman i like my perldocbrowser: https://github.com/jhthorsen/snippets/blob/master/perl/perldocbrowser
18:24 batman works nicely with ssd disk :)
18:25 nishttal2 how do I stop hypnotoad?
18:25 bpmedley nishttal2, hypnotoad -h is helpful.
18:25 sri human sacrifice
18:26 Eke- joined #mojo
18:26 nishttal2 bpmedley, thanks :-|
18:27 bpmedley nishttal2, There's a lot to take in.  The documentation makes it possible, tho.. :)
18:28 nishttal2 bpmedley, i know you wont believe me but I have seen all mojo casts.. read all guides and wiki.. I think i did more reading than actually trying
18:28 nishttal2 bpmedley, information overload
18:28 crab sri: i'm +1-ish though i'd like to read your explanation
18:28 bpmedley nishttal2, I totaly understand.  Reminds me of when I first started.
18:29 nishttal2 bpmedley, thanks.. i'll try now to bug you with silly questions like these.. I'll read docs again and try stuff at the same time :)
18:30 bpmedley They're not silly.. We all have to learn.  #mojo is friendly.
18:35 nishttal2 ok i'll take you up on that ;-).. so I added the "hypnotoad => {listen => ['http://*:80']}" and hypnotoad started fine at port 80.. how do I similarly tell morbo to start on 80 (after shutting down hypnotoad ofcourse).. I know the command line way to do it was wondering if there was a setting like.. morbo => {listen => ['http://*:80']} ?
18:36 bpmedley nishttal2, morbo -h
18:36 nishttal2 bpmedley, yeah I know the comand line way to do it
18:36 nishttal2 bpmedley, so there is nothing like hypnotoad => {listen => ['http://*:80']} for morbo?
18:37 bpmedley I'm not sure how to programmaticlly set it, unless you modify MOJO_LISTEN or somesuhc.
18:37 nishttal2 bpmedley, ok no biggie.. thanks
18:40 neyasov___ joined #mojo
18:40 nishttal2 where do I open a handle (And connect) to databases so it gets cached and not closed/opened at each request?
18:41 nishttal2 i'm thinking in the startup() function
18:45 sri crab: this is how i would explain it http://pastie.org/9338152
18:46 * sri pokes marcus, jberger, tempire and batman too
18:47 denis_boyun joined #mojo
18:47 mire joined #mojo
18:47 batman s!render_later!render_steps! ..?
18:48 sri heh, nope, but i dislike that part too
18:48 sri http://pastie.org/9338161
18:49 sri no need to link to the individual methods used really, just mention the behavior
18:49 sri description is actually simpler than i expected
18:49 batman yes, i like the second one better.
18:50 batman "Enable automatic..." => "It will cause automatic render..." ?
18:50 batman "Enable automatic..." sounds like something I have to do... could be because my english is not super duper :)
18:51 bpmedley nishttal2, This may help: http://blogs.perl.org/users/joel_berger/2013/10/some-code-ports-to-mojolicious-just-for-fun.html
18:55 sri or maybe render_steps in core is not such a bad idea... having problems making it fit into the guides
18:56 batman what do you mean? "is a bad idea" or "is not"...?
18:56 nishttal2 bpmedley, this is great and exactly what I was looking for.. thanks!
18:56 denis_boyun joined #mojo
19:17 mattastrophe joined #mojo
19:23 mire joined #mojo
19:25 trone joined #mojo
19:28 rawler joined #mojo
20:03 jberger_ joined #mojo
20:05 jberger_ re core render_steps: i was thinking about that earlier
20:07 jberger_ I think it would help people get into the nonblocking stuff more quickly
20:07 jberger_ And for that reason i would be generally be +1
20:09 jberger_ But i think it would be important to document what it does so that as people move to using delays directly that they would know about the error handling etc
20:36 sri jberger: you mean you would do something like this? http://pastie.org/9338379
20:36 denis_boyun joined #mojo
20:43 nishttal2 morbo doesnt seems to reload my app (it was when I was using LITE)
20:53 sri actually i don't like explaining it... there will be a few more internal hacks
20:54 sri the Mojolicious::Plugin::RenderSteps tests are really pathetic
20:54 sri not sure it even works
20:57 sri yea, the finish event is broken
20:58 sri http://pastie.org/9338423 # has to be more like this
21:03 rem_lex joined #mojo
21:13 sri http://pastie.org/9338442 # actually, i guess this version would be more in line with our documentation conventions
21:13 sri less wall of text
21:14 * sri pokes marcus, jberger, crab and tempire again
21:15 marcus joined #mojo
21:23 sri http://pastie.org/9338462 # actual patch without tests
21:35 sri *crickets*
21:37 nishttal2 i'm trying to use placeholder from the stash but getting an error.. please see http://fpaste.org/114219/40407781/ .. can someone take a look
21:40 Eke- joined #mojo
21:44 henq joined #mojo
21:45 nishttal2 someone please help.. i'm new to this.. :(
21:47 KCL_ joined #mojo
21:51 sri http://pastie.org/9338530 # the more i update the more i wonder if render_steps might actually turn out to be harder to learn than plain delays
21:52 nishttal2 sri can you please help me
21:52 sri nishttal2: i'm busy
21:52 nishttal2 doesnt look like anyone else is around
21:52 nishttal2 i see
21:53 preaction nishttal2: what is the error you are getting?
21:54 nishttal2 preaction, page not found.. you can check it at http://54.243.186.226/nishant/home
21:57 preaction your error message says it's navigating to "modulehome", but your code says it should be navigating to "example#home"
21:57 nishttal2 rt.. isnt :module a placeholder
21:58 jberger_ joined #mojo
21:58 nishttal2 so http://54.243.186.226/nishant/home ... should make module = nishant
21:58 jberger_ sri: Looks good to me
21:58 sri jberger_: you really don't think render_steps makes it harder to learn?
21:59 jberger_ It's a fine line
21:59 jberger_ But i think the benefit outweighs that concern
22:00 nishttal2 preaction, if I comment out the hook code then it goes to example#home
22:01 preaction before_dispatch sounds like the routes would not have been consulted yet
22:01 preaction so there would be no module in the stash yet
22:01 nishttal2 preaction, yeah looks like it.. if I replace like 13 with $c->render(text => "Test"); it works
22:02 nishttal2 preaction, so stash is not available in before_dispatch
22:02 preaction no, just the "module" item that you expect to be there because of the route
22:03 nishttal2 preaction, i see.. also is this the best way to redirect un-authenticated requests to the login page.. (thats what I am ultimately tryin to do wtih the before_dispatch)
22:04 preaction i don't know, i've never done it before
22:05 nishttal2 preaction, ok thanks
22:31 TitanOfOld joined #mojo
22:33 TitanOfOld So, this line returns the header value passed "shift->req->headers->{headers}->{$_[0]}->[-1]" when run with morbo, but under Heroku I get another array.
22:34 bpmedley nishttal2, Is your code working now?
22:34 bpmedley TitanOfOld, are they the same version of Mojolicious?
22:35 TitanOfOld Yes.
22:35 bpmedley TitanOfOld, also, are the headers exactly the same?
22:35 preaction TitanOfOld: why are you peeking inside the Mojo::Headers object?
22:35 TitanOfOld preaction, is there a better way?
22:36 sri everything else
22:36 purl i heard everything else was just undercomplicated
22:36 preaction don't peek inside objects like that. there appears to be a header() method that takes a name
22:36 TitanOfOld ?
22:36 preaction there also appear to be individual accessors for a lot of different headers
22:36 preaction http://mojolicio.us/perldoc/Mojo/Headers
22:47 TitanOfOld preaction, thanks! Using the method did the trick.
22:47 TitanOfOld Now I'm consistent in testing and on Heroku.
22:55 nishttal2 bpmedley, yes.. preaction told me that the placeholders are not available in the stash in the before_dispatch callback
22:55 good_news_everyon joined #mojo
22:55 good_news_everyon [mojo] kraih created render_steps (+1 new commit): http://git.io/1PUi4A
22:55 good_news_everyon mojo/render_steps 6ad381a Sebastian Riedel: added render_steps method to Mojolicious::Controller
22:55 good_news_everyon left #mojo
22:55 sri marcus, jberger, tempire, crab: review
22:56 nishttal2 bpmedley, is before_dispatch the best way to redirect un-authenticated requests to the login page?
22:57 bpmedley nishttal2, I use a bridge
22:58 basiliscos joined #mojo
22:58 nishttal2 bpmedley, half of my pages can be visited un-authenticated and the rest have to be authenticated.. thats why I was checking in a callback... would bridge help with that?
22:58 preaction nishttal2: there's an example in Mojolicious::Guides::Growing that uses $r->under() to do it
22:58 nishttal2 preaction, yeah thats for Mojolicious::Lite.. I couldnt translate that to the app
22:58 nishttal2 preaction, I'll try again
22:59 sri uh, it literally gets translated for you in that guide
22:59 preaction nishttal2: http://mojolicio.us/perldoc/Mojolicious/Guides/Growing#Simplified_application_class <- it's in this section
23:02 nishttal2 preaction, sri ... you are right.. I need to read this again! thanks
23:22 henq joined #mojo
23:24 btyler joined #mojo
23:27 punter joined #mojo
23:28 cpan_mojo Statocles 0.017 by Doug Bell - http://metacpan.org/release/PREACTION/Statocles-0.017 (depends on Mojolicious)
23:34 bluescreen joined #mojo
23:37 neyasov___ joined #mojo
23:53 * sri opened a pull request https://github.com/kraih/mojo/pull/639

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