|
2009 -- the year of November. <november-wiki.org> <github.com/viklund/november> <irclog.perlgeek.de/november-wiki> <nopaste.snit.ch> Set by moderator on 10 February 2009. |
|||
|
05:53
Tene joined
07:27
p6eval joined
07:42
masak joined
|
|||
| masak | Tene: I've been reading up about hpricot, a tags lib in Ruby. | 07:51 | |
| first off: yes, we definitely want a tags library in Web.pm. | 07:52 | ||
| second, please have a look at and let yourself be inspired to the appropriate degree by wiki.github.com/why/hpricot/hpricot-challenge | 07:58 | ||
| zarah | masak's link is also tinyurl.com/bw2tau | ||
| Tene reads | 08:06 | ||
|
08:08
wayland76 joined
|
|||
| masak | wayland76: oh hai :) | 08:08 | |
| wayland76 | hi :) | ||
| Is this just for November, or web stuff in general? | 08:09 | ||
| masak | technically, it's just for November. | ||
| but November will be the first one against the wall when Web.pm arrives, so... | |||
| ...we tend to discuss Web.pm here as well. | |||
| moritz_ | de factor more general | ||
| s/or/o/ | |||
| wayland76 | Ok. Because I have a bunch of p5 modules that do authentication | 08:10 | |
| either inline or HTTP Auth, depending on what you like | |||
| masak | moritz_: I like "defactor". it's what we'll do with November with the help of Web.pm. | ||
| Tene full of cough drugs, can't think. | |||
| moritz_ | ;-) | ||
| wayland76 | And backending onto Authen::Simple | ||
| Tene sleeps instead | |||
| masak | Tene: night. | 08:11 | |
| see you soon. | |||
| wayland76: ok. | |||
| wayland76 | And I'm wondering whether anyone already has auth plans, or whether I should investigate porting these? | ||
| masak | wayland76: the latter. | ||
| wayland76 | Tene: Hope you're well soon. Goodnight :) | ||
| masak | I haven't even thought about auth yet. | ||
| we need it, that's all. | |||
| wayland76 | ok, well, I'm trying to build Parrot, et. al. | ||
| masak | it's one of those things I'm thinking of putting into layer one of Web.pm. | 08:12 | |
| wayland76 | I'm one of the few people in the world who knows how to do optional HTTP Auth :) | ||
| masak | wayland76: welcome, then. :) | ||
| wayland76: here's my PLAN. github.com/masak/web/blob/cc61a6014...42bf9/PLAN | |||
| zarah | masak's link is also tinyurl.com/b37czv | ||
| masak | if you want to send a patch or a pull request to that, I'd be delighted. | 08:13 | |
| wayland76 | One thing -- I note you comment that all the templates are going to be XML-based. What does that mean? | 08:15 | |
| (links welcome :) ) | 08:16 | ||
| masak | wayland76: no, that's not quite what I mean, I think. | ||
| all the templates in the Genshi port will be XML based. | |||
| see the link to Genshi. | |||
| that's because the technology requires it in that case. | |||
| ihrd++ has plans for a simpler Templating engine which will not be XML based. | 08:17 | ||
| one which looks a bit more like PHP or JSP. | |||
| wayland76 | Ok. Because my request was going to be that the templating engine work both inside and outside Web :) | 08:19 | |
| masak | wayland76: oh, of course. | ||
| we'll tend to build everything like that. | |||
| also, we'll tend to build everything to be as hot-swappable as possible. | |||
| wayland76 | Because I use Text::Template a lot, and hate the multiple competing templates in Perl5 when HTML::Mason is clearly superior :) | 08:20 | |
| masak checks out HTML::Mason | |||
| wayland76 | The cool things about HTML::Mason are autohandlers and dhandlers :) | ||
| masak | noted. | 08:21 | |
| wayland76 | The bad thing is it only works with a big setup around it :) | ||
| masak | aye. | ||
| Web.pm will be a big setup, but on the other hand we don't want to paint people into a corner, or build them into a closed garden. | 08:22 | ||
| wayland76 | I don't mind the big setup, but when doing sysadmin, I like something simple like Text::Template | 08:23 | |
| masak | yes, I can see the use for that. | 08:24 | |
| wayland76: if you'd care to add a short paragraph about that in the PLAN file, you'd increase your chances of having it your way. | 08:27 | ||
| wayland76 | I'll keep that in mind, and may get around to it in the next few days | 08:30 | |
| masak | cool. | ||
| I plan to blog a little now about the first week of Web.pm. | 08:31 | ||
| will mainly talk about the approach we seem to be taking, and some code reading I've done so far of Sinatra. | |||
| does anyone have a favourite bible quote? :) preferably something relevant to specs. | 08:32 | ||
| I've found Moses and the mountain so far. | |||
| wayland76 | Proverbs might be a good source for that sort of thing | 08:36 | |
| Or the first few chapters of Genesis (but of the tree in the centre of the garden, thou shalt not eat) | 08:37 | ||
| masak | ooh. | 08:38 | |
| good idea. | |||
| "An Ceiling Cat sed to teh man, ov evury tre in teh gardin iz ok u eatz: But of teh tre of teh nawlej of gud an evl, you not eatz cuz wen u eatz taht tre i fur sure mek u ded. Srsly." | 08:40 | ||
| perfect. | |||
| spinclad | but of teh tre of lolaj of WAI an NOWAI eatz u not else KTHXBAI! | 09:07 | |
| wayland76 | masak: To edit that plan, I need my own fork, right? | 09:09 | |
| masak | wayland76: either that, or you just download my tree, edit and email me a patch. | ||
| but I guess the Github Way is to fork, yes. | 09:10 | ||
| wayland76 | ok | ||
| masak | plus, that would look good on paper, and might merit you a mention in my blog post if you hurry. :) | ||
| wayland76 | Ok, I forked, I've changed the files, and git-diff agrees they're changed. How do I send you the changes? | 09:19 | |
| git-diff | mail masak ? | |||
| masak | wayland76: you forked on github? | ||
| wayland76 | yes | 09:20 | |
| But I didn't branch in my repo :) | |||
| masak | if so, commit, push and then do a "pull request" through the web interface. | ||
| wayland76 typed "gut push" by accident :) | 09:26 | ||
| masak | what a funny coincidence, I almost surfed to guthub just now. | ||
| maybe a good candidate for web squatting. | |||
| moritz_ | already registered | 09:27 | |
| masak | dang. | ||
| all the gut urls are already taken. :P | |||
| wayland76 | That one took me a while (monolingual here), but I got it :) | 09:29 | |
| masak | :P | 09:30 | |
| wayland76: how's that pull request coming along? I'm proof-reading the blog post now. | 09:33 | ||
| wayland76 | Well, I've sent one. Has it arrived at your end? | 09:34 | |
| masak checks | |||
| it has indeed. | |||
| wayland76 | Yay! | ||
| I'm hoping to send in a patch for rakudo later, so it was good to have a practise run :) | 09:35 | ||
| masak | glad to be of assistance. :) | 09:36 | |
| wayland76: I'm going to accept half of your commit. | 09:49 | ||
| re "Ideally, the templating system will also work in non-HTML, non-Web environments.", that is both implied (by the Ganshi tutorial page), and not really a goal of that layer of Web.pm -- we have other modules for people who don't like XML templating. | 09:50 | ||
| wayland76 | I was hoping we could have just one templating module | 09:52 | |
| But I'm happy if that doesn't go in the Web PLAN | |||
| masak | wayland76: we'll have at least two templating modules as it looks now. | 09:53 | |
| wayland76 | Well, I don't like it, but I guess I can live with it :) | 09:54 | |
| masak | wayland76: I'm perfectly fine discussing it, and having you convince me that two kinds of needs exist. :) | 09:55 | |
| until then, the answer is "just don't use one of them". | |||
| wayland76 | But that's my problem -- sometimes I want to use templating with HTML, and sometimes without. If these are separate templating systems, then I have to learn both | 10:01 | |
| Or force one of them to do something it's designed to prevent you from doing :) | |||
| masak | wayland76: if I get my way, one will be a subset of the other. | 10:02 | |
| wayland76 | How about if we changed it to "Ideally, the lower levels of the templating system will also work in non-HTML, non-Web environments." | 10:04 | |
| Would that work? | |||
| masak | yes, but that's a given. no "ideally". | ||
| wayland76 | Sounds fine, then :) | 10:07 | |
| (ie., drop the "ideally") | |||
| masak | aye. | ||
| I'll do that. | |||
| masak does 'git fetch wayland master' | 10:08 | ||
| wayland76: something in your work environment adds line-ending spaces. just thought you should know. | 10:17 | ||
| wayland76 | What, on every line? | 10:24 | |
| Or just the ones I was editing? | 10:25 | ||
| masak | just yours. | 10:27 | |
| wayland76 | Ok. That only happens when it word wraps. And it doesn't bother me :) | 10:36 | |
| Believe it or not, I use "nano" :) | |||
| masak | I believe you. | ||
| but be aware that some people will be offended if you send patches with line-ending spaces. | |||
| (I don't mind much, but I'd rather not have them there, so I removed them.) | 10:37 | ||
| wayland76 | Fine by me (about removing them). I'll worry about it when it happens, but thanks for the warning :) | 10:40 | |
| masak | perl -i.bak -pe's/ +$//' file | 10:41 | |
| wayland76 | ok :) | 10:42 | |
| masak | throw that in a script in a bin/ dir somewhere. problem solved. :) | ||
|
12:02
ihrd joined
|
|||
| ihrd | hi there | 12:08 | |
| wayland76 | hi :) | 12:11 | |
| ihrd | wayland76: hi, I am reding logs. Today my first night of the grant | 12:12 | |
| start to diggin in all this opinions and links | 12:13 | ||
| masak | ihrd: aloha. | 12:15 | |
| ihrd | I see some parts, but actualy do not have complite plan for this work | ||
| a lot of ways and posibilites | |||
| masak: HAI | |||
| masak | ihrd: I think our topmost priority should be to move November over to Web.pm. | 12:16 | |
| I'm not sure I know yet which parts we need for that. | |||
| maybe it'll be a piece-by-piece process. | |||
| no, strike that. most _likely_ it'll be a piece-by-piece process. :) | 12:17 | ||
| ihrd | templater, routines, coockies + sessions, authorization | ||
| masak | aye. | ||
| moritz_ | please do authentication first | ||
| then authorization | |||
| masak | moritz_: why? | ||
| ah. | |||
| sure. | |||
| moritz_ | because it's the more basic task | ||
| ihrd | :) | 12:18 | |
| masak | aye. | ||
| auth and sessions are somewhat bundled, I think. | |||
| we already have a templater, but we don't really like it. | |||
| ihrd: what do you mean by 'routines'? | |||
| ihrd | masak: generaly, way to handle requests | 12:19 | |
| masak | like, dispatcher? | 12:20 | |
| ihrd | yes | 12:21 | |
| masak | great. | ||
| ihrd | 'Routines' this is from the rails | 12:22 | |
| masak | ah. | ||
| ihrd | in Catalyst you have Controllers and actions, and you set attributes for dispatcher | 12:23 | |
| masak | ok. | 12:24 | |
| ihrd | in rails you have one file routines.rb with DSL about how to handle URIs | ||
| masak | ah. | ||
| do we need any DSLs for Web.pm? | |||
| because right now, we can't build'em in Rakudo. | |||
| ihrd | Tags.pm is the some sort of DSL | 12:25 | |
| masak | which Tags.pm? from CPAN? | ||
| or the one Tene's about to build? | |||
| ihrd | no, we speak about it... yes Tene`s | ||
| what you want to have in Rakudo for DSLs? | 12:26 | ||
| masak | and by "DSL" here, you mean a lot of sub names that look like a whole new language, right? | ||
| sort of like CGI. | |||
| (from CPAN) | |||
| ihrd | CGI is big, and handle the request and Tags helpers in one | 12:27 | |
| masak | aye. | 12:28 | |
| just using it as an example of a "DSL" in Perl. | |||
| ihrd | yes, basicle a lot of subs. I mean helpers for specific propouse | ||
| oh, excuse my English, awfull. I need spell dictionary for pidgin | 12:29 | ||
| masak | it's going well so far, methinks. | ||
| I'll ask if I don't understand. | 12:30 | ||
| ihrd: did you read my report on the first week? | |||
| ihrd | thank you | ||
| yes, I read all emails and you blog post. And reading logs of this chanel right now | 12:31 | ||
| masak | excellent. | 12:32 | |
| some people don't like the name Web.pm because they think it's too general. | 12:33 | ||
| I think Web.pm itself is fairly general. it does web things. | 12:34 | ||
| it does exactly what the name of the module says it does. | |||
| ihrd | right now we do not have any strong conception, so I can`t prefer name. Web.pm is okay for my as work-name. | 12:36 | |
| masak | indeed. | ||
| but I think we should name all the components. | 12:37 | ||
| wayland76 | Auth and Sessions can be are independent, but work together | ||
| masak | wayland76: then what matters is to make them work well together. | ||
| wayland76 | Yah, exactly | 12:38 | |
| ihrd | masak: yes, HTML::Tags, HTTP::Request, Template::Simple | ||
| masak | ihrd: aye, maybe for those. | ||
| but for bigger things, like the MVC framework and some of the templaters, we should give them unique names. | 12:39 | ||
| like Rack, Sinatra, Genshi, Rails and Catalyst. | |||
| wayland76 | My UserAuth package which I was talking about porting depends for at least some of its functionality on CGI::Session, CGI::Cookie, and Authen::Simple (or any other Authen module you want to slot in) | ||
| masak | ok. | 12:40 | |
| I'd like to see a detailed explanation about how that works. is there any CPAN Pod I should read? | 12:41 | ||
| s/Pod/POD/ | |||
| wayland76 | How which works? | ||
| the UserAuth package I did? | |||
| masak | the interaction between UserAuth and the other CPAN modules. | ||
| wayland76 | This was never submitted to CPAN -- I got lazy :) | 12:42 | |
| I can zip it up and send it to you, though :) | |||
| It has documentation in it | |||
| masak | I'd appreciate that. | 12:44 | |
| wayland76 | (same terms as perl itself, of course :) ) | 12:45 | |
| masak | aye. | 12:47 | |
| how can Sinatra (and HTTP::Server::Simple::CGI from CPAN) act as a whole web server? | 12:54 | ||
| and, perhaps more importantly, should we try to do the same in Web.pm? | 12:55 | ||
| ihrd | masak: okay, we need name. But first we need conception and architecture -- why and how we put all things together in f/w. As I say before, it is still a lot of parts and a lot of ideas about, not complite vision for now. | ||
| masak | ihrd: agreed. | ||
| wayland76 | I agree that at least level 1 should be called Web | ||
| masak | I've started in PLAN to put together all I've every thought about the subject. | ||
| but much still remains. | 12:56 | ||
| and much work remains to turn it into a coherent whole. | |||
| wayland76 | I don't think Web should act as a whole web server -- I think we should work with CGI in Apache, with mod_parrot, and with others to follow as people want them | ||
| ihrd | I think dispatcher is one of the 'core' stuff | ||
| masak | wayland76: maybe you're right that the upper levels shouldn't be called Web.pm -- that remains to be seen. for now, I don't want to exclude those level just becuase they're more advanced. | ||
| wayland76 | masak: Agreed | 12:57 | |
| masak | wayland76: have you tried Sinatra? | ||
| there's something very alluring about writing five lines of code and then deploying it as a full stack web app. | |||
| wayland76 | no. About the only thing I've actually tried is Drupal | ||
| ihrd | I have too ideas I like here: 1) REST 2) :Chained 3) Routines | ||
| masak | I'm not saying we should force the web server on anyone. | ||
| ihrd: please add them to PLAN if you have the time. | 12:58 | ||
| I can review it and polish the English if you want. | |||
| ihrd: simply a list of those three would be very good. | |||
| ihrd | frankly speaking, my plans to work hard on the grant today is broken, btw I start immersion | 13:00 | |
| masak: yes, I will do | |||
| masak | ihrd: oh well. hope that you're free to do it soon. | ||
| wayland76 | Don't worry, I failed in my goal today of having an up-to-date parrot RPM by the end of the day :) | ||
|
13:02
rkendall joined
|
|||
| masak | rkendall: welcome :) | 13:02 | |
|
13:02
ruoso joined
|
|||
| masak | ruoso: welcome. :) | 13:03 | |
|
13:03
Matt-W joined
|
|||
| ihrd | masak: I start today, my day 0 I think. I will work every day. | 13:03 | |
| masak | Matt-W: welcome. :) | ||
| ruoso | anyway | ||
| masak | ihrd: no worries. you make your schedule. | ||
| ruoso | today's crazy idea follows: | ||
| masak | ihrd: but it's good that we meet here to discuss sometimes, not just reading each other's commit messages. | 13:04 | |
| ruoso | one of the most important featuers I've been using in Catalyst is the fact that it is engine-agnostic | ||
| masak | aye. | ||
| Matt-W | masak: thought I should pop in and keep an eye on you :P | ||
| masak | ruoso: what does that mean for you? | ||
| rkendall | glad to be hear | ||
| masak | Matt-W: aye, I need it. | ||
| ruoso | I used Catalyst to build a XMPP client | ||
| masak | oh, cool. | ||
| ruoso | to build a CLI app | ||
| and even to embbed in some other cat app | |||
| masak | ruoso: by engine, you mean things like Apache, yah? | 13:05 | |
| ruoso | yes | ||
| Catalyst::Engine::* | |||
| masak | ok. | ||
| ruoso | (myself being the author of two) | ||
| masak | :) | ||
| ruoso | but one thing Catalyst didn't make pluggable | ||
| was the semantics of the request | 13:06 | ||
| I always need to translate into HTTP semantics | |||
| even if I'm talking XMPP | |||
| masak | ruoso: my current plan is to port Rack from Ruby. | ||
| ruoso | Rack? | ||
| masak | ruoso: I guess that one uses HTTP semantics as well. | ||
| ruoso: see PLAN in the Web.pm repo. | 13:07 | ||
| github.com/masak/web/tree/master/PLAN | |||
| ruoso | link? | ||
| zarah | masak's link is also tinyurl.com/7jywvo | ||
| ruoso | masak, my point is that you have several pieces that will form your framework | 13:10 | |
| masak | wow, 12 people in here. that's a record. and three bots. | ||
| ruoso: indeed. | |||
| ruoso | the biggest catalyst strength is to make those as separated as possible | ||
| that's actually the biggest RoR weakness | |||
| RoR is much more monolitic | 13:11 | ||
| rkendall | ...it's also nice if it's easy to use all of the bits together | ||
| ruoso | sure... I think the use of a custom grammar in the end will make that very easy | 13:12 | |
| masak | well, things like Sinatra could be said to be monolithic. but it's also nice to have before you choose a real engine. | 13:13 | |
| ruoso: custom grammar for what? | |||
| ruoso | controller Foo { action bar { } } | ||
| masak | ah, yes. | 13:15 | |
| but first, the underlying semantics. :) | 13:16 | ||
| ruoso | well | ||
| masak | it'll be a while yet before Rakudo has modifiable grammars. | ||
| ruoso | the basic parts of that semantics are: | ||
| 1) receiving a request | |||
| that's the "engine" part | |||
| it knows how to be triggered for an event | |||
| masak | aye. | 13:17 | |
| ruoso | and generates a "Request" object | ||
| masak | I, for one, think that Web.pm should be able to handle the engine part standalone if it has to. | ||
| but work well with Apache et al too. | |||
| ruoso | in Catalyst the "Request" object is very HTTP-specific | 13:18 | |
| this is something that can be fixed | |||
| you can have a much more generic "Request" role | |||
| and have a HTTPRequest role to complement it | |||
| masak | ruoso: ok. | ||
| ruoso: sounds like a good thing. | |||
| ruoso | this "Request" object is the thing that takes us to the second step | ||
| 2) dispatch | |||
| masak | aye. | 13:19 | |
| ihrd++ is on top of that. | |||
| ruoso | This takes info from $req in order to dispatch | ||
| masak | November already has a dispatcher, even. | ||
| ruoso | I think the generic request role would provide | ||
| has $.uri | |||
| masak needs to turn ruoso++'s steps into a diagram of some sort | |||
| ruoso | has %.params | ||
| masak | might be good to have a diagram to show people. | 13:20 | |
| rkendall | I would have thought the idea for Web.pm would be to be HTTP specific, otherwise isn't it stretching the scope a bit. | ||
| masak | indeed. | ||
| ruoso | rkendall, you sure can implement the Web part only, for now | ||
| but it doesn't hurt to make it extensible | |||
| rkendall | I guess it bears thinking about | 13:21 | |
| ruoso | The mistake in Catalyst in the dispatch part | ||
| is to make each dispatch type independent | |||
| like | |||
| it first tries to dispatch "Regex" | |||
| if that fails | |||
| it tries "Chained" | |||
| if that fails "Path" | |||
| you need a way to provide an unified dispatching | |||
| I think the good way of doing it is basically to consider everything "Chained", while support different part matching algorigthms | 13:22 | ||
| masak | aye, we talked about that the other day. | 13:23 | |
| I emailed the discussion to the november-wiki mailing list. | |||
| ihrd liked the idea. | |||
| ruoso | (look for Catalyst::DispatchType::Chained) | ||
| ihrd | ruoso: hi, sorry, I have thoughts, but all my attention on the reading you chat, I have no time to answer :) English is not my original language, and I am tired now, so reading take all of me :) | ||
| masak | ihrd++ # for trying | 13:24 | |
| ruoso | the third step is actually having no third step | ||
| ;) | |||
| masak | 3. ??? | ||
| 4. profit! | |||
| ihrd | yes, I send email about this too, I like :Chained in Catalyst | ||
| masak | ihrd: I like the fact that you know what ruoso++ is talking about :) | 13:25 | |
| ruoso | see Catalyst::Action::RenderView | ||
| most cat applications have a "end" action is a Catalyst::Action::RenderView | |||
| ihrd | masak: you can read Manual::Intro for fast breif about types in Catalyst dispatcher | ||
| ruoso | that only calls a "default" view if no response was set yet | ||
| masak | ihrd: will do. thanks. | ||
| ruoso | but that's app to the application, not to the framework | ||
| s/that's app/that's up/ | 13:26 | ||
| masak | indeed. | ||
| ruoso | that's a very important aspect of Catalyst | ||
| that's why it's so easy to use multiple views in the same app | |||
| masak | it would be nice to eventually drop November over on an MVC framework. | 13:27 | |
| but I'm afraid that is outside the scope of the grant. | |||
| ihrd: have you thought about the MVC framework and databases? | |||
| ruoso | masak, I'd suggest not trying to implement a ORM in your framework | 13:28 | |
| it should be external to it | |||
| masak | ruoso: see earlier discussion about giving the larger parts real names. | ||
| ihrd | ORM is a big deal | ||
| masak | ruoso: at this point, I don't know if they will form a part of Web.pm in some real sense. | ||
| ruoso: perhaps they will just be very compatible on some API level, or some such. | 13:29 | ||
| ihrd | we can`t make as part of this grnt | ||
| ruoso | masak, you shouldn't expect any API on the model | ||
| that's also a big strength in Catalys | |||
| masak | ruoso: I don't know what to expect yet. :) | ||
| ruoso | masak, see Catalyst::Component | ||
| masak opens another tab in his browser | 13:30 | ||
| ihrd | I use Catalyst a lot, so when I think about web MVC I thiking in Catalyst maner | ||
| ruoso | ihrd, cool... | 13:31 | |
| I think I need to subscribe to the list you're using... | 13:32 | ||
| where is it hosted? | |||
| masak, putting it simple... the thing that Catalyst really implements is the Controller part, both the model and the view are just in the "Component" level, which means that it is up to each implementation to decide what to do | 13:33 | ||
| they are named "Model" and "View" | |||
| so you can do | |||
| $c->model('Name') | |||
| instead of | |||
| masak | ruoso: groups.google.com/group/november-wiki | ||
| ruoso | $c->component('Model::Name') | ||
| zarah | masak's link is also tinyurl.com/awn2o7 | ||
| masak | ruoso: ok. I need to read up on Catalyst, but I hear what you're saying. | 13:34 | |
| ruoso | while the application is running | ||
| Catalyst has this core variable "$c" | 13:35 | ||
| which, interestingly, is named "context" | |||
| then you have $c->request | |||
| $c->response | |||
| $c->session | |||
| $c->stash | |||
| and so on | |||
| that obviously can be replaced by | |||
| $*request | |||
| $*response | |||
| $*session | 13:36 | ||
| $*stash | |||
| actually | |||
| %*session | |||
| %*stash | |||
| that being said | 13:37 | ||
| $*request and $*response | |||
| might be expected to be declared by the engined | |||
| *engine | |||
| so the dispatch part can simply assume that | |||
| Ok... | 13:38 | ||
| now to the most important core aspect of how Catalyst works | |||
| which is Class::C3 | |||
| Catalyst is so easily extensible because adding a plugin is just a matter of adding another superclass to the application | 13:39 | ||
| because every processing step always call $self->next::method | |||
| so all plugins can have code executed in any step of the processing | 13:40 | ||
| just by implementing that method and calling $self->next::method in the end | |||
| I'm not sure if $obj.*method() is supposed to do that, but I think not | 13:43 | ||
| or maybe yes... | |||
| but plugins should be translated as Roles in Perl 6 | |||
| so you instantiate the application, and starts composing the roles of all the plugins | 13:44 | ||
| very much important | |||
| also | |||
| is that each action is really an object, not just a method | |||
| because you need to be able to compose roles there too | |||
| indeed... | 13:50 | ||
| after some testing | |||
| that can be represented in terms of multi methods, role composition and $obj.*method | |||
| so no need for next::method | |||
| masak, dev.catalystframework.org/old-wiki/...FlowChart/ | 13:54 | ||
| zarah | ruoso's link is also tinyurl.com/djdc6j | ||
| masak | ruoso: awesome. | ||
| ruoso | masak, but mst has been saying that "begin" and "auto" should also be represented in terms of chained actions | 13:59 | |
| masak | okay. | ||
| ruoso | "end" and "default" I think still need to be somewhat special | ||
| masak | mm. | 14:00 | |
| ruoso | masak, but maybe they don't | ||
| maybe you can just consider an action that would match when no other did | 14:01 | ||
| as for default | |||
| and if everything is designed in terms of chained | 14:03 | ||
| you can consider that the action will be called in two phases | |||
| "execute" and "end" | |||
| masak | ok. | 14:04 | |
| ruoso | then the same chain is used to end the request | ||
| masak | this doesn't tell me much, since I don't know Catalyst yet. | ||
| but it's in the logs for when I do. | |||
| ruoso | basically | ||
| an action is an object | |||
| where Catalyst calls "execute" | 14:05 | ||
| when it does, | |||
| it usually ends up executing the code that is in the sub | |||
| masak | ok. | ||
| ruoso | in order to generalize "end", it would call an additional method "end" | ||
| instead of doing a second dispatch to that | |||
| which is what cat does today | |||
| masak | ok. | 14:06 | |
| ruoso | today cat does several dispatches in each request (as that flowchar shows) | ||
| begin, auto, the action itself, end | |||
| and optionally default | |||
| ihrd | a lot of dispatch | ||
| ruoso | the idea is to consolidate all of that into a single chained dispatch | ||
| masak | sounds nice. | ||
| if it can be done, that is. | 14:07 | ||
| "as simple as possible, but no simpler" | |||
| ruoso | one of the problems cat suffers today | ||
| is the lack of a difference between control exceptions and failures | 14:08 | ||
| which can be fixed in Web.pm | |||
| masak | ruoso: do you have a concrete example of that? | ||
| ruoso | masak, the block that explains how auto processes | ||
| it needs to check for a "false" return | |||
| also | 14:09 | ||
| masak | uh huh. | ||
| ruoso | when you want to "detour" the dispatch from a given point | ||
| it gets very confused | |||
| masak | like me, right now. :) | ||
| what do you mean by "'detour' the dispatch"? | |||
| ruoso | that can be solved by using ControlExceptions | ||
| let's say you're dispatching a chain | 14:10 | ||
| masak | ok. | ||
| ruoso | but at some point, you realise there's an error | ||
| masak | during the dispatch? | ||
| ruoso | while dispatching an inner action of a chain | ||
| masak | ok. | ||
| ruoso | masak, do you understand the common use of chained dispatch? | ||
| masak | no, not at all. | ||
| this is not my department, it's ihrd's | 14:11 | ||
| ruoso | say you have a blog | ||
| masak | I'd like to understand it, but I simply haven't read up on it yet. | ||
| ruoso | then you have the url | ||
| masak | aye. | ||
| I'm with you so far. :) | |||
| ruoso | /blog/category/foo/post/bar/comment/bla | ||
| masak | sure. | ||
| ruoso | that's usually represented as a set of chained actions | ||
| masak | ok. | ||
| ruoso | comment(1 arg) -> post(1 arg) -> category(1 arg) -> blog(0 args) | 14:12 | |
| and they get executed from inner-to-outer | |||
| masak | uh huh. | ||
| ruoso | first the "blog" action, then "category", then "post" then "comment" | ||
| masak | sounds reasonable. | ||
| ruoso | but if the category doesn't exist, for instance | 14:13 | |
| you might want to "detour" the dispatch | |||
| masak | "short-circuit", perhaps? | ||
| "detour" means going away and then coming back later. | |||
| ruoso | catalyst calls it $c->detach('/destination') | 14:14 | |
| masak | ok. | ||
| ruoso | but when you mix that with eval blocks | ||
| it just gets very confusing | |||
| because that was supposed to be a control exception | |||
| ihrd | $c->detach(/error404); | ||
| ruoso | but there's no such thing in p5 | 14:15 | |
| masak | right. | ||
| so this is all about meking use of Perl 6's exception handling. | |||
| I like that. | |||
| the best kind of code is no code. | |||
| ruoso | so, the final picture | 14:16 | |
| ihrd | I hope we will make clear dispatcher | ||
| ruoso | 1) the engine code is something external that declares $*request and $*response | ||
| where you have generic Request and Response roles | |||
| masak | ihrd: there certainly doesn't seem to be a shortage of ideas, at least :) | ||
| ruoso | but also specific Request::HTTP and Response::HTTP | 14:17 | |
| or even | |||
| Request::Apache and Response::Apache | |||
| 2) the dispatch code is something that tries to match an action using $*request | |||
| takes that action | |||
| calls $action.begin | 14:18 | ||
| $action.execute | |||
| $action.end | |||
| and that's all | |||
| masak likes that | 14:19 | ||
| ruoso | it's important to realize that matching a request to an action | 14:20 | |
| implies $*request ~~ $action | 14:21 | ||
| so you basically ends up with something similar to | |||
| given ($*request) { when $action1 { }; when $action2 {} } | |||
| but you'll never actually write that code, of cousre | 14:22 | ||
| masak | that sounds very alluring. | ||
| it's a great way to explain it, too. | |||
| and it works perfect with perl 6. | |||
| more such things. :) | |||
| ruoso | now the initialization part | ||
| which is the most hard | |||
| you need a simple way of getting all that declared | 14:23 | ||
| masak | when loading the module? | 14:24 | |
| yes. | |||
| ruoso | ideally, you would have a custom grammar | 14:27 | |
| masak | we're not developing ideally right now, though. | 14:28 | |
| we're writing working code. | |||
| but yes, noted. we want a custom grammar later. | |||
| ruoso | so, the code will require some initialization overhead | ||
| masak | right. | ||
| as long as we get the semantics right now, we can fix the syntax later. | |||
| ruoso | basically, every controller will require something like | 14:30 | |
| $*application.register_controller($?CLASS) | |||
| and every action would be something like... | 14:31 | ||
| my $action = Default::Action::Class.new(); | |||
| $action does Chained; # for instance | |||
| masak | right. | ||
| ruoso | $action.chain($otheraction) | ||
| $action.chain = $otheraction; #actually | |||
| $action.pathpart = 'something'; | 14:32 | ||
| $action.captureargs = 1; | |||
| actually | |||
| my $controller = $?CLASS.ne | 14:33 | ||
| my $controller = $?CLASS.new | |||
| $controller.register_action($action); | |||
| moritz_ | register-action | ||
| ruoso | $*application.register_controller($controller) | 14:34 | |
| masak | :) | ||
| moritz_ | dashes are allowed in identifiers, so USE THEM | ||
| masak | moritz_: I've also switched over almost completely to dashes. | ||
| ruoso | :) | ||
| masak | need to go through my projects and dashify them completely some time. | ||
| ruoso | $action does Chained{ :chain($otheraction), :pathpart('something') }; is also valid syntax | ||
| moritz_ | whenever I see a propose to add some under_scored name to language it makes me cringe | ||
| masak | need to start using the p6 colour scheme in vim as well, because dashes ruin the usual perl colour scheme. | 14:35 | |
| moritz_: you should write a p6u mail about it. | |||
| moritz_ | masak: I should. And/or blog about it | ||
| ruoso | masak, actually | ||
| masak | moritz_: aye. | ||
| ruoso: oh, parameterized roles FTW. | 14:36 | ||
| ruoso | my $controller = Default::Controller::Class.new(); | ||
| my $action = Default::Action::Class.new(); | |||
| $action.begin = { do something }; | |||
| $action.execute = { do something }; | |||
| $action.end = { do something }; | 14:37 | ||
| moritz_ | couldn't $action just be a sub, and you can wrap that if you want begin/end actions? | ||
| ruoso | begin/end happen in a different time then execute | 14:38 | |
| it first calls begin in the whole chain | |||
| then calls execute in the whole chain | |||
| and then end in the whole chain | |||
| thinking again | 14:40 | ||
| you don't really need controllers | |||
| except for the matter of organizing code in modules | |||
| so you just have | 14:42 | ||
| my $action = Action.new(); | |||
| $action.begin = { do something }; | |||
| $action.execute = { do something }; | |||
| $action.end = { do something }; | |||
| $action does Chained{ :path-part<something>, :parent($otheraction) }; | |||
| $*application.register-action('/controller-name/local-name', $action); # so you get the private name for the action... | 14:43 | ||
| hmm... | 14:44 | ||
| "begin", "execute" and "end" are not good names for the attributes | 14:45 | ||
| probably better to have them as "begin-closure", "execute-closure" and "end-closure" | |||
| since you have the actual methods that invoke that closures called .begin, .execute and .end | |||
| ihrd | so in your vision app is set of Action objects, chained actions. | 14:50 | |
| ruoso | the dispatching part of the app | 14:51 | |
| yes | |||
| you still need to handle the other components | |||
| ihrd | I will re-read this log tomorrow, when I will be cheeful, and ask my questions. thank you! | 14:55 | |
| masak | ihrd++ | ||
| ruoso | ihrd, masak, I'm doing some sketches on some roles that related to this discussion | 14:56 | |
| ihrd | (masak: this question can be stupid, add my karma if it is not) | ||
| masak | :) | ||
| ruoso: cool. | |||
| I'm amazed at the way people volunteer in this Web.pm effort. | 14:57 | ||
| ruoso | but I do think we're going to need a more generic name, tho ;) | ||
| masak | thank you, noted. | 14:59 | |
| ihrd | I am going to sleep, bb | ||
| masak | ihrd: see you around. | 15:00 | |
|
15:00
ihrd left
|
|||
| ruoso | masak, I think I just had another crazy idea | 15:39 | |
| masak | let's hear it. | ||
| ruoso | what if the URI -> Action matching is done by an application-wide grammar? | ||
| where dispatching the action is the action of the token? | 15:40 | ||
| masak | that does indeed sound crazy :) | ||
| could you paste a piece of example code or sump'n? | |||
| ruoso | I thought about it when I realized that matching the action will require to store match information | ||
| for capture args | |||
| masak | aye. | ||
| ruoso | and I would need to store the match in the request | 15:41 | |
| to look there later | |||
| so it's probably better to make it a grammar | |||
| that calls the appropriate actions | |||
| that's actually very cool | 15:42 | ||
| because when matching | |||
| /blog/category/foo/post/bar | |||
| it could look for the category 'foo' during the matching | |||
| and fail that rule otherwise | 15:43 | ||
| allowing a different rule to proceed | |||
| masak | that sounds cool. | 15:46 | |
| ruoso | masak, sial.org/pbot/35415 | ||
| that's from before the latest crazy idea | |||
| masak | ruoso: do you mind if I commit that to the Web.pm repo? | 15:47 | |
| ruoso | not at all | ||
| it's just that I hadn't cloned it yet | 15:48 | ||
| masak goes ahead | |||
| ruoso | otherwise I would add it myself | ||
|
15:51
Tene_ joined
|
|||
| ruoso | masak, in that file, the run-action method should actually enclose the begin and execute in a try block which would put any exception into a context variable before runnnig .*end | 15:52 | |
| masak | uhm. | ||
| I didn't read it carefully, I just stored it away for when I'm ready to understand it. | 15:53 | ||
| don't ask me to modify source code I don't grok. :) | |||
| ruoso | ok... I'll send another revision in a sec | ||
| (I should clone the repo at some point... but I can't do it right now) | 15:54 | ||
| sial.org/pbot/35421 - updated version of the notes I wrote | 17:55 | ||