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

IRC log for #mojo, 2014-07-21

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

All times shown according to UTC.

Time Nick Message
00:10 Averna joined #mojo
00:38 R0b0t1 joined #mojo
00:56 preaction what does "with" get us that lexical filehandles does not?
00:57 preaction use autodie qw( open ); if ( open my $fh, '<', 'whatever' ) { ... }
00:58 D4RK-PH0ENiX joined #mojo
01:17 D4RK-PH0ENiX joined #mojo
01:50 klapperl joined #mojo
01:50 jberger ummmmm ... with is more generic than filehandles
01:51 preaction i've never seen it used with anything else. is it a topicalizer too?
01:56 jberger all it does is call obj.__enter__() immediately, then call obj.__exit__() when the scope ends
01:57 preaction ahh, so it could do _other_ things, it's not necessarily creation and destruction
01:58 jberger yeah
01:58 jberger with Mock.patch.obect(...):
01:59 jberger object
02:00 jberger I would (probably) do it with a temporary scope guard object and its DESTROY method
02:00 jberger but your supplied object would implement ENTER and EXIT
02:00 jberger and use the keyword api to set it all up
02:01 zacts joined #mojo
02:02 jberger with ($ctx) { } -----> { my $guard = SomeGuardClass->new($ctx); $ctx->ENTER() }
02:02 jberger where sub SomeGuardClass::DESTROY { shift->ctx->EXIT() }
02:03 preaction ahh, and further, it means that you do not necessarily have to destroy the thing in order to finish it
02:03 jberger right
02:03 jberger in fact you might not want to
02:03 jberger as in the instance of mock objects
02:03 preaction so AnyEvent's condvars would be an excellent use of this
02:03 jberger you might want to test them later, that indeed they were called
02:04 jberger sure, condvars too
02:04 preaction well, in that example, you're returning a mock that then gets destroyed
02:04 jberger yeah, but you could create it first
02:04 preaction ah, right
02:04 jberger not sure if its useful to implement 'as'
02:05 preaction i could see "with" as an excellent thing for locking
02:05 jberger indeed it is
02:05 jberger python has that
02:05 jberger with thread.lock
02:05 preaction with ( my $whatever = TheThingIMade) { ... }
02:05 preaction so would that make this also a topicalizer?
02:06 jberger context managers (as they are called) are probably my favorite python thing, and thus, I want to make one for Perl
02:06 jberger that is an implementation detail
02:06 preaction isn't that what Coro does?
02:06 jberger but sure, why not
02:06 preaction the "context manager" thing
02:06 jberger (not sure following schmorp is the best idea)
02:07 preaction it's how coro does generators/yield, by (afaik) using Perl's multiplicity (fork emulation) to have multiple "interpreters" running
02:08 preaction so, in theory, the possibility for python's context managers exists in core Perl
02:10 jberger I'm not following
02:10 preaction and, imho, schmorp's code is excellent, using it just means potentially dealing with schmorp
02:10 jberger it is excellent, but his style is particular, and not necessarily worth emulating
02:12 jberger am I misunderstanding your word "topicalizer" I think it means "thing that sets $_" like 'for'
02:12 jberger ?
02:12 preaction yes, that's what i mean
02:13 jberger right, so having it set $_ is an implementation detail
02:14 jberger using it to store the guard object in a scope (with local) is probably not what you mean
02:14 jberger you don't want the guard object available to the outside world
02:14 jberger because you want to ensure that there are no other references to it
02:15 preaction no, i mean doing: with ( Mock->wrap( $myobj ) ) { ... } <- i need the object returned, the one that ENTER was called on
02:15 jberger for a true core context manager, I would want a better way to attach a "leave scope" handler than DESTORY
02:15 preaction interesting thing: there's no way to get a topic-only filehandle
02:15 preaction open my $_ ... except that
02:16 jberger ok, we are really off topic now
02:16 jberger :-P
02:16 preaction anyway, Coro: i'm not 100% clear on how coro does it myself, but from what i understand: Perl has a "thread context", dTHX. every time you have a perl, you have a dTHX. if you want multiple perls in the same process, you make multiple dTHX. Coro keeps track of those dTHX and passes the execution football around
02:17 jberger ah
02:17 preaction ... but somehow knows which context wants data from which other context...
02:17 jberger ok, but that is a totally different kind of "context" than what I am talking about here
02:18 jberger python's context is what we would call a scope
02:18 preaction right, but with generators/continuations, every scope could potentially be one of what Perl would consider a "thread context"
02:19 preaction (though it probably determines that at definition time)
02:20 preaction or maybe what "yield" means is "go back to the enclosing context, but keep this context open in case we come back"
02:20 jberger I still tend to believe that these are unrelated concepts
02:21 preaction you can do local imports in python, right? def foo(): import bar \ # bar is only available during foo()
02:22 jberger I don't know if the symbol binding is within scope of the function
02:23 preaction if so, it'd be even more similar: each perl dTHX has its own package tree, and the more i think about it the more it's awesome to have a tree of contexts, each with its own stashes and pads
02:24 preaction (except for overhead, of course)
02:27 jberger I'm not sure how pads are implemented, but I'm assuming its something like that already
03:01 basic6 joined #mojo
03:59 basic6_ joined #mojo
04:52 KCL_ joined #mojo
05:44 sujithm joined #mojo
05:47 sujithm_ joined #mojo
05:58 sri jberger: maybe this? https://metacpan.org/pod/B::Hooks::EndOfScope
05:59 sri perl6 has tons of nice phasers that would be noce to have in perl5 http://perlcabal.org/syn/S04.html#Phasers
06:08 denis_boyun joined #mojo
06:25 Negor joined #mojo
06:39 _WildPikachu_ joined #mojo
06:56 sujithm joined #mojo
06:57 sugar joined #mojo
07:01 * sri is still unsure about allowing routes to be changed at runtime
07:07 mishantil sri: Like adding or removing?
07:07 sri https://github.com/kraih/mojo/commit/4b9fc41a96aa85b7d342e2135dcc4c53fef0ca18
07:15 mishantil Ah. Right.
07:21 Vandal joined #mojo
07:24 dod joined #mojo
07:30 mire joined #mojo
07:31 hengaini joined #mojo
07:40 hengaini There is a js file, I want to use in html, such as "<script src="dojo/dojo.js" data-dojo-config="async: true"></script>"
07:41 hengaini The only thing is to put this file in directory "app/public"?
07:43 hengaini 重新载入页面以获取源代码: http://localhost:3000/dgrid/demos/multiview/multiview.js
07:44 hengaini 重新载入页面以获取源代码: http://localhost:3000/dojo/dojo.js
07:53 hengaini :P
07:58 dp_ joined #mojo
08:06 sri https://github.com/kraih/mojo/pull/649 # anyone got a use case for this?
08:16 fhelmber_ joined #mojo
08:16 sri the more i think about changing routes at runtime the more i tend towards a -1 vote :/
08:17 rawler joined #mojo
08:17 sri anyone who wants it to stay, now is your chance to speak up... otherwise it might be on the way out again later
08:22 odc joined #mojo
08:26 bowtie joined #mojo
08:28 LordVorp joined #mojo
08:32 basiliscos joined #mojo
08:35 sujithm joined #mojo
08:39 trone joined #mojo
08:40 trone joined #mojo
08:43 neyasov_____ joined #mojo
08:45 D4RK-PH0ENiX joined #mojo
08:46 bowtie joined #mojo
08:48 d4rkie joined #mojo
08:50 edestler joined #mojo
09:00 sujithm joined #mojo
09:13 sujithm_ joined #mojo
09:23 D4RK-PH0ENiX joined #mojo
09:33 sri does this sound reasonable? https://github.com/kraih/mojo/pull/649#issuecomment-49583723
09:34 sri crab: i belive you're responsible for most of that code
09:37 * crab reads
09:37 arthas joined #mojo
09:40 dotan joined #mojo
09:41 crab it might make sense, but the explanation sure doesn't make any sense to me
09:50 sri hmm
09:55 crab does it to you? even the test seems a bit odd to me
09:56 * sri agrees
09:56 crab i guess the functionality might not be entirely without merit, but the commits and explanation are totally whack
10:00 neyasov_____ joined #mojo
10:00 crab and if you're just appending, why O_RDWR anyway
10:01 crab maybe we should always open the file with O_APPEND and get rid of the seek (though i have no idea if that works on window)
10:01 crab windows
10:04 nic joined #mojo
10:05 * sri shrugs
10:06 sri crab: comment on the issue if you see something
10:06 sri i really like adding comments to the actual code
10:06 sri way underused github feature
10:07 sri https://github.com/kraih/mojo/pull/649/files
10:08 sri and the comments vanish with future commits to the pull request
10:39 sri crab: oh, the latest comment is better... and actually rather interesting
10:40 sri i suppose he breaks down the file on the client side into chunks, checks the current position on the server side, and then posts more chunks with ajax requests
10:49 sri if we do it, i suppose this is the correct patch http://pastie.org/9409210
10:57 sri i think i don't use the magical _ handle enough with file test operators
10:59 meshl joined #mojo
11:10 sri http://pastie.org/9409269 # this seems like the correct patch
11:10 * sri pokes crab, jberger, marcus and tempire
11:10 * marcus turns over on the other side
11:13 marcus such china, much wow, no understand
11:13 crab sri: why not O_APPEND?
11:14 crab otherwise, i have no objection to your patch, it looks good and the test actually tests what is changed
11:14 crab or what is advertised, perhaps
11:14 sri crab: why O_APPEND?
11:15 crab because we're only ever going to append to the file
11:15 sri no, i mean what are the advantages?
11:15 purl okay, sri.
11:16 sri O_RDWR is at least consistent
11:16 sri so i know it's portable
11:16 marcus I have no objections to that patch.
11:16 sri what are the implications of O_APPEND?
11:16 crab just to make our intentions clearer. i know there's no code in that module that can be tricked into overwriting bits of the file now, but still
11:17 crab so i guess i have no objections to the patch either. it's an extension rather than an objection.
11:18 crab implication of using O_APPEND is that you _can't_ write to anything but the end of the file. it's pretty basic POSIX-iness, but i can't say anything about the portability implications on windows.
11:18 sri you're welcome to work on switching to O_APPEND completely, but please check for portability problems
11:19 crab since i have no access to windows, would it be enough to commit and see if any of the testers breaks? or should i solicit testers on the list or some such?
11:19 sri solicit tersters certainly
11:19 crab i would be surprised if anything broke
11:19 crab but then i spend my days in constant surprise
11:19 sri this is not commit and see what break territory :o
11:20 sri you could also cpan grep and look for testers results
11:20 crab well, you've added new tests to catch portability problems in the past... but ok, sure. will do.
11:22 good_news_everyon joined #mojo
11:22 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/5szG6w
11:22 good_news_everyon mojo/master ce2bbf1 Sebastian Riedel: improved Mojo::Asset::File to allow appending data to existing files (#closes 649)
11:22 good_news_everyon left #mojo
11:22 sri oops
11:22 sri i messed up the commit message :O
11:23 good_news_everyon joined #mojo
11:23 good_news_everyon [mojo] kraih force-pushed master from ce2bbf1 to 5facbf6: http://git.io/BhzC7A
11:23 good_news_everyon mojo/master 5facbf6 Sebastian Riedel: improved Mojo::Asset::File to allow appending data to existing files (closes #649)
11:23 good_news_everyon left #mojo
11:24 dvinciguerra joined #mojo
11:31 sri crab: just to be clear, what exactly is your O_APPEND proposal?
11:35 jberger Looks sane to me
11:36 jberger Patch that is, no idea about APPEND
11:40 mr-fooba_ joined #mojo
11:41 nic joined #mojo
11:50 sri do we have a windows tester ready?
11:54 * sri hates how vague crab statements always are
11:55 sri soooo... as far as i understand the advantage of O_APPEND is that seek syscalls are not necessary when writing, correct?
11:55 sri http://pastie.org/9409361 # like this
11:55 sri is that portable?
11:56 sri that's a performance gain, which makes it much more interesting to me
11:58 mire joined #mojo
12:00 good_news_everyon joined #mojo
12:00 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/tenZyg
12:00 good_news_everyon mojo/master 76842a4 Sebastian Riedel: use less syscalls for appending to assets
12:00 good_news_everyon left #mojo
12:00 sri allright, please test this on windows
12:10 mishantil How much is mojo used on Windows these days? Is the windows-crowd a large one?
12:12 sujithm joined #mojo
12:14 mattastrophe joined #mojo
12:20 neilhwatson joined #mojo
12:36 Lingo joined #mojo
12:38 mire joined #mojo
12:41 crab sorry, i'll try to not make any more vague statements.
12:45 * sri pokes Adura and stephan48
12:54 crab though if my statements are always vague, maybe i should try not to make statements, only ask questions and maybe paste URLs.
12:58 sujithm joined #mojo
13:00 sri crab: you could also just get straight to the point, "if we use O_APPEND | O_RDWR we need less syscalls for writing and can improve the performance of Mojo::Asset::File"
13:01 sri it's like you always cut off right before the conclusion :)
13:02 sri you lay out some information... and i go all "BUT WHAT DOES IT MEAN?!!!"
13:05 Adura No fail.
13:05 sri thanks
13:05 sri \o/
13:08 crab ok.
13:15 sri btw. i'm still interested in comments about the router patch https://github.com/kraih/mojo/commit/4b9fc41a96aa85b7d342e2135dcc4c53fef0ca18
13:17 sri it does bring a certain consistency, but the use cases are weak
13:22 crab i see no need for it, but nothing in the patch makes me care enough to object.
13:24 sri i think the big negatives are that it might encourage bad design, maintenance cost, and small performance loss when defining routes
13:26 sri use cases so far are routes configured in a database (that sync regularly) and being able to change routes in unit tests
13:35 mishantil The way I see it is that most of those things would encourage bad design.
13:36 mishantil BUT; if there are no performance penalties then it can't hurt, much.
13:36 sri also a little worried about the need for more ->flush methods... as the renderer and friends also have caches
13:36 mishantil yeah.
13:37 sri basic6: if you want to argue for your feature... here's your chance
13:37 sri but it really doesn't look good... consensus so far is "meh"
13:37 sri -.-
13:45 mr-foobar joined #mojo
13:46 mattastrophe joined #mojo
13:50 good_news_everyon joined #mojo
13:50 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/qzpbng
13:50 good_news_everyon mojo/master 6519891 Sebastian Riedel: do not allow routes to be rearranged at runtime
13:50 good_news_everyon left #mojo
13:50 sri bye bye
13:56 genio sri: Where do I find documentation on the _ magicness you used earlier (just read through some of the scroll-back and I haven't seen that before)
13:57 sri perldoc perlop? dunno
13:58 genio yea, searching for underscores in a document is no fun.
14:03 sri basic6: you can put everything i removed into a pull request to have a vote, but unless you can get one or two core devs here on your side, i don't see much of a chance
14:05 doby joined #mojo
14:15 go|dfish genio: it's in: perldoc -f stat
14:20 genio go|dfish: ah.  thanks
14:21 dvinciguerra joined #mojo
14:22 gryphon joined #mojo
14:29 lb "As of Perl 5.10.0, as a form of purely syntactic sugar, you can stack file test operators, in a way that "-f -w -x $file" is equivalent to "-x $file && -w _ && -f _"."
14:29 lb did not know that
14:30 neilhwatson TIL
14:32 sri neat
14:34 neilhwatson lb: source for that?
14:36 good_news_everyon joined #mojo
14:36 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/TnMaQg
14:36 good_news_everyon mojo/master 7cb6a3a Sebastian Riedel: simplify route tokenizer
14:36 good_news_everyon left #mojo
14:38 neilhwatson Found it in perlfunc
14:38 * nic introduces new recruit to Mojolicious :)
14:39 genio neilhwatson: at the bottom of perldoc -f -X
14:40 lb yes
14:50 woz joined #mojo
14:52 woz Hello hive mind. Has anyone put together any docs/guide on how best to implement non-blocking code in perl modules?
14:53 lipizzan joined #mojo
14:57 genio woz: For a simple example of a Mojo::EventEmitter based module, take a look at Mojo::Log.  Without further knowledge of what you want to accomplish...
14:59 woz OK, thanks. I want to write a Perl interface to an in house app that offers a restful API.
14:59 genio and jberger's blog articles give nice intros to writing some non-blocking code.  http://blogs.perl.org/users/joel_berger/
14:59 genio http://blogs.perl.org/users/joel_berger/2013/10/writing-non-blocking-applications-with-mojolicious-part-1.html
15:00 woz But the interface will primarily be used by Mojo server apps.
15:00 woz Having attended Tempire's non-blocking training at MojoConf I feel I should really keep the whole non-blocking thing going!
15:01 * sri wonders how many people he met at mojoconf that he doesn't know the irc handle of :o
15:02 woz Yeah I know how to write non-blocking code within a Mojo app, looking for some guidance on how best to do that in a package
15:04 woz Hey Sri :-)
15:08 sri o/
15:30 dvinciguerra joined #mojo
15:31 good_news_everyon joined #mojo
15:31 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/nKGmOA
15:31 good_news_everyon mojo/master d32ddcc Sebastian Riedel: slightly faster route rendering
15:31 good_news_everyon left #mojo
15:38 cfedde joined #mojo
15:40 sh4 joined #mojo
15:42 bluescreen joined #mojo
15:48 Lingo joined #mojo
15:49 sujithm joined #mojo
15:50 meshl joined #mojo
15:59 Lingo_ joined #mojo
16:01 good_news_everyon joined #mojo
16:01 good_news_everyon [mojo] kraih tagged v5.16 at 57ab3ef: http://git.io/levlqQ
16:01 good_news_everyon left #mojo
16:02 good_news_everyon joined #mojo
16:02 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/wvO8wA
16:02 good_news_everyon mojo/master 3593a7b Sebastian Riedel: bump version
16:02 good_news_everyon left #mojo
16:04 * stephan48 pokes sri
16:09 condor66 hi all, would someone know how I can save results from my first loop on IOLoop->Delay before running the 2nd IOLoop? http://pastebin.com/LFY4nVwX - I have to send both subs to $delay_main to have them concurrent and finished before next step but then I have problems processing results from get_orderb and get_bal
16:10 stephan48 sri: http://paste.stejau.de/?543 when i cpanm master.zip
16:10 sri thanks, but not what i was looking for
16:11 stephan48 so what where you looking for?
16:11 sri has already been tested, it's all good now
16:11 stephan48 ok cool
16:12 sri your test results are hinting at a broken perl btw.
16:13 sri some connection close stuff i bet
16:13 sri (if you want to track it down)
16:14 stephan48 i will solve the issue by updating perl i think
16:25 davido_ joined #mojo
16:34 btyler joined #mojo
16:52 KCL joined #mojo
17:01 mire joined #mojo
17:06 Lingo_ joined #mojo
17:08 neyasov_____ joined #mojo
17:12 Lingo_ joined #mojo
17:20 berov joined #mojo
17:31 dod joined #mojo
17:36 mire joined #mojo
17:37 bobkare joined #mojo
17:44 bobkare joined #mojo
18:10 bobkare joined #mojo
18:25 bobkare joined #mojo
18:36 bowtie joined #mojo
18:39 neyasov_____ joined #mojo
18:47 disputin joined #mojo
18:53 disputin joined #mojo
19:06 bowtie joined #mojo
19:08 hummeleBop joined #mojo
19:23 basiliscos joined #mojo
19:30 dotan joined #mojo
19:33 dotan1 joined #mojo
19:39 bowtie joined #mojo
19:42 mattastrophe joined #mojo
19:47 edestler joined #mojo
20:05 sujithm joined #mojo
20:07 neyasov______ joined #mojo
20:15 bowtie joined #mojo
20:27 basiliscos joined #mojo
20:33 denis_boyun joined #mojo
20:34 bowtie joined #mojo
20:46 basiliscos joined #mojo
21:00 marty joined #mojo
21:03 basiliscos joined #mojo
21:06 _WildPikachu_ $r->route('/:number', number => qr/\d+/)   <= I'm trying this example, but with an $under , when I add the regex it doesn't seem to be matching, am I maybe forgetting something?
21:13 dotan joined #mojo
21:17 meshl joined #mojo
21:23 meshl joined #mojo
21:26 basic6_ sri: i'm just now reading the backlog (if you're still around). you and mishantil mentioned that providing that flush method would encourage bad design. could you elaborate on this, i'm not sure how this would lead to bad design decisions
21:33 bowtie joined #mojo
21:42 jberger basic6_: when the admins add a route, what does the target point to? A new page?
21:43 basic6_ jberger: yes, an admin would create a new page (stored in the db) for which a new route is created. that part already works now (even after the first req) though, what doesn't work "out of the box" is removing a route (if an admin removes a page)
21:44 jberger ok, so why does that have to be a new route?
21:44 jberger couldn't that just be a new target for an existing route?
21:45 stephan48 why don't you use placeholders?
21:45 jberger stephan48: that's what I was getting to
21:45 stephan48 oh sorry
21:45 basic6_ jberger: well using my exapmle with event pages: an admin creates a new page for "event1". so theres a new route /event/event1 (/event is fixed).pointing to that page
21:45 jberger no, its ok, I was going to let basic6_ get to it, but I'll take volunteers :-)
21:46 jberger so could the route be /event/:eventname ?
21:46 basic6_ well the "/event if fixed" part is not entirely true in my case actually
21:47 basic6_ because i also have some pages /main/specialevent (dynamic page). the other pages in /main/... are regular templates (htm.ep files) so its mixed
21:47 stephan48 jberger: i was about to go to sleep and wondered why he still is about with routes and why nobody suggested placeholders so i threw it in as a sort of drive by shooting ;)
21:47 basic6_ i don't think a placeholder would work in this case
21:47 jberger I believe I mentioned it in passing yesterday
21:48 stephan48 sure that will, just define your static templates first and then the placeholder as last route
21:49 basic6_ stephan48: you are right in the example i used yesterday, the /event/event1 routes looked like they could easily be replaced with placeholders, so i wouldn't need a flush at all. but like i said, my routes are mixed with static routes
21:50 jberger basic6_: your fear is that since /events is static, that /events/thingy couldn't be?
21:50 jberger badly worded
21:50 stephan48 just define /event/bla -> templatename, then /event/blub -> template-or-controller2 and then your placeholder /event/:eventname -> eventhandler
21:51 stephan48 it will just work
21:51 stephan48 mh.
21:52 stephan48 i will need to check the guides tomorrow
21:53 stephan48 if thats really not convered that might be a problem
21:54 basic6_ jberger: kind of -  i have all my static routes defined and then there are dynamic routes added. like /events would be static but /events/event1 would be dynamic. /main/general is static but there could be a dynamic route called /main/additionalinfo
21:55 WildPikachu tearing my hair out why my   $adminOnly->get('/users/edit/:userid', 'userid' => qr/\d+/)   route is not matching if I add the regex :(
21:56 basic6_ stephan48: since someone could add a dynamic route under a new "section" (if you will) like /main, i can't define the catchall route as /events/*foo
21:57 * jberger forgot to install Mojolicious::Command::nopaste on the new lappy :(
21:58 jberger http://pastie.org/9410485
21:59 basic6_ ok hold on, can i actually define a catch-all route? get('*anypage') that'll match anything and not break static routes? because i didnt think this was possible but maybe i should try that
21:59 jberger WildPikachu: you are adding userid to the stash
21:59 jberger WildPikachu: http://mojolicio.us/perldoc/Mojolicious/Lite#Restrictive_placeholders
22:01 WildPikachu http://mojolicio.us/perldoc/Mojolicious/Guides/Routing#Optional_placeholders  <= I was following this jberger
22:01 jberger check the arguments carefully
22:02 stephan48 basic6_: sure you could, i am not sure if thats the right syntax but it should be possible
22:03 basic6_ holy cow that actually works
22:04 basic6_ ok i need to think about that for a minute
22:05 WildPikachu jberger, thanks, got it  :D
22:05 jberger basic6_: now that you have gotten there, do you really think that something like that would be needed and sri wouldn't have it in there
22:05 jberger its almost never needed
22:05 stephan48 jberger: maybe this is worth a cookbook entry?
22:06 jberger stephan48: honestly, (and no offense basic6_) I kinda don't
22:06 basic6_ i just need to prepend a slash to get the request address, which i would use in the controller method to check if the requested page exists. in my current code, i loop through the dynamic pages and add them as routes but use their id for identification get(/$adr, {page_id => $id}) like that
22:07 stephan48 jberger: maybe you are right
22:07 stephan48 and now really good night ;)
22:07 jberger stephan48: nn
22:08 jberger basic6_: I think you are probably still over thinking it, but ... good luck :-)
22:08 basic6_ but this also means it is an actual catch-all route. any request that doesnt match a static route (would lead to a 404) would be directed to that page controller. using dynamic routes, only the requests matching existing dynamic pages would be redirected, and i think this could make a difference...
22:09 basic6_ because if i would write a different page controller method for other dynamic pages some time in the future (maybe different kind of page), those would all end up at one controller method. but they should be separated.
22:10 basic6_ not sure if you know what i mean
22:10 jberger when you talk about a "static route" do you mean a route that doesn't change target or a route that points to static content, like a pure html file
22:10 jberger ?
22:10 KindOne joined #mojo
22:10 jberger basic6_: you can't possibly be adding controller classes at runtime??
22:11 basic6_ by static route i mean a route that points to static content in a html.ep template file and it's defined in the startup method
22:11 jberger static content is like an image?
22:12 basic6_ by "static content" i'm now referring to html content (html.ep files), not images, as opposed to dynamic content coming from a db
22:12 basic6_ no i dont want to add controller classed, i should rephrase that...
22:13 jberger ok, well I would think of templated content as "dynamic" and the source of the data is not relevant
22:13 throughnothing joined #mojo
22:14 jberger the data that is in the db, do you template it, or does it get piped straight to the client?
22:16 Kundun joined #mojo
22:16 jberger basic6_: make a tiny demo, like the one I made, and let me see where the sticking point is
22:16 basic6_ hm i'm not very good at explaining myself... so using placeholders is the catch-all approach, after all the regular/static routes in the startup method (those all point to html.ep files but thats not important) i'd add a ('*anypage')->to("Controller#page") route that would take any incoming request and fetches the dynamic page data from the db and puts it in its template...
22:17 jberger basic6_: make a tiny demo, like the one I made, and let me see where the sticking point is
22:17 jberger that's generally the idea, yes
22:18 jberger the "catch all" typically codifies the paths to types of resources
22:18 basic6_ yeah a demo would probably help, altthough unfortunately i gotta go now, maybe i'll have some time on thursday or friday, i can write a demo then
22:18 jberger like /events/:event
22:18 jberger or /admin/:task
22:19 basic6_ sure i mean i'm using placeholders all the time for things like /article/#name because i know what the addresses look like and i know where to send the request (to the article controller method)
22:19 jberger http://galileo-cms.herokuapp.com/page/home
22:20 jberger ok, so how is it that you wouldn't know that in your case?
22:20 jberger you have to be handling it somewhere
22:22 basic6_ the catch-all route would be catching *everything* (which would otherwise result in a 404) and point to one single controller method. but that method is only for dynamic pages. maybe i want to add dynamic (othercontent) thats not pages in the future, that would have to point to a differen tcontroller method? those might be in a db as well so a single catchall route, routing *everything* to *one* method wouldnt work anymore
22:24 jberger then you would add the action/controller that handles those, I'm really not seeing the problem
22:24 jberger look at line 13 of my demo
22:24 basic6_ a different way to put it might be: the content of the dynamic pages is in the database, along with their address (route). but the type of page would also be in the db and this type might define which controller mthod to use, i dont know how a catchall route would be ablerto do this
22:24 jberger you still render a 404 if the page doesn't exist
22:25 jberger then you just have a dispatcher controller
22:25 jberger Does this path exist in my database? If so render it
22:27 jberger if you have no more defined structure to your paths than that, then that's all you can do
22:29 basic6_ sorry to interrupt, i'm looking at the time, i need to go some, i'm late. maybe i'll come back tomorrow, maybe thursday... would be great if we could continue the discussion then
22:29 jberger sure
22:29 basic6_ thank you so much for your input so far, i think we're getting somehwer
22:29 basic6_ anyway gotta go
22:29 jberger o/
22:29 jberger its almost beer o'clock for me too
22:32 throughnothing joined #mojo
22:45 alnewkirk joined #mojo
23:38 dvinciguerra joined #mojo
23:40 D4RK-PH0ENiX joined #mojo

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