Cro: libraries and tools for building reactive services in Perl 6 | cro.services/ | Logs: irclog.perlgeek.de/cro/
Set by moderator on 11 April 2018.
01:57 ilbot3 joined
moderator Cro: libraries and tools for building reactive services in Perl 6 | cro.services/ | Logs: irclog.perlgeek.de/cro/
09:29 sena_kun joined 10:38 sena_kun joined 14:06 FROGGS joined 18:45 tony-o joined
tony-o within cro do i need to stub my own controller methods to the router? eg. if i want my route { x => ? } methods in separate files from the main application? 18:49
19:45 FROGGS joined
timotimo tony-o: IIUC you can pass the return value of route { } to a "delegate" in your main router? 20:24
hm, the slides aren't listed on jnthn's 'site yet 20:25
haha, i guessed the url 20:26
jnthn.net/papers/2018-cro.pdf - this could be the one from the gpw last week
aha, what you're looking for is "include" 20:27
delegate is for Cro::Transforms that aren't route-blocks
tony-o ahh i'm getting it 20:30
i'm thinking of writing a middleware to route via a yaml file so i can separate controller from routing
my skeleton right now is a module with a sub and the router module is finding those subs, and adding them dynamically to my `route` 20:31
but include definitely looks good 20:32
(i'm trying to decouple the path and the code implementing that path)
i'm also looking for where i'd implement something that adds an attribute to the request (or response) with a handle to the db 20:33
timotimo that sounds like a "before" middleware that simply mixes in an attribute? 20:43
perhaps there's something like a general KV api
tony-o that's what i was thinking too, on the before 20:44
goig to give it a go with Koos
lizmat
.oO( Koos we haz the
21:03
ze technology )
grrr
(but not the typing skills) 21:04
tony-o haha
jnthn notes that request, response, and the various other helpers from Cro::HTTP::Router work using dynamic variables, so if you really want to decouple, then just `get -> 'foo', $id { $obj.foo($id) }` works fine 21:38
And that method can then use request/response/foo 21:39
timotimo oh hey jnthn
did you perhaps forget a "git push" on your personal website to get links to your newest slide pdfs appear? 21:40
jnthn I've worked with things that did decouple the routing from the impl and never found a case where in made something easier, but did find that it scattered things that changed together. 21:41
timotimo: No, just didn't get around to updating that yet :)
Apparently I'm doing vacation right or something :) 21:42
timotimo aah! :)
jnthn Will take care of it, probably on the train on Satruday :)
timotimo that's fine, i exploited a weakness in your cryptographic subsystem that names your slide files and found the cro slides by myself
jnthn :P
But, uh, those *are* linked from the page, and they are actually the (nearly identical) ones from my Brno.pm talk :) 21:43
timotimo damn!
foiled again!
jnthn The GPW version had nothing new 21:44
tony-o i managed to make a generic/dynamic router using yaml 22:47
it isn't pretty, though
the routing code, at least
gist.github.com/tony-o/9991a793218...ece8ac8016 22:49
timotimo that looks almost straightforward 22:56
tony-o i think it's a little wonky in lib/Router 22:57
for instance, if you 'unit module' it breaks
i do like how simple it is, is there a hook system in Cro where i can release middleware/plugins for it to the ecosystem? 22:58