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

IRC log for #mojo, 2015-07-21

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

All times shown according to UTC.

Time Nick Message
00:25 cpan_mojo Mojolicious-Plugin-Log-Elasticsearch-1.152020 by JUSTIN https://metacpan.org/release/JUSTIN/Mojolicious-Plugin-Log-Elasticsearch-1.152020
01:10 frederico joined #mojo
01:49 disputin joined #mojo
01:59 disputin joined #mojo
02:03 noganex_ joined #mojo
02:04 mattastrophe joined #mojo
02:22 berov joined #mojo
02:27 dvinciguerra joined #mojo
02:40 hshong joined #mojo
02:46 dvinciguerra joined #mojo
03:19 jb360 joined #mojo
03:35 zivester joined #mojo
04:45 Kogurr joined #mojo
04:54 kaare joined #mojo
05:27 jzawodn joined #mojo
05:55 Vandal joined #mojo
06:30 Lee joined #mojo
07:03 dod joined #mojo
07:03 AndrewIsh joined #mojo
07:06 dod joined #mojo
07:07 dod joined #mojo
07:17 trone joined #mojo
07:34 eseyman joined #mojo
07:49 amon joined #mojo
08:17 berov joined #mojo
08:27 mattastrophe joined #mojo
08:31 inokenty joined #mojo
09:14 jontaylor joined #mojo
09:38 dotan joined #mojo
09:40 inokenty joined #mojo
10:43 Craftsmanship joined #mojo
10:44 Craftsmanship I'm still having some troule navigating the docs, When i'm looking at ::Request, i woudl like to be able to see how I get one out of mojolicous (::Lite or otherwise)
10:45 Craftsmanship the links only seem to go "fowards" and not backwards so much
10:45 Craftsmanship C<< ->get_foos >> - returns the L<Mojolicous::Whatever::Foos> object for the current request
10:46 Craftsmanship but there is no matching "you can get this by calling C<< $your_mojo_app->get_foos() >>
10:46 bpmedley Craftsmanship: Have you tried the search?
10:46 Craftsmanship which one is /the/ search?
10:47 bpmedley http://mojolicio.us <-- Right next to "Twitter"
10:48 Craftsmanship oh, sure.
10:48 Craftsmanship that's the same one the default error page links to, i believe.
10:49 Craftsmanship My real problem is that I don't quite understand how request/responses happen in mojo, maybe i've just not read the thing that makes it click for me
10:50 Craftsmanship so, search for "request" and tell me how helpful the list is.
10:50 Craftsmanship -> http://mojolicio.us/perldoc/Mojo/Message/Request ...
10:50 Craftsmanship it explains the request object, but not where I might get one if I wanted it.
10:51 bpmedley I see.  Are you familiar with Mojo::Transaction?
10:51 Craftsmanship I have heard of it.
10:52 bpmedley $c->tx->req and $c->tx->res, I believe.
10:52 Craftsmanship ah!
10:52 Craftsmanship is $c the thing with ->moniker on it?
10:52 Craftsmanship (the application)
10:52 Craftsmanship or ...
10:52 bpmedley $c is the controller
10:53 Craftsmanship that to me is not clear from the docs either.
10:53 bpmedley http://mojolicio.us/perldoc/Mojolicious/Controller <-- A very handy object
10:53 Craftsmanship yes - some of them are passed to things at times
10:54 Craftsmanship my confusion about them has lead to me calling them $self sometimes, and I believe I may have mistakenly called some of them $app
10:55 bpmedley I understand.  It took me a while to grasp some of the contexts / objects of Mojolicious.
10:55 Craftsmanship the docs for ::Transaction also explain the transaction object, but not how to get one
10:55 Craftsmanship They all assume you started in the right place, and followed the right path to happen upon the things
10:56 Craftsmanship I don't have a tx in startup, do I?
10:56 Craftsmanship that would be silly.
10:56 bpmedley Basically, what you need is this: startup gets the "app" object; a route gets the "controller"; a helper varies depending on how it's called, I believe.
10:57 pink_mist you have a tx in your routes
10:57 pink_mist or controller
10:57 purl controller is, like, all fine until someone writes another app that uses the same db/model
10:57 Craftsmanship right,
10:57 Craftsmanship I'm XY'ing pretty hard on this, but only because these other bits of machinery are interesting.
10:57 Craftsmanship my routes...
10:58 Craftsmanship I'm not sure how I could be in them... I guess that applies to chained or laddered(?) routes...
10:58 bpmedley I'm confused.  What do you mean by "not sure how I could be in them"?
10:59 bpmedley Are you referring to how a route is invoked?
10:59 Craftsmanship pink_mistyou have a tx in your routes  # i'm not sure when I would find my self /in/ routes
11:00 Craftsmanship my routes look like this: $r->get('/latest')            ->to('post#latest');
11:00 Craftsmanship I am a simple man, with a simple application.
11:01 bpmedley Craftsmanship: Are you referring to how the code in Post::latest gets called?
11:02 Craftsmanship no, that's fine.
11:02 bpmedley Are you referring to the object layout?
11:03 pink_mist Craftsmanship: no that's not fine. that's when you're in your route
11:03 Craftsmanship I am just trying to figure out what pink_mist means by "having tx in my route" ...
11:03 Craftsmanship oh.
11:03 bpmedley $c->tx
11:03 Craftsmanship oh, so there are callbacks in there
11:03 Craftsmanship some place, where i'm passed $c
11:03 bpmedley Moment
11:03 Craftsmanship (a $c that has a tx)
11:04 bpmedley https://github.com/kraih/mojo/blob/master/lib/Mojolicious/Controller.pm#L13 <-- Does that make sense?
11:05 bpmedley http://mojolicio.us/perldoc/Mojo/Base#has
11:05 Craftsmanship yes.
11:06 Craftsmanship Lovely!
11:06 Craftsmanship so, my real question is about generating proper urls to my application
11:06 Craftsmanship (but this talk of machinery has been very helpful)
11:07 bpmedley http://mojolicio.us/perldoc/Mojolicious/Controller#url_for <-- Probably this
11:07 Craftsmanship it's just $c->url_for, and that magically takes care of sticking the hostname back in
11:07 Craftsmanship in practice, do i have to care about that kind of thing?
11:07 illywhacker joined #mojo
11:07 Craftsmanship i'm (still) building an atom feed, so i think i need to have absolute urls
11:07 bpmedley http://mojolicio.us/perldoc/Mojo/URL#to_abs <-- thoughts?
11:08 bpmedley Perhaps a more concrete example?
11:08 pink_mist urls to your own domain doesn't need the hostname put in them at all
11:08 Craftsmanship I think Atom wants that.
11:08 Craftsmanship the validator complians about stuff not being absolute urls
11:08 pink_mist oh, atom ... then look at the template I showed you yesterday or the day before, whenever that was
11:08 Craftsmanship (and it makes sense that someone downloading a list of posts would need the domain in it)
11:09 Craftsmanship it canonises its own urls
11:10 bpmedley Craftsmanship: Do you see the to_abs in the url_for examples?
11:10 Craftsmanship https://metacpan.org/source/PREACTION/Statocles-0.052/share/theme/default/blog/index.atom.ep
11:12 pink_mist the $site->url() is here: https://metacpan.org/source/PREACTION/Statocles-0.052/lib/Statocles/Site.pm#L348
11:12 Craftsmanship I'll have a play with it (and rip out my url_to_me helper - which I knew I didn't need, but built to avoid that yak)
11:13 Craftsmanship right, $site->url is the result of that application not having a request at the time it generates the url
11:13 Craftsmanship ( because it's static / offline )
11:20 stuart joined #mojo
11:37 dvinciguerra joined #mojo
11:39 cpan_mojo Mojolicious-Plugin-Log-Elasticsearch-1.152021 by JUSTIN https://metacpan.org/release/JUSTIN/Mojolicious-Plugin-Log-Elasticsearch-1.152021
12:01 neilhwatson joined #mojo
12:27 mattastrophe joined #mojo
12:43 Vandal joined #mojo
12:48 cpan_mojo MojoX-Tree-0.03 by KOSTYA https://metacpan.org/release/KOSTYA/MojoX-Tree-0.03
13:06 zivester joined #mojo
13:10 mattastrophe joined #mojo
13:11 hernan605 joined #mojo
13:14 dod joined #mojo
13:21 gryphon joined #mojo
13:43 dvinciguerra joined #mojo
14:12 mudler joined #mojo
14:58 CHYC joined #mojo
15:17 Adura joined #mojo
15:19 lluad joined #mojo
15:40 cpan_mojo MojoX-Tree-0.04 by KOSTYA https://metacpan.org/release/KOSTYA/MojoX-Tree-0.04
15:46 jontaylor joined #mojo
15:47 disputin joined #mojo
16:05 Kogurr joined #mojo
16:10 PryMar56 joined #mojo
16:27 jberger batman, eeeep https://github.com/jhthorsen/mojolicious-plugin-linkembedder/issues/21
16:29 thowe joined #mojo
16:31 thowe I'm having trouble understanding exactly what's happening in some of the REAL-TIME WEB cookbook examples.  Does someone have a firm grasp of event loops and how the UA works in a non-blocking way?
16:32 thowe I know asking to ask is frowned upon, but I kind of need a conversation instead of a quick answer...
16:33 thowe First of all, the non-blocking ua examples I see seem to be accessing external web resources, is it different to instead use it to access URLs that are within the same app?
16:34 jberger thowe: I have a blog series that would get you started
16:35 jberger http://blogs.perl.org/users/joel_berger/2013/10/writing-non-blocking-applications-with-mojolicious-part-1.html
16:35 thowe Yeah, I was looking at that, but (at least last night) I couldn't seem to get any clarity from it...
16:35 jberger start there, its three parts
16:35 thowe Like, I'm confused by this: http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Synchronizing-events
16:35 jberger accessing your own urls is kinda naughty and you have to do it just right to have it work
16:36 jberger very likely to do something wrong and block yourself
16:36 thowe So, web services should be provided by a different process?
16:36 jberger what are you trying to do
16:36 thowe understand
16:36 jberger in that case, yeah, find an external service that you want to use as your data source for learning
16:36 thowe I don't have a specific use case, but if I don't understand I don't know when I shoul dbe using...
16:37 jberger once you get accustomed to non-blocking, then you can try to do it on your own service
16:37 jberger but even then that's usually the wrong way to do things
16:37 jberger find some handy web api
16:37 jberger metacpan
16:37 purl metacpan is one of the best stuff
16:37 pink_mist I agree purl
16:37 thowe One example for me might be to supply json that came from my database for different things like service details.  I'm wondering if the user-facing app should be different from the app supplying the services.
16:38 thowe Also, the syntax like this hurts my head: $c->ua->get($url->clone->query({q => 'mojo'})   => $delay->begin);
16:38 jberger thowe: in that case, you shouldn't need to access your own api server
16:39 jberger I guess it depends on how you architecture it
16:39 jberger independent microservices is one way, and in that case you would have  separate servers
16:39 thowe OK, but why shouldn't I have to?  What have I lost?  What if it takes a long time to put those details together?  Should I just worry about the database call being non-blocking?
16:39 jberger otherwise, you want some model layer that can either be served to the client as json or used as perl data structures internally
16:40 thowe Well, that would be my normal inclination, but I'm afraid that's out of ignorance.
16:40 jberger yes, you probably want your db access to be non-blocking
16:40 thowe I feel I'm missing some panacea of good design by not grasping these things.
16:40 jberger especially for long-running queries
16:41 jberger what non-blocking buys you is handling more clients with less servers
16:41 thowe in this example: http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Synchronizing-events
16:41 jberger its cost is having to think in non-blocking terms
16:42 thowe what exactly does haveing $delay->begin as the hash value do?
16:42 pink_mist $delay->begin returns a subroutine-reference
16:42 jberger I explain delays in my articles
16:42 thowe It seems to suggest that you can do this multiple times and then have them passed to the next sub?
16:43 pink_mist when that subroutine-reference is called, the next 'step' in the delay is executed
16:43 jberger also, http://mojolicio.us/perldoc/Mojo/IOLoop/Delay
16:43 thowe They just seen to be available?  like, they aren't returned values though?
16:43 thowe Yeah, the delay docs are just hurting my head...  I'm getting lost in syntax
16:43 jberger the short version is delays manage control flow for non-blocking systems
16:44 thowe Yeah, I get that...  But how are they available n $_ in the next sub?
16:44 jberger delay->begin returns a callback that organizes things
16:44 thowe er in @_
16:44 jberger thowe: are you already familiar with continuation-passing style for single non-blocking calls?
16:44 thowe how are those two calls pulled ou in the next sub here: my ($delay, $mojo, $minion) = @_;
16:45 jberger $ua->get($url => sub { # do things with @_ });
16:45 thowe jberger, No, I don't even know what you just said :P
16:45 jberger you should learn that first
16:45 thowe How do I learn that
16:45 jberger the example above is ok: http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Backend-web-services
16:46 jberger get the value from metacpan, when the value is returned then execute this function
16:46 jberger that function is known as a callback
16:46 thowe OK, but what can I read that explains the syntax and where and why things are available?
16:46 jberger the callback will be passed certain arguments (i.e. the signatue)
16:47 jberger this is a style
16:47 jberger https://en.wikipedia.org/wiki/Continuation-passing_style
16:50 thowe so why are both of those transaction objects available in the next sub?  I want to think that the last thing in a sub is returned, but this is two things...
16:53 jberger in the second example? because the begin callbacks order it to be that way
16:53 thowe http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Synchronizing-events
16:53 thowe so.....   callbacks are "continued"?
16:53 thowe or...  something...
16:53 jberger delays capture callback arguments, wait for all concurrant operations to complete, and pass the ordered arguemtns to the next "step"
16:54 * thowe thinks he should take on carpentry instead
16:55 jberger this is the hardest part of async
16:55 jberger get good at single operations first
16:55 jberger then come back to this
16:58 thowe The IOLoop docs are a bit terse for me.  They seem to assume the reader already has a lot of context.  I can't seem to fill in the blanks
17:01 thowe probably means I know less than I think I do...
17:02 thowe But I made this work: https://github.com/thowe/MoPieNg/blob/master/templates/network/branch.html.ep
17:02 thowe so, you know, there's that
17:03 jberger thowe: you aren't trying to do async in a template are you?
17:03 thowe no, no...  I haven't tried to do async at all.  I've just tried to understand it.
17:03 thowe That just recurses
17:03 jberger well for the record, it's not going to work in a template
17:04 jberger ah, nice
17:04 jberger its a bit too much to read and follow
17:04 jberger on quick glance
17:05 thowe My data structure is wound up recursively with freespace inserted into it (or not), and the template unwinds it to display in embedded ULs and then I insert the forms from the template with jQuery when expanded.
17:06 thowe Yeah...  I can't look at it either, but it's actually simplified from the original
17:07 batman jberger: Ok. Will look at it when I get my computer.
17:07 jberger anyway, delays are something that will click for you eventually
17:07 thowe I'll go back and read your articles with my morning brain after coffee
17:08 jberger batman: I see that you added some css that would help as an example in the docs
17:08 batman (Could be Thursday)
17:08 Grinnz_ thowe: https://metacpan.org/pod/Mojo::IOLoop::Delay#begin is the outcome from the info that really helped me understand delays
17:08 jberger is the some way I can poke that into convos?
17:08 thowe I'm just getting ready to convert somethign at work to Mojo and I want to make sure I'm not missing out on some Mojo non-blocking hotness
17:08 batman jberger: Yeah. Just put it into one of the sass files
17:09 thowe jberger, I appreciate the help
17:09 jberger thowe: no worries, again, this takes time for your brain to wrap itself into this
17:10 jberger here's the first goal, $delay->begin does some magic AND return a sub { ... } that does other magic
17:10 jberger let your brain accept that and work from there until you see it
17:22 dod joined #mojo
17:25 berov1 joined #mojo
17:32 mattastrophe joined #mojo
17:46 trone joined #mojo
17:56 trone_ joined #mojo
18:01 Dave Does get('/:foo')->under(sub{ ... }) work at all or does this not make sense to do?
18:03 Dave I suppose I'm really doing under(..)->get('/:foo')->under(..) though
18:09 Grinnz an under doesn't make sense until there's routes under it
18:10 Grinnz (yeah, name's a little confusing...)
18:12 Dave lol
18:12 Dave that's less confusing to me and more intentional ;)
18:13 Dave so the entire chain is $self->routes->via(qw(GET HEAD POST)->under(..)->get(..)->under()->to()
18:14 Dave if I take the last under out, everything works
18:14 Grinnz that doesn't make sense, because it will run the under actions, and then have nothing to run to actually render content
18:14 Dave so I have to do an under -after- specifying a destination with any()/get()/post()
18:15 Grinnz why?
18:15 Dave why everything works?
18:15 Grinnz unders go before the destination route
18:15 Grinnz they're intermediate steps
18:15 Dave but then if I wanted to use a placeholder..I couldn't in an under
18:15 Dave hm
18:15 Grinnz why not?
18:16 Dave seems there's a syntax for it
18:17 Grinnz under(), any(), get() etc all create routes; to() modifies the route it's attached to, to set controller/action/etc
18:17 Dave under creates a route?
18:17 Grinnz yes
18:17 Dave to what?
18:17 Dave if I say under(sub{}) is that to everything?
18:17 Grinnz it's just a special route, whose action is run to determine if the routing dispatch should continue
18:17 Grinnz in that case the action is the sub
18:17 Grinnz yes
18:18 Dave and then if I say under('/:foo'=>sub{}) that invokes the placeholder?
18:18 Grinnz yeah
18:18 Dave so after that, I have a route to /:foo?
18:19 Grinnz yeah, one which expects to lead to another subroute
18:19 dotandimet joined #mojo
18:19 Dave I think that was the piece I needed. :) Thanks. I'm going to write some test code to make sure I'm not in one universe while you are in another. :D
18:20 Grinnz https://metacpan.org/pod/distribution/Mojolicious/lib/Mojolicious/Guides/Routing.pod#Under explains it pretty well i think
18:21 Dave I read that several times...it's missing what you said above (in my view)
18:22 Dave There are no words explaining that  under('/:foo'=>sub{}) provides a placeholder to the stash that the subroutine can access for example
18:26 Grinnz https://metacpan.org/pod/Mojolicious::Routes::Route#under kinda shows it ;)
18:27 Dave it shows the syntax ;)
18:27 Dave this:  my $route = $r->under('/:foo' => [foo => qr/\w+/]); ... why would you use it?
18:27 Grinnz yeah, the module docs aren't generally for discussing usage
18:27 Dave I know. Mojo needs a book.
18:30 neilhwatson ++
18:31 Dave http://pastebin.com/WBM7iqkX  ... this doesn't seem to work
18:31 Repaster Repasted text from Dave: http://fpaste.org/246569/37503465/
18:31 Dave that repaster implies I'm using the wrong service to pastebin? :)
18:31 Grinnz pretty much
18:32 Dave fpaste.org then?
18:32 Grinnz "anything except pastebin.com"
18:32 Dave lol
18:33 Grinnz Athing::target would be routed as athing#target
18:33 Grinnz i dunno if that makes a difference here
18:33 Dave doh
18:33 Dave fixing it
18:33 purl Oooh, thanks.
18:33 Grinnz shaddup purl
18:34 Dave still doesn't work
18:34 purl Look buddy, doesn't work is a strong statement. Does it sit on the couch all day? Is it making faces at you? Does it want more money? Is it screwing your partner? Please be specific!
18:34 Dave my girl has a dog named pearl
18:34 Dave it's neurotic
18:36 Grinnz it's probably looking for TestMe::Athing and TestMe::Controller::Athing
18:36 Grinnz https://metacpan.org/pod/distribution/Mojolicious/lib/Mojolicious/Guides/Routing.pod#Namespaces
18:36 Dave ah yeah
18:36 Dave good catch
18:37 Dave still do es n ot work however that still needed to be f i xed
18:37 Dave I better be explicit inside the to() here
18:40 Dave http://fpaste.org/246572/
18:40 Dave yay no repaster
18:49 kyshtynbai joined #mojo
18:56 Dave hey thowe, I found this which might help you understand non-blocking in mojo: https://tinyurl.com/nm72kcb
18:56 thowe hm, thanks.  I hadn't seen that before
18:57 Dave he "steps" through code in a nice way IMO
18:57 thowe I wonder if its age is a problem?
18:57 thowe Either way, the concepts are prolly the same
18:57 * thowe bookmarks it
19:00 dod joined #mojo
19:02 Dave Just for understanding the ideas, the age is not a problem
19:02 Dave you have to wrap your mind around this kind of programming, and examples with steps and explanations of each step help a lot
19:05 thowe I think I have stumbled across some of this in javascript, but I just copied it and it worked so I didn't go much further
19:05 thowe This is a "functional" thing, is it not?
19:09 jberger whose slides are those?
19:10 jberger a marker of "too old" will be if there is any $delay->end
19:12 thowe right now I'm trying to re-read my jQuery stuff so I can try to recall what I was up to...
19:12 Dave doesn't really work like jquery tho
19:13 thowe no, I wasn't trying to draw a parallel, just being chatty
19:14 Dave it's ok :)
19:15 thowe one issue I need to find a decent solution for, is when I use jQuery to get some data to insert into a document and my session has timed out, I get the login page inserted into that portion of the document.
19:16 jberger wow, that's a decent talk (from a three minute review)
19:16 thowe But I'm not sure the best way to check my login status at that stage.  Maybe I need to check the returned page and if it is a login page, redirect the entire document to the login page but retain the request somehow
19:17 thowe its retaining the request at that point I am not sure how to do.
19:18 thowe not really a mojo issue, I guess
19:20 mst thowe: I wrote http://p3rl.org/curry so if I wanted to hang on to something I'd do $obj->curry::method_to_call_as_callback
19:20 mst or curry::weak to avoid circular references
19:20 mst not sure if that applies to your exact situation
19:22 Dave Anyone have any idea as to why http://fpaste.org/246572/ doesn't work? :)
19:22 Dave I banged on it a bit, I'm either really confused or it's a bug
19:24 dotandimet joined #mojo
19:36 jberger Dave: first of all, you shouldn't need the namespace value
19:36 jberger second, you aren't camelizing correctly
19:37 jberger hmmm, or maybe you are, wait, let me check
19:38 melo joined #mojo
19:38 Dave just trying to be explicit on the namespace thing
19:39 jberger what isn't working?
19:40 Dave get /a
19:40 jberger get /me/a
19:40 jberger you don't define a route that would match /a
19:40 Dave OH
19:41 Grinnz_ lol
19:41 * Dave facepalms
19:41 purl facepalms are certainly another important measure
19:41 Mikey he found a huge bug in mojolicious: the developer
19:41 Dave yeah yeah bring it
19:41 jberger I looked a couple times for obvious problems, then I just tried it and it worked :D
19:41 * Mikey wiggles his antennae
19:42 * jberger swings fly swatter at Mikey
19:42 Dave so how do I match '/a' with that under nesting? get('/')?
19:42 Mikey mannn life's hard out here for a giant bug.
19:43 jberger Dave: in that case what should stash('foo') be?
19:43 jberger you can specify a default value
19:43 Dave a?
19:43 purl rumour has it a is b, b=>a => what it's testing
19:43 jberger so what you want is when foo is a then do that route
19:44 jberger that's not at all what you have there
19:44 Dave I see
19:44 jberger you really don't need that under at all
19:44 jberger that's the easiest way
19:44 Dave well this is a test case
19:44 Dave you don't want to see the real code O.o
19:45 jberger purl: forget a
19:45 purl jberger: I forgot a
19:45 Grinnz_ hmm, it is kind of a common tricky problem that i havent quite figured out the best solution to
19:46 Grinnz_ there's some common code, which you want ot be called automatically in an under-like way, but which depends on which ultimate route was picked for some of its logic
19:46 Dave yes
19:46 Grinnz_ it's not really what under is suited for
19:46 Dave in my case, there's an authentication under() and a "does the authenticated user have the privs for that link" under()
19:47 Dave so authenticate then authorize
19:47 jberger http://mojolicio.us/perldoc/Mojolicious/Guides/Routing#Conditions
19:47 Dave but over doesn't take a subroutine
19:48 jberger adding a condition does
19:49 jberger I have an over that only allows access if a user if of certain named types
19:49 jberger that way I don't have to keep checking in unders
19:50 Dave http://fpaste.org/246607/ ... still doesn't quite work but I can live with this
19:51 Dave what do you mean "adding a condition" does? The section you pasted a link to talks about "over" and I don't see that over can take a subroutine ...
19:52 jberger Dave: I don't think will do what you want either
19:52 jberger does /b go to the B controller?
19:52 jberger I'm guessing it goes to A
19:52 Dave it goes to a :)
19:52 jberger try with [ ]
19:52 jberger rather than { }
19:53 Dave nope
19:53 Dave still goes to a ... I'm thinking that the first route defined for '/' prevents the second route from working
19:54 dotandimet1 joined #mojo
19:55 jberger yeah, it seems that you can't have the restriction at that level
19:55 Dave and it seems if you change the controller in an under handler, it stops trying to make a new controller and simply renders a template
19:56 jberger I wouldn't recommend that at all
19:57 Dave yeah that's a security issue I think
19:57 Grinnz_ only if you did it in a terrible way... :)
19:57 Dave over() looks in the stash right?
19:59 batman jberger: could you add a ticket to support fpaste.org? (I would do it if I had my computer)
19:59 batman (Linkembedder)
20:04 Dave hah! under('/:controller' => ... ) works
20:04 Grinnz_ that's ... probably gonna be a bad idea
20:04 Dave why?
20:05 Grinnz_ actually i think theres an example using that as a parameter somewhree
20:05 Grinnz_ lol
20:05 Dave https://metacpan.org/pod/distribution/Mojolicious/lib/Mojolicious/Guides/Routing.pod#Optional-placeholders
20:05 Grinnz_ Dave: its a bad idea because people can go to /somecontrolleryouwerentexpecting
20:05 Dave not if I limit it in the under handler
20:05 Grinnz_ perhaps
20:05 Dave I see what you are saying though
20:06 Dave it is dangerous
20:09 jberger http://pastie.org/10304833
20:09 jberger batman: sure
20:10 jberger batman: https://github.com/jhthorsen/mojolicious-plugin-linkembedder/issues/22
20:11 jberger Dave Grinnz_ : my pastie there is how you would restrict based on a previous capture
20:11 jberger (note that it is not yet a stash value)
20:13 dotandimet joined #mojo
20:15 Dave ahh stash is an arbitrary value
20:16 jberger I'm using "stash" as the name of my condition
20:17 jberger note also that conditions can only be added to the toplevel router
20:17 jberger thus I had to split you first line
20:17 jberger *your
20:18 Dave so I can't do $self->routes->under->add_condition
20:18 jberger no because under creates a child route
20:18 jberger http://mojolicio.us/perldoc/Mojolicious/Guides/Routing#Adding-conditions
20:18 jberger this is the adding doc
20:19 jberger anyway, all that said, I'm not sure that this is the best way to do things
20:19 jberger conditions are usually for more complex things
20:19 Dave it -is- a new thing I learned :)
20:19 Dave conditions also turn off the routing cache
20:20 Dave not sure what that really means
20:20 jberger I would recommend just using a static /a route and a /b route
20:20 Grinnz_ if they're in the same controller, you can have them call common code at the start of the action
20:20 jberger Dave: I don't know how detrimental it is, but in concept it is saying that it will cost performance
20:20 Grinnz_ which is annoying, but it's one way
20:20 Dave I had thought of that
20:20 Dave I do like my security code in one place :)
20:21 Dave I suppose I could add another helper and call that helper at the beginning of each action
20:21 Grinnz_ (or even if they're not in the same controller, with a helper yeah)
20:21 jberger I also don't like having to rely on calling something at the beginning of each anything
20:22 jberger you, or the person after you, is going to forget to do that somewhere
20:22 jberger what is the actual restriction you are having?
20:23 jberger note that there are also shortcuts
20:23 purl okay, jberger.
20:23 jberger purl: srsly?
20:23 purl I'm totally serial
20:23 Grinnz_ jberger: exactly why i havent found an approach i like yet
20:24 Dave well as I said, I have an authentication under() and an authorization under() per link
20:24 Grinnz_ the problem comes down to what i said before, a bunch of different routes in a common path that want to call common code before continuing the dispatch, but that code has a condition based on the end route
20:24 Dave people log in, they have access to certain links
20:24 Dave what Grinnz said
20:26 Dave for me it's worse because I put the authentication code in a common area and I use the common area for several web apps
20:26 Dave so I'd have to modify the common area for one web app that needs conditions
20:26 Dave the others do not need it
20:26 Dave under('/:controller'...) is probably the way I'm going to go
20:27 * jberger dislikes
20:27 purl dislikes are normal. do whatever you can to make sure
20:27 * jberger kicks purl
20:27 * purl blocks!  Paint the fence!
20:27 Dave lol
20:29 Dave I don't like it much either ... it will fit in my codebase tho
20:29 Dave the helper idea is probably safer
20:29 Dave maybe
20:30 Grinnz_ strip the flesh! salt the wound!
20:30 Grinnz_ wait, different reference, probably
20:32 Dave O.o
20:32 Grinnz_ (borderlands :D)
20:32 Dave I see a lot of people playing that, I might do that too :)
20:33 Grinnz_ it's a fun diablo-style just-shoot-stuff-and-get-loot
20:33 Grinnz_ i havent played 2 much but it's good too
20:33 Dave What do you want to bet sri comes in, sees the above discussion, and resolves it with 10 or less words?
20:34 Grinnz_ the borderlands discussion, maybe
20:34 Dave lol
20:34 Dave diablo eh?
20:34 Dave that's good for about a day for me
20:35 Grinnz_ well, it's FPS, unlike diablo :P
20:35 Grinnz_ so there's that
20:35 Dave I've been playing the beta of an online mmorts
20:35 Dave but games will last months
20:36 Dave I've outgrown my need to shoot stuff, but not my need for good RPG progression
20:36 Grinnz_ borderlands has RPG elements also :)
20:36 Dave ah good! :D
20:36 Grinnz_ it's also pretty hilarious
20:36 Dave so I've heard
20:36 Dave it's that or witcher 3
20:37 Dave have you played "fight the dragon"?
20:37 Grinnz_ i need to play witcher 3 still
20:37 Grinnz_ havent gotten around to it yet...
20:37 Grinnz_ dont know that one
20:37 Dave it's a cheap rpg on steam
20:37 Dave more diablo like
20:37 Dave but short adventures
20:37 Dave you can also create your own
20:41 Grinnz_ ive had my fill of diablo-like RPGs hehe
20:43 Dave haha
20:43 Dave I understand, I was avoiding them at one point
20:44 Dave I like to build more than destroy these days...so I liked the idea of making my own levels
20:44 Dave I still play minecraft too =P
20:45 Grinnz_ i was never into that... but i did enjoy setting up a world with no rules and watching people put lava everywhere
20:45 Grinnz_ and then the 300th time the world crashed, it was irreparably damaged
20:45 Dave heh
20:46 Grinnz_ and i gave up trying to run java
20:46 Dave when I used to go out on servers, there was a time I spawned into a crater down to bedrock
20:46 Dave the griefers had completely destroyed spawn
20:46 jberger there was a perl clone of minecraft
20:47 Dave there was?
20:47 jberger I kinda almost got it running once
20:47 Dave O.o
20:47 Grinnz_ lol
20:47 jberger http://ist.m8geil.de/
20:47 Grinnz_ that's some URL
20:48 Dave I can run java fine even on freebsd, what was the problem?
20:48 Grinnz_ java itself
20:48 purl it has been said that java itself is another issue ... the language is a great language, but the whole environment its wrapped up in turns out to be too limiting for me to accomplish much in it
20:48 Dave rofl
20:48 Grinnz_ lol
20:48 Dave I tried to come up with minecraft mods
20:49 Grinnz_ but more accurately, minecraft's code
20:49 Dave the guy running the forge channel is extremely dishonorable...he'll kick you for an irc ping even if you are a newbie and have no idea about typing someone's name
20:49 Dave yeah and the code
20:49 Dave I made like two mods and called it an adventure
20:50 Dave Java did finally convince me that an IDE could be useful thoguh
20:50 Dave Eclipse isn't so bad
20:52 Grinnz_ sometimes, inventing IRC etiquette is the easiest way to feel powerful :)
20:52 Dave indeed
20:52 Dave well said
20:52 Grinnz_ that's not so much a benefit of eclipse, as that java necessitates something like eclipse
20:52 Grinnz_ lol
20:53 Dave lol ... well I can see that too
20:53 Dave I remember when java was a marketeer's language
20:53 Dave "use java because...well...it's great!"
20:53 jberger sometimes, pretending that power inside of a video game is real power is the easiest way to feel powerful
20:54 Grinnz_ REAL ULTIMATE POWER
20:54 jberger .net
20:54 Dave true power is the sun coming up every day =P
20:54 Dave when you can stop that, I'll believe you are powerful
20:54 Grinnz_ ok, let's move to antarctica
20:54 Dave lol
20:54 Dave actually true power is getting me to move to someplace cold
20:55 Dave lol
20:55 jberger http://www.realultimatepower.net/
20:55 Dave O.o
20:56 Dave heh the no link takes you to oprah.com
20:56 jberger this page has been around for a VERY long time
21:04 inokenty joined #mojo
21:10 mattastrophe joined #mojo
21:51 bpmedley thowe: Did you get your code working?
21:59 esh joined #mojo
22:25 janus joined #mojo
22:29 BinGOs joined #mojo
22:29 garu joined #mojo
22:33 garu_ joined #mojo
22:40 disputin joined #mojo
22:46 thowe bpmedley, which code?
22:54 esh joined #mojo
23:05 bpmedley Perhaps I misunderstood the conversation earlier about the cookbook.
23:06 pink_mist yeah, he was just trying to understand async
23:06 pink_mist he didn't have any code in mind
23:06 bpmedley I see, my bad.
23:17 jberger there were two conversations
23:17 jberger one about async and one about routing
23:17 jberger async was more general, routing we figured out (though not everyone was satisfied with the options available (I generally am))
23:20 kyshtynbai joined #mojo
23:22 kyshtynbai joined #mojo
23:25 pink_mist I .. don't think I see thowe asking about routing 0_o though maybe I didn't scroll back far enough (but I did scroll back to when he joined..)
23:30 esh joined #mojo
23:32 zivester joined #mojo
23:59 jontaylor joined #mojo

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