Camelia, the Perl 6 bug

IRC log for #mojo, 2013-09-24

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

All times shown according to UTC.

Time Nick Message
00:02 KindOne joined #mojo
00:33 jberger joined #mojo
00:34 jberger \o
00:35 jberger what did I miss? My last week was busy and my weekend was worse :-0
00:35 shmuel joined #mojo
00:35 sri o/
00:36 sri just me talking to myself for a few hours :o
00:37 jberger hehe
00:38 jberger I'm catching up on the conversation from yesterday (the log's yesterday that is)
00:38 jberger I have a mango-based paste site that might not be a bad CRUD example
00:39 jberger I was working on it for a blog post, but that doesn't have to preclude inclusion somewhere
00:39 jberger connecting it to mongohq really shows off the benefits of nonblocking
00:39 jberger I have a blocking and nonblocking version (only a few lines difference)
00:40 jberger but I get like 6x the throughput\
00:40 * sri still tries to figure out the validation dsl
00:43 jberger batman: "i really want to be able to use it in my models without needing Mojolicious::Controller" have you looked at my ODM?
00:44 jberger https://github.com/jberger/MangoModel
00:44 * jberger still needs to make an example/blog post for that
00:47 jberger I should have more time for tinkering this week
00:52 laouji joined #mojo
00:59 TheCrimsonRadish_ joined #mojo
01:02 hrupp joined #mojo
01:15 TheCrimsonRadish__ joined #mojo
01:18 asarch joined #mojo
01:31 btyler joined #mojo
01:58 d4rkie joined #mojo
01:58 d4rkie joined #mojo
01:59 d4rkie joined #mojo
02:04 * sri wonders how customizable validation rules need to be
02:04 sri $c->validation->required('name')->range(7, 10);
02:05 sri that's what i have now, all methods keep returning the validation object, which collects rules which can't be changed afterwards
02:07 sri if you want to add a custom error message you have to call ->error('...') right after the rule (->range(...))
02:10 laouji joined #mojo
02:15 crab callbacks!
03:05 basiliscos joined #mojo
03:12 KindTwo joined #mojo
03:38 gtodd joined #mojo
04:00 preflex joined #mojo
04:05 preflex_ joined #mojo
04:32 crab crawlbacks?
04:36 dqw5 joined #mojo
04:36 tianon crab: Google Bot! *shakes fist* *auto crawls Google in response* :)
05:06 hummeleBop joined #mojo
05:08 dqw6 joined #mojo
05:10 basic6 joined #mojo
05:42 denis_boyun joined #mojo
05:44 dotandimet joined #mojo
06:02 marcus }}}}}}}}}}}}}}}}|
06:29 Vandal joined #mojo
06:41 denisboyun joined #mojo
06:53 punter joined #mojo
07:20 dod joined #mojo
07:20 Lee batman: ping
07:22 batman sri: generic validators: i see you point, though i'm close to regarding it pointless. (my humble opinion) what i do like is that a simple solution would be excellent for simple cases or proof of concept (mockup) projects
07:23 Lee batman: any thoughts on all-new-improved™ pull request for M::P::CGI - https://github.com/jhthorsen/moj​olicious-plugin-cgi/pull/4/files # ?
07:24 batman i really like $v->field('name')->min_length(7)... a lot, since it looks more like the routes api. (instead of $c->validator->max_length('foo', 20)...)
07:27 batman sri: i'm using this helper to add errors to my template: http://p.thorsen.pm/8b62c51c3e10
07:27 batman it's just a block with class="error" and a title="$error_str", that way i can modify the rest of the styling using js and css
07:27 batman or if i want to support ie3, then i can also poke into the stash myself.
07:28 batman jberger: no. but i am now :) will give you feedback later. (hopefully)
07:29 batman Lee: sorry, i'm just reading backlog and trying to respond...
07:29 Lee no worries ;)
07:30 punter I think $c->send({ ... }) has a problem... "binary" and "text" have been switched around
07:30 punter I think that $c->send({ text => $text }) should accept character strings, am I wrong?
07:30 punter and binary => $binary should accept only byte-strings
07:30 punter again, am I wrong? However I see that these two roles are switched around
07:31 punter maybe my version of Mojolicious is too old... I'll go update
07:32 batman Lee: are you kidding me? so you seriously replaced all the previous stuff with these few lines?
07:33 batman looks pretty good to me :)
07:33 Lee yay \o/
07:33 batman so, just do whatever-you-like with my comment, and i'll merge
07:38 Lee done!
07:38 batman *looking*
07:39 batman jberger: https://github.com/jberger/MangoMode​l/blob/master/lib/MangoModel.pm#L152 <-- have you considered using Mojo::Util::camelize() on the input?
07:44 batman marcus: https://github.com/jhthorsen/mojoli​cious-plugin-assetpack/commit/6f741​0f5a69653e3f482c0578b9bd3c0cfc46142 :)
07:45 batman Lee: 0.06 on its way to cpan
07:45 Lee excellent, thanks
07:46 batman thank you
07:47 batman jberger: i don't get new_class_from_raw() and new_type_from_raw() names. they don't make class, nor type
07:48 crab what is a mojolicious plugin assetpack
07:49 trone joined #mojo
07:49 batman crab: https://metacpan.org/module/M​ojolicious::Plugin::AssetPack <-- check out the description
07:50 tianon much coolness, that's what :)
07:50 KindOne joined #mojo
07:50 batman it's something that combines multiple assets into one file, it can also filter the content first
07:50 batman as in converting sass to css
07:50 tianon or less
07:50 tianon or both, and then combining the two into a single file
07:50 tianon :)
07:54 batman jberger: https://github.com/jberger/MangoModel/​blob/master/lib/MangoModel/Type.pm#L96 <-- could you make this more like "has" ? inlining code and such?
07:54 * batman goes forking the project instead
07:54 ver joined #mojo
07:54 fhelmber_ joined #mojo
07:54 marcus batman++
07:54 marcus batman: great asspack!
07:55 batman haha
07:57 human39 joined #mojo
08:07 batman jberger: https://github.com/jhthorsen/MangoModel/comm​it/8f77efbfcccb632d38f85aa0f8fcb98f272dd10b
08:16 Dandre Hello,
08:17 dod joined #mojo
08:18 Dandre I am using Mango in my application I am planning to write tests for this application but as the whole application relies on this database, I don't see how to do.
08:18 Dandre What can you recommend ? Is there any alternative to installing some mongodb instance just for test?
08:22 batman jberger: i've pushed some more commits...
08:22 batman Dandre: yes. make the database name configurable and run the tests with this database
08:23 batman s/name/uri/
08:23 batman jberger: https://github.com/jhthorse​n/MangoModel/commits/master
08:25 mire_ joined #mojo
08:25 Dandre batman: ok but I must install a new database. Is there some solution with a kind of database connection emulation ?
08:25 batman would be cool with an emulation, but i don't know of any
08:26 batman "must install" ..? you make it sound like a lot of work
08:26 batman i got redis and mongodb running on my laptop and then i make my apps connect to the "test" database instead of "my_app_production" when running tests
08:27 Dandre no but this means I must install mongodb on each development host
08:27 Dandre or find a server to install mongodb on it
08:33 themage joined #mojo
09:10 sri the ending of dexter is so bad... it makes you realize how awful the series has become after season 2
09:12 Adura Did Dee-dee blow up the lab?
09:12 ladnaV joined #mojo
09:15 sri batman: i don't like how you call generic validation pointless
09:15 sri you should have at least said "pointless for *me*"
09:16 batman sri: i totally agree.
09:16 batman it was a super bad statement.
09:16 sri but you're also missing the cases where you have no model
09:16 batman i even falsified it myself in the same sentence :(
09:16 batman so i could say the statement was pointless
09:16 sri what if you want to validate something before sending it along to a backend service
09:17 batman i'm not missing it. it was what i tried to say at the end of the sentence
09:17 sri with the user agent
09:17 sri ah
09:17 batman i was using the wrong words, but i do agree.
09:17 batman i still think it's fucking hard. but that is NOT an argument for NOT doing it.
09:18 batman s/fucking/some-other-strong-word/ :P
09:18 sri i think i have a good design now, all i'm worried about now is the dsl
09:19 sri and checks that i might be overlooking with the extension api
09:19 batman could you pastebin/gist it? would like to see a *real* example
09:19 batman i have a hard time reading it off irc :(
09:19 sri later today
09:19 batman sweet
09:19 batman i need to get some lunch.
09:19 sri for now i'll keep mentioning snippets though
09:20 sri cases like checking if two fields are equal is a bit odd
09:20 batman okey
09:20 batman yeah. sucks big time :(
09:20 sri what other checks are there that involve multiple fields?
09:21 batman could you do $validator->field([password])->same; ? (when both input have name="password" or $validator->field([qw/p1 p2/]->same;
09:21 sri btw. my solution is to keep all input values in an attribute the  check callbacks have access to through the first argument (invocant)
09:22 Vandal joined #mojo
09:22 sri currently i have $c->validation->required('pass​word')->equal_to('password2');
09:22 batman maybe you could also add $validator->field('username')->to(cb => \&check_username); or something?
09:22 crab yes! callbacks!
09:23 sri i've removed ->field() for now btw. for ->required() and ->optional()
09:23 batman would be cool to have to(), since then i could also do ->to('validation_lib#check_username');
09:23 batman sounds good to me (required+optional)
09:23 sri extensions are done with app->validator->add_check('foo' => sub {...})
09:24 sri so you can just have mojolicious plugins with validators
09:24 batman is "foo" a field name or a named check?
09:24 crab named check
09:24 batman please say "named check" :)
09:25 sri default error message generators can be added with app->validator->add_error(foo => sub {...})
09:25 crab doesn't make any sense otherwise in context
09:25 batman :)
09:25 sri what crab said
09:25 batman and what are the arguments to the callback?
09:26 sri my ($validation, $value, @args) = @_;
09:26 sri $validation also has a few useful attributes, like $validation->input/output to see what happened so far
09:27 batman what about groups? if this, then this should be allowed/required?
09:27 batman ok
09:27 sri what are groups?
09:28 batman like if "country" is no, then "address" need to be *something*
09:28 batman s/no/norway/
09:28 crab batman lives in no country
09:28 sri groups is an odd name for alternatives
09:29 batman guess you can accomplish that by putting the rules in the right order (and use input/output)
09:29 sri but yea, if you give me an actual use case i might consider alternatives
09:29 batman ok
09:29 crab i can give you actual use cases, but it's not entirely clear to me what we're discussing
09:29 crab i'll wait for you to paste your complete $thingy before i comment
09:29 * batman gets some lunch
09:30 sri also, yes, testing in the right order would work
09:31 sri i have no way to make a field optional based on a condition though
09:31 crab where would all this validation dsl be invoked?
09:32 sri at any point suring the request
09:32 sri s/s/d/
09:32 crab (field required based on a condition is something i need a lot)
09:33 crab optional based on condition... can't immediately think of when i've wanted that. probably could rephrase that if need be.
09:34 sri you can have required based on condition if you have optional based on condition, one of them would be the default
09:37 sri perhaps i will add special return values
09:38 sri undef for failed, actual value for success, arrayref for just stop the checks...
09:40 sri any other checks that involve multiple fields other than ->equal_to and ->alternative?
09:46 sri another option would be to perform all validations right away as soon as they are defined and push logic handling to the user
09:47 sri $self->validation->required('bar') unless $self->validation->required('foo');
09:48 batman i think instead of equal_to and alternative, i would rather have depends(). that way i could do ->required('password2')->depends​('password1')->some_condition()
09:49 batman password2 would automatically be marked as fail if password1 is fail
09:49 sri batman: for that you need multiple types of checks
09:49 sri single field and multi field
09:49 batman i don't get that
09:50 sri then how would you fit ->depends and ->some_condition into the same api?
09:51 sri what *is* ->depends anyway?
09:51 batman ---> password2 would automatically be marked as fail if password1 is fail
09:51 batman meaning "password1 field need to be "ok" for even trying to validate the "password2" field
09:52 maxhq joined #mojo
09:53 denis_boyun joined #mojo
09:53 Dandre left #mojo
09:53 sri so you would make all multi field checks built-in functionality
09:53 Dandre joined #mojo
09:53 sri without the possibility of extending it
09:54 batman you would be able to extend it by having more complicated logic in the custom condition
09:54 batman ..and not using depends()
09:55 sri depends() is just one kind of multi field check
09:55 batman i know. just throwing ideas out there.
09:55 crab i think pushing logic handling to the user is ok
09:56 sri crab: problem then however is that you can't chain the checks
09:56 batman me to. at least in the beginning. then adding the most requested checks into the api later on.
09:56 sri since you depend on true/false return values for user logic
09:57 sri batman: i think you're missing something fundamental
09:57 batman sri: i'm not sure about the return values. what about using die "..." when invalid?
09:57 batman sri: could be
09:57 sri because eval { $self->validation->... } looks cool?
09:58 sri using exceptions for flow control is something i believe is a total antipattern
09:59 batman haha. no. i meant like my pastebin from yesterday: http://p.thorsen.pm/593f9552a6f7
09:59 sri batman: that code still makes absolutely no sense to me
10:00 batman ok...
10:00 sixBB joined #mojo
10:00 batman something else:
10:00 batman would you consider something like this for the templates: http://p.thorsen.pm/8b62c51c3e10
10:01 * batman guess that doesn't make any sense either :S
10:02 sri that could just be a normal helper with the api i have already
10:02 batman i know. but would you consider something that simple to be part of the standard plugin?
10:03 sri there are more important things to worry about atm
10:04 batman right.
10:13 sri i was considering ->required('foo', 'bar', 'baz')->range(7, 20) as a shortcut for fields that share a few checks
10:16 sri multi field checks might make that impossible though
10:23 rem_lex| joined #mojo
10:25 nic_ joined #mojo
10:28 sri hmm
10:29 sri guess i could go another way to push logic to the user
10:30 sri $self->validation->required('bar') unless $self->validation->required('foo')->range(7, 20)->is_valid
10:30 sri explicit ->is_valid to end the chain
10:31 sri which would then force 'foo' to be evaluated right away
10:31 sri and you can make decisions based on that
10:34 * sri is starting to like that
10:47 HtbaaPi joined #mojo
10:48 k0xa joined #mojo
10:51 sri it's really neat, i can perform all validations right away too, no need to build a stack of operations
10:52 sri just keep track of the current validation topic, perform validations right away, and skip validations once the first check fails... until the topic changes
10:53 HtbaaPi joined #mojo
10:53 sri $validation->optional('baz') unless $validation->is_valid('foo') && $validation->is_valid('bar')
10:54 sri after the first check baz would be valid... that state can change with every new check that is performed
10:55 sri ->optional() and ->required() are the two methods that change the current validation topic
10:55 sri so you could even restart validation of a specific field
10:55 mire_ joined #mojo
11:10 sixBB joined #mojo
11:15 batman better watch out of circular checks ;)
11:15 batman i really like ->is_valid('foo');
11:20 d4rkie joined #mojo
11:42 dod joined #mojo
11:48 kwa sri: I'm pretty interested in what you've been talking about with regards to data validation. I've missed the thread though, are you creating a standalone data validator package?
11:49 kwa I've done a lot of work recently using DBIx::Validation and FormValidator::Simple, so would like to help with edge cases and other things I've found certain validators lacking.
11:56 fhelmbe__ joined #mojo
12:07 jberger apparently I sleep too much to be an effective programmer, when do you guys sleep ??
12:07 jberger batman, thanks, I'll take a look soon
12:08 * jberger really doesn't sleep all that much :o
12:08 nic ARE YOU AWAKE YET???
12:10 denis_boyun__ joined #mojo
12:24 sri kwa: nope, it will be hardwired into mojolicious
12:27 kwa sri: No probs. Will it support ->valid and ->check method so I can use it with DBIx::Validation? :p
12:28 sri dunno
12:29 crab what does that even mean?
12:30 kwa I only say because I have found it quite useful for placing a validation profile inside my DBIx::Class::Result for each table. Which allows me to validate via mojolicious, and directly via the resultset.
12:32 sri ok, that's not how it works
12:32 kwa crab: DBIx::Validation requires those methods. It supports FormValidator::Simple and Data::FormValidator (and anything else that supports those methods).
12:32 sri there will be no validation profile
12:32 sri i'm designing it after the validation systems of play framework and revel
12:32 kwa That's a shame, fair enough.
12:33 sri general purpose data validation is not a goal, this is about form data, nothing else
12:34 jberger IMO its one of the great myths of Mojolicious, even though it comes with these tools, you may still use your favorite tool, go ahead use DBIx::Validation
12:34 kwa Yeah, I understand. I find that's how I start a project, but then realise I need to apply the same validation on the DB model itself, so end up duplicating code.
12:34 kwa But that's me, and not everyone else.
12:35 sri if your model has validation, odds are you can ignore mojo validation
12:35 sri it's for when you have no model or a less sophisticated model
12:35 kwa Yeah. I liked what I was hearing so was after clarification.
12:36 crab what's a validation profile?
12:36 kwa The problem with DBIx::Validation is your antipattern of eval { $row->validate; }, so if yours was better I would have moved over. :)
12:37 kwa crab: It's just the hash ref or w/e with the constraints to check form data.
12:37 kwa crab: https://metacpan.org/module/FormValidator::Simple
12:38 kwa I find it useful with DBIx::Validation, because I can perform a different check if a database row is being updated or created.
12:38 sri synfony does it that way, you put your whole validation profile into a yaml config file... ewwww
12:38 crab i see. so DBIx::Validation is not a validator, but something that feeds a validator that you choose? approximately?
12:38 crab i think that's what i was confused about.
12:38 kwa heh, it's not yaml though, it's Perl at least :)
12:39 sri i should have something to show later today
12:39 kwa crab: Essentially, yes. It overrides the insert and create statements and if a validation profile exists for the result, it checks it against the column data.
12:40 kwa *insert and update
12:40 kwa s/statements/methods/ # jeez
12:42 basiliscos joined #mojo
12:47 jberger_ joined #mojo
12:57 Vandal joined #mojo
13:05 jberger_ batman, I think I should show you the way I'm using my odm
13:06 batman jberger_: that would be nice
13:06 jberger_ MangoModel is meant as a base class, to be extended
13:06 batman jberger_: i know
13:06 batman i just thought there was too many methods
13:06 jberger_ My only real example is technically proprietary
13:07 jberger_ But it also isn't really a secret, just not for public consumption
13:07 batman ok
13:08 batman but you disagree on all my changes?
13:08 jberger_ I use lots of what you removed :-)
13:08 jberger_ but that doesn't mean that my code might not adapt well
13:09 batman and you also -need- to use those methods?
13:09 batman i like to have as few methods as possible when i'm designing an api
13:10 jberger_ I need to see how it would adapt, perhaps your way is better
13:10 batman i'm not saying my way is better. i'm just saying it's less :)
13:10 jberger_ understood
13:11 jberger_ I do like caching the loading
13:11 jberger_ That was just something I hadn't gotten to try
13:11 batman cool
13:13 jberger_ When I get a chance, I figure out a way to send you a sanitized copy of my use-case
13:13 batman ok...
13:14 jberger_ My real motivation was that when I stopped using DBIC I missed result-set methods
13:15 batman jberger_: i also want to do ->update({ '$set' => $self->_raw }); or something like that
13:16 batman since i might have objects created from partial mongodb objects
13:16 batman yeah. i understand what you mean
13:16 crab what is an odm?
13:16 batman object document mapper
13:17 jberger_ Like orm
13:17 batman uhm.. or is it?
13:17 jberger_ ?
13:18 jberger_ I mean it's conceptually analogous
13:18 batman crab: it's object document mapper (i just got confused for a moment)
13:19 batman jberger_: did you see my update({ '$set' => ... }); comment above
13:19 batman ?
13:20 jberger_ Yeah, would you put that in the base class? You could easily put it in your own subclass
13:21 jberger_ I have lots of those type of methods in my subclasses
13:21 batman maybe i want to methods or add a class attribute which understand what to do
13:21 batman to=>two
13:21 batman it's way to common in my code for me to want to copy/paste that code into every sub class
13:22 batman i would probably have an attribute that instructed save() to do what i want
13:22 batman that way i can have one common method to do save()
13:23 batman and it would just do-the-right-thing (tm)
13:24 jberger_ Well that's an interesting point, I can see wanting different storage (and opposite) depending on underlying structure
13:24 jberger_ So far all my objects are complete documents
13:24 batman that's very nice :)
13:25 jberger_ I suppose your $set style makes sense for partial cases, how would you load the object?
13:26 batman using fields
13:26 batman but i might very well be over complicating things on my side.
13:26 batman or simply just doing stuff wrong
13:26 jberger_ Yeah, silly question
13:28 batman i think i am modelling things the wrong way...
13:28 batman i will try your "simple" approach
13:28 jberger_ :-)
13:28 jberger_ I'm not claiming to be an expert
13:28 batman i think i'm doing this wrong, since i think asking for many documents are slow
13:28 batman when it might just be slow-er
13:29 jberger_ And I don't think it will adapt to old days well
13:29 dvinciguerra_ joined #mojo
13:29 jberger_ But for a new project, this makes sense for me
13:29 batman "old days" ?
13:30 jberger_ Data (swipe fail)
13:30 asarch joined #mojo
13:30 batman i still don't get it :(
13:31 jberger_ Dbic works by reading your schema and adapting, I don't think that MangoModel is going to adapt well to existing projects
13:31 batman why not?
13:31 jberger_ It's too simplistic
13:32 jberger_ Perhaps it Will
13:32 batman i think it's super cool that you got _raw, since that makes it adapt to anything imo
13:32 jberger_ True, let's say it is not a primary goal
13:32 batman :)
13:32 batman but comparing to dbic: what you have is just schema and result..? where is your resultset?
13:33 jberger_ Anyway, give it a try with a whole doc per object
13:33 batman yeah, i will do that
13:33 jberger_ Haven't gotten there yet :-)
13:33 batman ah
13:33 jberger_ I have it in my head though
13:33 batman since i think you screwed up on the whole adding find_one to the base class
13:34 jberger_ Basically like each on mojo collection
13:34 batman s/base class/schema class/
13:34 batman like each or are you going to use mojo collection?
13:35 jberger_ You think it should be in the type class?
13:35 batman i seriously think you need to work on the mango cursor and not a Mojo::Collection
13:35 jberger_ Right
13:36 jberger_ But it has to map before calling the provided callback
13:36 batman i either don't understand or don't agree :)
13:36 jberger_ So it would be like each
13:37 batman i would have next()
13:37 jberger_ Yes it must work with the cursor
13:37 batman but i'm a sucker for non-blocking
13:38 jberger_ And non blocking is a goal
13:41 crab have you guys ever eaten a mango?
13:43 jberger_ crab: delicious
13:45 nic one of those fruits that's more bother than it's worth
13:45 nic catching them when they're ripe-enough and not-too-ripe is a good game tho
13:55 dod joined #mojo
14:02 mire_ joined #mojo
14:11 btyler joined #mojo
14:17 bluescreen joined #mojo
14:20 sh3 joined #mojo
14:45 bluescreen joined #mojo
14:46 gryphon joined #mojo
15:03 bowtie_ joined #mojo
15:06 memowe nic: is it like avocado's: "wait. wait. not yet. wait. wait. OMG EAT ME NOW!!! too late."
15:11 sh4 joined #mojo
15:12 nic :)
15:15 SmokeMachine joined #mojo
15:41 btyler_ joined #mojo
15:50 good_news_everyone joined #mojo
15:50 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/gQp68g
15:50 good_news_everyone mojo/master d143624 Sebastian Riedel: small optimization
15:50 good_news_everyone left #mojo
15:54 batman jberger_: MangoModel: Would you mind adding has oid => ...; which is always part of _raw ?
15:54 * sri thinks he has validation mostly implemented... now on to writing tons of tests :o
15:54 batman uhm... nevermind "has", but having a method for accessing the oid by default
15:54 batman sri: can i see?
15:55 sri soon
15:55 crab $sri->is_validating
15:55 jberger_ Accessor for oid is probably ok
15:56 jberger_ batman ^^
15:56 batman jberger_: ok. i consider that to be a sane default
15:57 jberger_ Just a method in the type superclass would work
15:57 batman yeah
15:57 jberger_ Its a special case
15:57 batman i think it's a normal case...
15:58 kwa sri: Thought you used TDD? Or do you bang experimental code out until you're happy, then write the tests?
15:58 jberger_ special in that the _id field is special
15:58 sri kwa: whatever works best for the task at hand
15:58 batman jberger_: ah! i agree :)
15:58 batman jberger_: maybe just call it "id" instead of "oid" ...
15:59 kwa sri: Makes sense. I feel your pain writing tests after the fact.
16:00 sri it's not very painful actually, i've designed it to be easy to test ;p
16:00 kwa :)
16:00 batman i think testing is only painful if the api is crap
16:00 sri my $validation = $t->app->validation; and i can test validation standalone
16:02 kwa I look forward to seeing what you've done tomorrow. Home now. Happy testing!
16:02 sri http://pastie.org/8352074 # this is the first test case :)
16:02 kwa Good job. Only 500 more to go!
16:03 sri possibly more
16:06 sri so far i only have the ->range() check :) ...gonna need more
16:06 sri and possibly a helper to generate tags for the error message list
16:11 TheCrimsonRadish__ joined #mojo
16:30 basic6 joined #mojo
16:39 bluescreen joined #mojo
16:57 dod joined #mojo
16:59 dwierenga joined #mojo
17:03 abhishekisnot joined #mojo
17:05 dvinciguerra_ joined #mojo
17:07 mire_ joined #mojo
17:38 dotandimet joined #mojo
17:53 dotandimet joined #mojo
17:53 rem_lex|pivo joined #mojo
18:08 dotandimet joined #mojo
18:16 basiliscos joined #mojo
18:30 denis_boyun joined #mojo
19:44 rem_lex| joined #mojo
19:46 abhishekisnot1 joined #mojo
19:47 graf joined #mojo
19:47 _sri joined #mojo
19:48 good_news_everyone joined #mojo
19:48 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/KvtcTg
19:48 good_news_everyone mojo/master e3fcf38 Sebastian Riedel: documentation tweaks
19:48 good_news_everyone left #mojo
19:48 Phil21 joined #mojo
19:49 avenj joined #mojo
19:49 Mikey joined #mojo
19:49 sjn joined #mojo
19:49 espen joined #mojo
19:49 jberger joined #mojo
19:49 ivan joined #mojo
19:49 andrefs joined #mojo
19:49 TitanOfOld joined #mojo
19:49 marcus joined #mojo
19:49 sivoais joined #mojo
19:49 sawtooth joined #mojo
19:49 dabudabu joined #mojo
19:49 Zx3 joined #mojo
19:49 ruz joined #mojo
19:49 bzero joined #mojo
19:50 tardisx joined #mojo
19:50 good_news_everyone joined #mojo
19:50 good_news_everyone [mojo] kraih created validation (+1 new commit): http://git.io/Rx9uKQ
19:50 good_news_everyone mojo/validation 199a67f Sebastian Riedel: added experimental validation support
19:50 good_news_everyone left #mojo
19:50 Kundun joined #mojo
19:50 mst joined #mojo
19:50 al joined #mojo
19:50 ZadYree joined #mojo
19:50 mtths joined #mojo
19:50 __mkrull joined #mojo
19:50 _sri not finished yet, but i might be offline for a few days... so putting it in a branch anyway
19:50 cottoo joined #mojo
19:50 mire_ joined #mojo
19:51 highflying joined #mojo
19:51 go|dfish joined #mojo
19:51 _sri batman: you wanted to take a look
19:52 batman *looking already*
19:52 batman so you want it part of mojo by default..?
19:52 batman not as a plugin?
19:52 _sri yea
19:53 batman ok...
19:53 _sri like sessions, a sensible default you can replace with your own stuff
19:54 mfontani joined #mojo
19:54 batman ok
19:54 garu joined #mojo
20:05 batman i feel the "topic" attribute is wrong. i best case, i think it should be private.
20:06 _sri why?
20:07 batman because i think it's confusing each chain of checks change the topic.
20:07 batman it makes the class simpler, but i do believe that additional objects for each topic would be more consistent
20:08 batman imo
20:08 _sri you're wrong
20:10 batman okidoki :S
20:11 _sri prove me wrong and show some code ;p
20:12 _sri like i said earlier, patches or gtfo :)
20:12 batman it's just an opinion. can't prove you wrong.
20:12 _sri my code is out there, make it better
20:12 _sri of course you can, if yours is less code, you were right
20:12 batman no. mine is _not_ less code. mine is a lot more code, but i think it would be easier to follow.
20:13 _sri how so?
20:13 _sri I WANT TO SEE CODE!
20:13 batman https://github.com/kraih/moj​o/commit/199a67fe7993#L3R84 <-- why do you loop over the value instead of just passing on the array ref to the check cb?
20:14 _sri simplicity
20:14 _sri why would i want every check out there to require multi value support?
20:14 batman but if i have <input name="password"><input name="password"> <-- wouldn't it make sense to validate them both at the same time?
20:15 _sri i'm having a really hard time following you i'm afraid
20:15 _sri please just show some code, it's pointless to continue otherwise
20:16 _sri anyway, i'm out now
20:16 batman ok. sorry. i need to finish something else :/
20:17 batman looks good otherwise.
20:17 batman at least the first impression
20:19 batman i guess it's a generic validator as well :)
20:19 rem_lex joined #mojo
20:43 chorny joined #mojo
20:48 punter joined #mojo
20:52 punter $c->send({ text => $text }) requires $text to be bytes
20:53 punter but $c->send($text) requires $text to be characters
20:53 punter This is not documented in the POD
20:53 punter So I can't help but wonder: Is this difference always going to be like that?
20:53 punter Or is my code going to break at some upgrade?
20:54 maxhq joined #mojo
20:58 jberger_ punter, you're misunderstanding the hashref form
20:58 punter I'm listening
20:59 punter I thought $c->send({ text => $text }_ and $c->send($text) would serve a similar function
20:59 jberger_ {text => ...} is websocket text opcode
20:59 punter o
20:59 jberger_ send assumes dwim
21:00 jberger_ explicit text or binary opcodes bypass that
21:00 punter dwim?
21:00 jberger_ our json key is our own, which sends encoded json over the text opcode
21:01 jberger_ Do what I mean
21:01 punter Ok
21:01 jberger_ Means take this text, encode it and send it
21:01 punter Is it reasonable to expect people to look into Mojolicious's source code to figure that out?
21:02 punter And will I be ok if I build my code on the assumption that this will not change?
21:02 punter the bytes/chars string expectancy I mean
21:03 jberger_ But this was problematic for json since the json encoder was also utf8 encoding, so double encoding happened, so we added the json pseudo op
21:03 jberger_ It should be documented
21:03 punter I see
21:03 punter That's interesting
21:03 punter Thanks
21:04 jberger_ I expect the api will not change, given the amount of effort that went into not changing it for json handling
21:04 punter Yes
21:05 jberger_ I will look at the doc, perhaps a clarification is needed
21:05 punter thanx
21:06 punter The documentation (I see now) gives enough hint (probably)
21:06 punter It mentions $bytes and $chars
21:07 punter But I was too careless to notice these
21:08 punter The only thing that wasn't clear, and caused my confusion, was the existence of $c->send({ binary => $bytes }) - that's a websocket opcode but I didn't realize that
21:10 punter Thanks jberger, the confusion was my fault more than yours. Bye
21:11 jberger_ Yeah,  I'll think about a better way to document that, if some thing good vibes to mind I might add it
21:11 jberger_ s/vibes/comes/
21:12 jberger_ (Man swipe errors look really silly)
21:19 bluescreen joined #mojo
21:25 tianon joined #mojo
21:33 lukep joined #mojo
21:40 punter joined #mojo
21:42 punter Quick question: If all of hypnotoad's processes are serving web browsers at the moment, and a new web browser makes a web request, is it going to wait in a queue until it gets served, or will it display an error to the user?
21:48 jzawodn it should queue up assuming the queue is not full
21:54 punter thanks
22:00 jamesw joined #mojo
22:18 good_news_everyone joined #mojo
22:18 good_news_everyone [mojo] kraih pushed 1 new commit to validation: http://git.io/4-S0bw
22:18 good_news_everyone mojo/validation e2c3a2b Sebastian Riedel: return collections with errors
22:18 good_news_everyone left #mojo
22:29 dqw6 joined #mojo
23:16 abhishekisnot1 if I issue $c->render_exception from inside helper, it does not end the current request
23:16 abhishekisnot1 any better way to end if from helper?
23:25 jberger_ As with any render, if you want further processing to stop simply return
23:26 jberger_ return $c->render*
23:26 jberger_ abhishekisnot1: ^^
23:33 punter Does /api/users/:username also match this URL? /api/users
23:33 punter It shouldn't really, should it?
23:35 abhishekisnot1 jberger_: http://pastie.org/8353133 -- the last statement in controller still returns the json
23:37 jberger_ Returning from a helper will not return for a controller action
23:41 punter It's like my placeholder is optional, when it shouldn't be
23:41 punter I changed :username to :username2 , and still the same happens (the route handler gets executed)
23:44 punter There's something else going on here...
23:44 abhishekisnot1 jberger_: yeah, any quick way to return from controller action on render_exception (in helper)?
23:45 abhishekisnot1 jberger_: I guess I am abusing this feature..
23:50 jberger in your action you can do:
23:51 jberger return if $c->my_helper()
23:51 jberger and have my_helper return true if it should stop processing
23:51 jberger but yeah, that's getting a little icky
23:51 jberger I might rather say that you might want to do:
23:52 jberger return $c->render_exception if $c->my_helper
23:52 jberger where now my_helper does not try to render its own exception, but simple check to see if some condition is met
23:52 jberger then let the action do the controller-type-things
23:53 jberger but that is getting into style preferences

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