Camelia, the Perl 6 bug

IRC log for #mojo, 2011-04-10

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

All times shown according to UTC.

Time Nick Message
00:02 trcjr left #mojo
00:40 zoo-zed left #mojo
02:33 lobo joined #mojo
02:39 lobo I have a bridge in my routes to check the user is authenticated and I want to send the user to the login page Ive been trying to use this $r->route('/(*)') to match everything but it does not work, should this work or is there a better way?
02:40 lobo I'm trying to match everything when the user is not authenticated by putting the catch all route after the bridge
05:46 tempire lobo: You're going about it incorrectly.  You create a bridge and store it in a variable, then use that variable to build the routes you want to be protected.
05:46 tempire example: http://mojolicio.us/perldoc?Moj​olicious/Guides/Routing#Bridges
05:53 tempire lobo: another example: http://pastie.org/1777767
07:25 sri memowe++ # https://github.com/memowe/Bootylite
07:25 sri back to basics
07:32 lobo tempire: my question may not have been worded the best, I just want to catch all requests which don't get authenticated, this is what I have http://pastie.org/1777938 but the wildcard at the end does not work as I would expect which would be to redirect any requests not authenticated to a login page.
07:32 lobo I just get 404 not found
07:42 sri lobo: only one endpoint can match
07:44 sri the growing guide actually has examples for what you want to do
07:54 lobo sri: Ive tried implementing the examples into my little working app but none seemed to do what I want, I think I need to go back and try one of the examples as a lite app, I dont like lite apps :)
07:57 sri there is no big difference between normal and lite apps
08:01 lobo yeah I know, Ive read that allot but its enough to confuse me, I was using cgi app but mojolicious is obviously cooler, im sure once i figure it all out Ill realise how easy it  is
08:01 sri :)
08:02 lobo I dont make my living doing this :)
08:03 sri http://mojolicio.us/perldoc?Mojoliciou​s/Guides/Routing#Wildcard_Placeholders
08:03 sri this is how wildcard placeholders work
08:03 sri all our placeholders are named
08:04 lobo I was just reading it, again I think
08:05 sri http://mojolicio.us/perldoc?Mojol​icious/Lite#Wildcard_Placeholders
08:05 sri maybe that's more your style
08:08 lobo So the method of catching requests no authenticated after the bridge is not wrong?
08:09 sri it is, but the route itself is wrong too
08:09 lobo I also realised I had left out some brackets in my paste http://pastie.org/1777938 is corrected now
08:09 Foxcool joined #mojo
08:10 sri still wrong
08:10 sri all placeholders need a name
08:11 lobo ahh, that serves me right for using code from another app
08:11 sri sub check { ...return $self->redirect_to('/login') unless $logged_in;... }
08:12 sri you want something like that
08:13 lobo right, I downloaded several mojo apps from git hub and followed one that seemed logical, their app must be broken or they are very tricky
08:14 sri i still thnk the growing guide does exactly what you want
08:15 daviddelikat joined #mojo
08:15 lobo ok Ill go have another play, thanks for you help
08:16 daviddelikat1 left #mojo
08:55 sri sure, it's really best to start learning with a lite app btw
08:56 sri at least for the basics
09:17 lobo I did write a few little things with it but diddnt like the prospect of refactoring it, my app works fine, I got all the hard stuff working, DBIx etc patched in nicely and TT too as I know that file uploads an serving out files was all straightforward, I think my trouble is the routing is so flexible and Ive found several ways of doing it in the applications Ive looked through so still not...
09:17 lobo ...quite understanding it fully
09:48 GitHub196 joined #mojo
09:48 GitHub196 mojo: master Sebastian Riedel * 5adebdd (1 files in 1 dirs): cleanup - http://bit.ly/ecB8oQ
09:48 GitHub196 left #mojo
09:49 arpadszasz joined #mojo
09:51 diegok Hello. Is there some work on a dbic plugin or a reason for not doing that?
09:51 sri nope and nope
09:52 sri (at least as far as i know)
09:52 diegok sri: nice, I was wondering about this since some time, I can't go back to write SQL :P
09:53 diegok and I did used dbic on one of my first mojo app but I did in the wrong way :)
09:54 diegok I'll play with this after finishing with a f* php/js contract at the end of this week :)
09:55 sri eww
09:55 lobo sri: Ive gone through the example in the growing guide and still cant see how I can catch all requests that are not authenticated without sticking sub check { ...return $self->redirect_to('/login') unless $logged_in;... } on every route I want protected, is that what's required or am I still missing something?
09:55 sri and yay
09:55 sri lobo: you can't
09:55 lobo cant catch all?
09:56 sri that's what i was trying to say the whole time
09:56 sri only one route can match
09:56 lobo oh well at least I have figure that out now
09:56 sri there is also a good reason why you can't
09:57 lobo Im sure there is
09:57 sri mojolicious will by default always encourage good RESTful design
09:57 sri so in this case a 302 redirect
09:59 lobo I guess I should go read about RESTful design, it does seem like I will have to rethink my routing to save pasting that checking sub allot.
10:00 * sri doesn't follow
10:00 sri you can put all routes that require authentication under $auth
10:01 sri and have them redirected to /login if necessary
10:01 sri which could be the only route not under $auth
10:01 sri that's the design from the growing guide
10:03 diegok sri: the other say I gave the mojolicious talk to a non perl audience and a java guy asked why we return a 404 when the same action exists for another verb (he said it should be 406)... this strange java pple!
10:03 diegok :)
10:03 diegok s/say/day/
10:03 sri :)
10:28 lobo sri: is this the growing guide you're talking about?  http://mojolicio.us/perldoc​?Mojolicious/Guides/Growing it has no mention of $auth so am wondering if Im looking at the right guide? I was thinking that $auth would be a bridge but that example does not use a bridge
10:37 dekimsey left #mojo
10:38 dekimsey joined #mojo
10:41 lobo sri: Ive figured it out, I did not realise I could render the login page and also return undef to the bridge, I knew it would be easy and make me feel stupid, sri, thanks for your patience
10:59 lobo left #mojo
11:20 memowe sri: thanks :)
11:57 perlrocks Twitter: "@ Yapp_ru Slashal that Sebastian has been developing an ORM to Mojolicious ... Is this true and at what stage of development?" (ru) --xomaa http://twitter.com/xomaa/status/57049477940383744
12:26 crab joined #mojo
12:45 shurex joined #mojo
13:15 arpadszasz left #mojo
13:42 lbr joined #mojo
13:43 lbr left #mojo
13:48 baton8 left #mojo
13:50 baton8 joined #mojo
13:50 baton8 left #mojo
13:54 AmeliePoulain joined #mojo
14:07 baton8 joined #mojo
14:34 shurex1 joined #mojo
14:37 shurex left #mojo
15:51 arpadszasz joined #mojo
16:09 GitHub120 joined #mojo
16:09 GitHub120 mojo: master Sebastian Riedel * d13be89 (3 files in 3 dirs): improved HTML healing capabilities of Mojo::DOM - http://bit.ly/i6frCR
16:09 GitHub120 left #mojo
16:09 sri :)
16:11 sri it's rather smart about html now
16:16 perlrocks Twitter: "Had a lot of fun today teaching the #mojolicious dom parser how to repair broken html. :) http://t.co/alDLG96 #perl" --kraih http://twitter.com/kraih/status/57114779248115712
16:22 * sri pokes marcus and janus
16:22 sri see, that's how a feature request can go
16:34 Foxcool left #mojo
16:34 kaare joined #mojo
17:05 trone_ is now known as trone
17:31 Foxcool joined #mojo
17:34 trone_ joined #mojo
17:38 trone left #mojo
17:41 trone_ is now known as trone
18:00 abra joined #mojo
19:13 Alias_ joined #mojo
19:16 Alias left #mojo
19:28 Foxcool left #mojo
19:39 Foxcool joined #mojo
19:43 yegor joined #mojo
19:49 Foxcool left #mojo
20:08 madManchegan joined #mojo
20:09 anubis666 joined #mojo
20:11 anubis666 hello)please help me ,with DBI in mojolicious::lite
20:12 anubis666 :(
20:13 moritz if you ask a question, maybe we can answer.
20:15 moritz try  use DBI;
20:17 anubis666 I dont speak english((  I wrote a simple code using the DBI: mysql. after the application is run in daemon mode, after a page request / find_result application hangs
20:18 anubis666 my code http://pastie.org/1780126
20:19 moritz with "after" you mean that the page is rendered as you want it, but the server doesn't respond to requests after that?
20:20 moritz or does it hang before the page is rendered?
20:22 sri what moritz asked
20:22 sri think i have the same hunch as moritz
20:22 anubis666 Well like I ask / find => displayed after you enter a query and clicking the button, should open / find_result but the application hangs and does not display the page
20:24 moritz how many rows does the query return?
20:25 anubis666 ~50
20:27 sri where does the code actually hang/
20:27 sri ?
20:29 anubis666 http://pastie.org/1780126 ?
20:29 sri which line?
20:30 anubis666 what? (
20:31 sri you said the code hangs
20:31 sri you need to be more specific
20:31 sri don't think we'll be able to help without details
20:32 moritz you can add  $self->app->log->debug("message") calls to see how far it gets
20:32 moritz or warn()
20:32 moritz or die()
20:33 sri which language do you speak?
20:34 anubis666 when there is a page request / find_result there is a connection to the database, and are selected from a database of 50 rows. then they vydayutsya page. but this does not happen
20:35 anubis666 Russian
20:35 sri oh, russian is good
20:35 yegor 41 string -> infinite loop
20:36 sri there are quite a few mojolicious users in #ru.pm
20:36 moritz vydayutsya?
20:36 sri quite sure you can get an answer there asking nicely in russian
20:37 yegor fetchrow_array returns array of undefs in list context
20:37 sri or maybe you're lucky and eagle eye yegor spotted the error already
20:37 kaare left #mojo
20:39 yegor just maybe )
20:40 anubis666 yegor do you speak russian?
20:41 sri you should really try #ru.pm
20:41 sri there's a whole community waiting
20:42 anubis666 Ok)
20:45 moritz one pattern which I found nice is
20:45 moritz $sth->bind_columns(\my ($a, $b, $c));
20:45 moritz while ($sth->fetch) {  # use $a, $b, $c here }
20:46 moritz it's also quite efficient
20:51 * sri just noticed Mojolicious::Plugin::Database doesn't handle reconnect
20:51 sri not so nice
20:52 sri wanted to recommend it... but it doesn't really help
20:53 arpadszasz left #mojo
20:54 anubis666 left #mojo
20:55 madManchegan left #mojo
21:17 perlite_ joined #mojo
21:20 perlite left #mojo
21:20 perlite_ is now known as perlite
23:37 sigue left #mojo
23:39 sigue joined #mojo
23:49 crab hi.

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