Camelia, the Perl 6 bug

IRC log for #mojo, 2013-09-23

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

All times shown according to UTC.

Time Nick Message
00:21 btyler joined #mojo
00:25 asarch joined #mojo
01:01 hrupp joined #mojo
02:53 dotandimet joined #mojo
03:58 preflex_ joined #mojo
04:35 dqw5 joined #mojo
05:08 basic6_ joined #mojo
05:58 Lee joined #mojo
06:04 yakudza joined #mojo
06:13 k0xa joined #mojo
06:38 lukep joined #mojo
06:55 denisboyun joined #mojo
06:58 Vandal joined #mojo
07:00 basiliscos joined #mojo
07:07 themage joined #mojo
07:09 highflying joined #mojo
07:11 maxhq joined #mojo
07:19 dod joined #mojo
07:29 McS joined #mojo
07:29 McS Moin altogether
07:36 marcus Moops is pretty shiny - https://metacpan.org/module/Moops
07:38 bpmedley joined #mojo
07:47 trone joined #mojo
07:52 fhelmber_ joined #mojo
07:56 ver joined #mojo
08:18 Dandre Hello,
08:18 Dandre Is there any way to do client ssl authentification with morbo http server?
08:19 Dandre or must I use apache ?
08:23 basiliscos joined #mojo
08:27 batman client...?
08:32 Dandre agent
08:34 Dandre I am using morbo and I want to authenticate the agent connecting to my server application with ssl certificates. I don't know how to do this
08:35 Dandre in fact I want to replace basic http athentification by ssl certificate based authentification if possible
08:36 marcus Dandre: morbo is a development server, and not meant for production.
08:37 batman Dandre: do you want to know how to configure mojo-useragent, the daemon or both?
08:38 batman morbo myapp --listen https://*:8443 # or something
08:38 marcus batman: he wants to do certificate auth
08:38 batman oh.
08:38 * batman escapes the conversation
08:39 marcus Dandre: you probably want http://search.cpan.org/~tempire/Mojol​icious-Plugin-SslAuth-0.07/README.pod - and to use hypnotoad
08:42 Dandre Ok I'll try hypnotoad
08:43 yakudza joined #mojo
08:48 d4rkie joined #mojo
08:48 Dandre I haven't found how to do sslauth with hypnotoad
08:54 marcus Dandre: did you look at the plugin documentation?
08:54 marcus Dandre: you would have to do it in your code
08:54 marcus if you want it configurable, you should do it in a frontend proxy/webserver
08:55 Dandre yes but I don't  see how the server will request the agent side certificate
08:56 Dandre I'll try to run hypnotoad to see if this is automatically done
08:56 marcus Dandre: Maybe tempire can help you, when he wakes up.
08:57 Dandre ok
09:15 fhelmber_ joined #mojo
09:16 fhelmber_ joined #mojo
09:26 marty joined #mojo
09:39 ZadYree joined #mojo
10:11 marty joined #mojo
10:23 rem_lex|pivo joined #mojo
10:35 denisboyun joined #mojo
10:37 arthas joined #mojo
10:43 batman is there a way to change layout from the default layout which is set in template or in a route variable?
10:44 batman i'm trying to do before_dispatch => sub { $_[0]->stash(layout => undef) if $self->param('no_layout') } without any luck
10:44 batman ...since the other occur later on
10:47 mire_ joined #mojo
10:49 marty batman: https://gist.github.com/MadMartigan/4527228
11:05 batman marty: but % layout 'foo'; # will set layout to "foo" from the template
11:06 batman i think i need to add another helper for this
11:06 batman maybe_layout() or something
11:11 hummeleBop joined #mojo
11:13 yakudza joined #mojo
11:26 marcus Dandre: it's likely that it happens automatically
11:33 basiliscos joined #mojo
11:37 asarch joined #mojo
11:38 * sri wonders if he was going to make a Mojolicious::Command::generate::mango_app with a CRUD example if it should be included in Mojolicious or Mango
11:39 crab in mango.
11:40 crab (not an objection, but rather a positive feeling that it'd fit more naturally in mango)
11:55 marcus I like the idea, and I agree with crab.
12:02 Vandal joined #mojo
12:05 Dandre me too
12:10 sri another question is what a minimal CRUD example would cover
12:11 sri like auth for CUD and public R
12:12 sri config file for mongodb:// URI and auth password i suppose
12:16 sri minimal blog/cms maybe, one collection and only two fields... articles -> title/body
12:16 marcus sri: https://github.com/sferik/rails_admin :D
12:16 sri it would have to be easy to modify
12:17 sri marcus: ummm... that's not even close to minimal
12:17 marcus sri: agree, it's awesome :)
12:17 sri and there goes my motivation
12:19 marcus django-admin is good too.
12:19 marcus https://docs.djangoproject.c​om/en/dev/ref/contrib/admin/
12:19 marcus sri: Oh well.
12:20 sixBB joined #mojo
12:32 n0n joined #mojo
12:33 sri this is why we can't have nice things
12:36 iankent joined #mojo
12:37 sixBB I've got this other complaint from Brett, who says you shot him again.
12:42 marcus sixBB: bot?
12:42 sixBB no
12:42 marcus sixBB: Who's Brett?
12:42 sixBB http://archer.wikia.com/wiki/Brett_Buckley
12:43 marcus oh, him. I like him.
12:47 iankent qq, how can I override render_exception per-controller? this change to mojolicious implies you can (https://github.com/kraih/mojo/compare/69f​bd6807611ec209eff4147b511c8c324a80118...d​9145abedbbebe226f9f6f3b22488de88809ba4d ), but this commit undoes it (https://github.com/kraih/mojo/commit/76​e71e2cec7c189d7eb0450225c4a17df6581dc0 ) - is it possible?
12:53 sri not possible
13:08 iankent so, seems I can replace it per-controller but only if I call it from that controller with $self->render_exception, but it doesnt catch any exceptions - starting to think i'm going about it all wrong...
13:12 sixBB hello.  is there any pre-done mojolicious applications, such as a basic content management system that one can customize?
13:12 sixBB like wordpress written in perl'
13:13 sixBB for mojolicious
13:13 bpmedley joined #mojo
13:19 Adura sri was working on one, or so above lines imply.
13:29 sri Adura: not anymore
13:30 sri if rals_admin is what's expected from a CRUD example these days i'm not even close to having enough time
13:30 sri personally i think rails_admin is a shitty example, but nobody disagreed with marcus
13:32 sixBB is there anything close?
13:38 sixBB something, perhaps, that's better than this:  http://raptor.perlpowered.com:45790/
13:40 batman sri: i think it's waaaaaaay toooo ambitious.
13:40 batman will probably make me delete more code than i keep from the example
13:42 batman i would like a super basic authenticate (not authorize) and create/delete/update a document
13:43 bowtie_ joined #mojo
13:46 sixBB funny
13:46 sixBB that's what i'm working on
13:47 bluescreen joined #mojo
13:52 sixBB this is what I have so far:  http://miixf33ztnabivchaktostsw.pastebay.net/1300​480?p=qzau08zcdahn1kzyocizq6f2&submit=unlock
13:53 btyler joined #mojo
13:58 dqw5 joined #mojo
14:11 sri batman: that was my original plan
14:11 batman sri: sounds like a plan.
14:11 batman i think an example should be as slim as possible
14:12 batman adding to much fluff makes it appear as two examples in one :/
14:13 batman i do agree on the Mojolicious::Command::generate::mango_app command being part of Mango
14:19 Vandal joined #mojo
14:21 gryphon joined #mojo
14:22 denis_boyun joined #mojo
14:25 sri marcus: ok, i'm not unsure anymore... you're very f*cking wrong... rails_admin is a terrible example
14:32 sh4 joined #mojo
14:35 sri hmm, perl 5.19.4 broke mojolicious
14:36 sixBB is taht the current bleeding edge version
14:37 mire_ joined #mojo
14:46 gatitskiy joined #mojo
14:52 dotandimet joined #mojo
15:03 sri ah, looks like it's just a certain build that broke it, not 5.19.4 in general
15:12 n0n joined #mojo
15:17 denisboyun joined #mojo
15:17 fhelmbe__ joined #mojo
15:20 marcus sri: It might not be a good example, but it's a great admin tool for app devs
15:23 sri marcus: you're welcome to build it
15:23 marcus sri: I don't have time for that either ;)
15:24 sri then why bring it up in a discussion about examples? :S
15:25 marcus sri: I did put an :D after that url... I never said it's rails admin or nothing.
15:25 marcus sri: It's just the best crud tool I know of.
15:26 marcus sri: and if 'does marcus have the time to build it' is the standard, you should probably stick to 'Hello World'.
15:31 tianon sri: I'd definitely agree that rails_admin is not a good "here's how to integrate Mango in your Mojo application" example - something much simpler would be very cool :)
15:34 btyler sri: how do you feel about tiny games? a rock-paper-scissors tournament app with real-time multiplayer and persisted accounts/match history could be a neat, simple example. I guess maybe not the domain you'd want to showcase, but it seems like it'd exercise things well
15:34 btyler and maybe too js heavy, hm
15:38 sri i don't want any js
15:38 btyler roger
15:38 sri the most minimalistic CRUD skeleton app possible
15:39 sri soemthing you'd start 99% of your apps with
15:40 btyler but which isn't 'miniblog' or one of the other common rails examples?
15:41 sri what miniblog?
15:41 basiliscos joined #mojo
15:41 sri what does it matter if it's a common rails example?
15:41 k0xa_ joined #mojo
15:42 btyler was just trying to clarify the goal - simple and original is harder than simple and already often used as a simple example
15:42 sri original is not a goal
15:42 btyler understood
15:42 sri 99.9999% of all apps are not original
15:44 sri i was thinking a normal full mojolicious app, with one controller, one model class, authentication bridge for one user defined in a config file, and helpers to get mango/the model instance
15:46 sri possibly a partial template for navigation
15:46 sri no css, but clean semantic html5
15:49 tianon that sounds really awesome, sri
15:51 denisboyun joined #mojo
15:53 McS left #mojo
15:53 sri i don't think it really matters what the app is about (pretty sure it will be a blog), because you don't need a schema with mango/mongodb
15:53 sri the basic strucutre is what matters
15:56 btyler ok, apologies, I was focused on the wrong part
16:19 denis_boyun_ joined #mojo
16:58 mire_ joined #mojo
17:00 salparadise I am trying to send the right form post authentication to a Mojo::UserAgent request, what is the best way to debug what is sent? is there like a browser plugin anyone recommends and maybe an example script?
17:00 gryphon joined #mojo
17:01 sri MOJO_USERAGENT_DEBUG=1
17:01 sri MOJO_DAEMON_DEBUG=1
17:02 salparadise sri: thanks
17:03 dvinciguerra joined #mojo
17:07 TheCrimsonRadish joined #mojo
17:09 gatitskiy joined #mojo
17:09 d4rkie joined #mojo
17:18 marcus sri: Something you start 99% of your apps with => 'login', 'register', 'change password'.
17:26 batman marcus++
17:39 basiliscos joined #mojo
17:51 sri marcus: and you want to contribute that code?
18:04 sri anyway, decision how i want the example is made... anyone who wants to change that can send patches (put up or shut up!)
18:05 sri there's been too much pointless talk recently
18:17 batman marcus: i think we've messed up Mojo::Redis :(
18:17 batman we're emitting error() events on both command errors and connection errors
18:20 batman not sure if that's the best idea :(
18:21 sri pretty sure i warned you about that before
18:22 sri although i consider many connection errors to be command errors too
18:22 * sri only emits error events for errors that happen when no command/operation is active
18:23 batman sri: yeah, but the Mojo::Redis module was around way before i got involved
18:23 batman and then you pass on ($err, $res) to all callbacks?
18:23 sri yes, or $res->error in the case of Mojo::UserAgent
18:23 sri depends on context
18:24 sri i made that decision before the $err as first argument convention became popular
18:24 sri (though)
18:25 batman "became popular" by other than #mojo?
18:25 sri it's the node.js and derivatives way
18:26 batman ok
18:28 batman i think i need to fix ::AssetPack now
18:28 batman prevent it form overwriting files when apps are not available...
18:29 batman *from
18:37 marty Does anyone have hints/examples of how to use full text search via mango?    I'm trying via ->command() but no joy. :(
18:38 sri via ->command()
18:38 tianon marty: are you running mongod with the command line flag to enable it?
18:40 marty sri:  like this...   $db->command('text' , {search => 'my search'} );
18:40 marty tianon: yes
18:40 sri dunno
18:40 tianon marty: figured, just checking :)
18:40 marty I can search from the mongo shell.  but I am unable to translate it into a query for mango
18:41 sri pretty sure hash as second argument is not supported though
18:41 mire_ joined #mojo
18:41 sri look at the pod
18:41 marty looking...
18:42 * sri just deleted his mango example code
18:43 sri instead i'm gonna dictate a validation system for mojo core :o
18:43 marty deleted mango code?  That's blasphemy!   :)
18:55 sri hmm... my $validator = $self->validator->for('name')->is('not​_empty')->for('password')->is(equal_to => 'password_again'); my @rules = $validator->failed; my $name = $validator->valid('name');
18:55 sri ok, i think i have a design
18:57 sri app->validator is a factory that holds all the checks and $c->validator generates new instances on demand
18:57 sri suppose it'd app->validators
18:57 sri *+be
18:58 sri app->validators->add_validator(foo => sub {...})
18:58 marty that design is very easy to read.
18:59 sri and $c->validator() would call app->validators->build_validator($c) creating a new instance connected to the current controller and to which you can assign rules
18:59 batman sri: will it be a mojo plugin or a Mojo::Validator module?
18:59 sri Mojolicious::Validators i suppose
18:59 batman sri: i really want to be able to use it in my models without needing Mojolicious::Controller
19:00 sri it's not the end all answer for validation, but a good allrounder, like Mojolicious::Sessions
19:00 batman sessions <3
19:00 sri i don't see standalone use as an option
19:02 batman ok.
19:02 batman i'm testing this now http://p.thorsen.pm/a4bbd43e59f9
19:03 sri mojolicious couldn't really provide validation if the goal is to use it on the model layer imo
19:03 dotandimet joined #mojo
19:04 sri batman: that tells me absolutely nothing
19:04 sri if you want to show something include usage examples!
19:06 sri btw. i won't include error messages from the start, there will just be a {field_name}->{rule_name} map for now
19:07 sri like {name => ['min_length', 'not_empty']}
19:07 batman sri: http://p.thorsen.pm/593f9552a6f7
19:18 sri hmm, more standalone might also be possible if i make it use the structure generated by Mojo::Parameters::to_hash as input
19:19 batman i think validation is so incredible hard that i would not put it into core :(
19:19 batman so many are still trying to make it right...
19:19 sri i don't care anymore, if i get it wrong so be it, nobody else is gonna try anyway
19:20 sri it gets an experimental sticker and good
19:20 batman there are some mojo plugins...?
19:20 marcus I've been using vti's Input Validator in my projects
19:20 marcus it's got some flaws too, but yeah, it's a very hard problem
19:22 marty as far as I can tell (and I hope I am not missing the obvious) there is no way to use full text search in mango atm.
19:23 sri marcus: what are you trying to say?
19:25 marcus sri: I'm saying there are many validators on cpan, but not many good ones. I hope you can make something that's useful for the mojo core tho.
19:26 marcus After all, it won't be your first validator project :)
19:27 sri surely you remember that i'm the author of one that has been rather popular in its day ;p
19:27 sri haha
19:27 sri no html generation this time though
19:28 marcus sri: less is probably more in this context. and maximized for flexibility
19:28 marty I want <blink></blink> in my validator!!!
19:29 sri <blink> is dead marty, <blink> is dead
19:29 marty :O
19:30 * marty is playing with his new iphone 5s
19:30 sri :O
19:30 marcus marty: is it making you a happier person?
19:31 marty mesa is a happy uh
19:31 marcus it's not for sale here yet
19:31 marty oh gawd, i just farted a jar jar joke
19:32 marty it seems nice.  It's my first iphone so just trying it out.  the screen is nice and the build quality is very very good.  only time will tell if it make me more productive than my android phone did
19:34 marcus marty: did you get the dead cower?
19:34 marty dead cower?
19:35 marcus dead cow cover?
19:36 marty ahhh.  nope, just the phones for now.  not sure what cover to get.  I wanna get a game controller hookup so I can trash my console and waste more time without leaving my desk
19:37 marcus hehe
19:37 marcus I want to test steam now
19:37 marcus http://www.penny-arcade.com/report​/article/valve-announces-...-steam
19:38 marcus btw this humble bundle is great value for money https://www.humblebundle.com/
19:38 marcus I bought it even tho I had 4 of the games already :)
19:38 marcus marty: did you get the gold one btw?
19:41 marty marcus: I got the black.  I guess the gold was sold out first day.   I was surprised they had any left actually and I was able to pick up 3 of them.
19:41 basic6_ joined #mojo
19:41 marcus mmm
19:41 marcus I see they sold a buttload of them
19:41 marcus even tho they didn't launch world wide even
19:42 marty yep, the sales guys said it was a nut house in the store for quite a while.
20:16 batman sri: the thing about validators is that i always end up wanting them in my models and not in my controllers
20:18 dotandimet joined #mojo
20:25 sri batman: which would mean you can't ever have generic validators
20:25 sri only ORM/ODM validation, nothing else would work
20:26 sri also, passing back validation errors from the model to the view is annoying
20:27 sri stateful, and you can't touch the controller instance
20:30 sri basically, unless you have something as sophisticated as ActiveRecord your validation will be garbage
20:31 sri mojolicious won't ever have that, so validation in controller is the way to go as our default
20:32 sri i'm aiming for something like validation in play framework or laravel
20:38 sri my conclusion is that if you want validators in your model they are prolly already there and you can safely ignore mojo core validators
20:41 sri and if they are not there already and you still want them... may cthulhu have mercy on your soul
20:52 sri only thing i'm not sure about is how to pass values to the validator
20:54 sri in play the validator is tied to the request, and all validations you add persist to the reponse
20:54 sri $c->validator->max_length('foo', 20); $c->validator->min_length('foo', 7);
20:55 sri $c->validator->errors;
21:09 sixBB joined #mojo
21:31 sri think i've figured it out :)
21:32 sri my $v = $c->validator; returns a Mojolicious::Validators::Validator object where $v->data($c->req->params->to_hash) has been called automatically
21:33 sri you just add your rules by calling methods on it and start the actual validation on demand
21:36 sri $v->field('name')->min_length(7​)->max_length(30)->error('Name needs to be 7-30 characters long');
21:37 sri not sure how i tie errors to rules yet
21:38 sri min/max could just be ->range() though
21:38 sri error messages prolly only apply to the previous rule
21:40 sri and for documentation purposes i suppose all built in validators go into Mojolicious::Plugin::DefaultValidators
21:46 dotandimet joined #mojo
22:04 sri of course the next problem is getting the error messages to the template... hmmm
22:05 sri suppose the last validator could be assigned to the stash automatically
22:06 sri oh, $c->validator could keep the created validator stored in the stash and the next $c->validator call picks it up again
22:07 sri odds are you don't want more than one per request
22:07 sri and if you do you can always build one yourself
22:08 sri that's good, pretty close to how it works in play framework
22:12 dvinciguerra joined #mojo
22:14 TheCrimsonRadish joined #mojo
22:37 sri ah, revel also does it that way
22:58 zivester joined #mojo
23:06 basic6_ joined #mojo
23:36 sri for validation errors, i think custom values and default generators should be good enough
23:37 sri app->validator->add_error(foo => sub {...}) gets the same arguments as the validation callback and returns an error message
23:37 sri validation callbacks are called rules
23:37 sri app->validator->add_rule(foo => sub {...})
23:38 sri think i have most of the design now :)

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