Camelia, the Perl 6 bug

IRC log for #mojo, 2013-09-27

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

All times shown according to UTC.

Time Nick Message
00:37 shmuel joined #mojo
00:42 asarch joined #mojo
00:57 laouji joined #mojo
01:03 hrupp joined #mojo
01:55 d4rkie joined #mojo
01:56 dvinciguerra joined #mojo
02:01 laouji joined #mojo
02:04 laouji_ joined #mojo
02:12 btyler joined #mojo
03:02 tokuhirom joined #mojo
03:10 preflex_ joined #mojo
03:30 rem_lex|pivo joined #mojo
03:34 TitanOfOld joined #mojo
03:44 espent joined #mojo
04:13 crab joined #mojo
04:17 mire_ joined #mojo
04:33 btyler joined #mojo
04:40 abhishekisnot joined #mojo
04:44 dqw6 joined #mojo
05:12 basic6 joined #mojo
05:16 d4rkie joined #mojo
05:21 j_wright joined #mojo
05:21 j_wright joined #mojo
06:13 yakudza joined #mojo
06:31 davido joined #mojo
06:34 dotandimet joined #mojo
06:46 sh4 joined #mojo
06:57 Vandal joined #mojo
06:58 dod joined #mojo
07:26 Dandre Hello,
07:26 Dandre How can I get coverage metrics for my tests?
07:31 batman Dandre: https://metacpan.org/module/Devel::Cover
07:32 batman i'm using this alias: cover="HARNESS_PERL_SWITCHES=-MDevel::Cover make test;cover"
07:32 batman but you should be able to just do perl Makefile.PL; cover -test
07:32 batman and then open cover_db/coverage.html or something
07:32 mire_ joined #mojo
07:36 Dandre ok but I run my test like this:
07:36 Dandre ./scriots/myapp test
07:36 Dandre I don't habe a makefile. Is there any awy to run cover without makefile?
07:41 batman did you try HARNESS_PERL_SWITCHES=-MDevel::Cover ./script/myapp test ?
07:43 Dandre no
07:44 dotandimet joined #mojo
07:50 Dandre ok now I get my results. thanks
07:51 batman Dandre: awesome :)
07:52 batman better add an alias then :)
07:53 trone joined #mojo
07:57 crab i am sorry to hear you're not doing well, though. i hope you feel better soon, whatever it is that ails you.
07:57 crab oops
07:59 batman :D
08:00 basiliscos joined #mojo
08:05 hummeleBop joined #mojo
08:16 batman sri: do you have time to look at mandel? as in the overall idea...
08:22 themage joined #mojo
08:32 yakudza joined #mojo
08:44 KindTwo joined #mojo
08:44 rem_lex| joined #mojo
08:53 KindTwo joined #mojo
08:58 fhelmber_ joined #mojo
09:02 sri batman: briefly, anything specific you want me to look at?
09:04 batman just if the synopsis makes any sense.
09:04 batman as in if i have any superbad design choices
09:04 sri guess it does
09:05 sri if you need inspiration, this one is pretty much the best non-blocking odm available http://mongoosejs.com
09:05 KindTwo joined #mojo
09:08 batman thanks!
09:08 batman what about the naming: Mandel::Document, Mandel::Description and Mandel::Collection?
09:09 batman Mandel->collection($name) = Mandel::Collection
09:09 batman Mandel::Collection->single = Mandel::Document
09:09 batman Mandel::Description = knows how Mandel::Document should be stored
09:10 batman each document has a singleton (!?) which is Mandel::Description
09:10 batman s/document/Mandel::Document/
09:10 batman i think the singleton is ok, since it describes the class just as much as attributes and methods.
09:10 batman i could be wrong of course :P
09:11 batman i'm trying to steal at what i like about DBIC...
09:12 batman maybe i should hook the description objects into $mandel_obj instead...
09:13 sri well, if you want to use classes like that you need singletons
09:13 batman ok. does that make it right? :)
09:14 sri on the other hand odds are you'll be using helpers to create instances of stuff for you anyway, so i dunno
09:14 batman i'm going to add support for $mandel->model(...)
09:15 batman "create instances of stuff" <-- what is stuff?
09:16 sri documents, collections
09:16 batman ok
09:17 sri mongoose.js won't help you much there, since it uses prototype oo
09:20 batman yup
09:20 batman i'm going to change name from Mandel::Description to Mandel::Model
09:20 batman i think it fits mongoose better
09:20 sri Mandel::Meta
09:21 batman i think meta is more about objects than documents.
09:21 batman i also want people to extend my module with Moose, Moo, ... so then i don't want to mix meta() and .... meta() :)
09:27 sri batman: btw. i'm still waiting for a good reason why validation->required/optional should return new instances of something (Mojolicious::Validator::Field or so)
09:27 batman sri: i don't have any.
09:28 sri perhaps you've overlooked one property of the validator
09:28 batman it's just an opinion. i'm not very good at discussing opinions :(
09:28 sri every check runs right away
09:28 batman you mean so you can't mix up the token..?
09:29 sri what do you mean with mix up?
09:29 batman nevermind. i'm pretty sure i understand
09:30 batman oh. not "token"... what is it called?
09:30 batman the current field you're working on...
09:30 sri when you do ->required('foo') it checks the value and copies it to ->output if it's fine... when you then run ->size(3, 7) it checks the output value and removes it if it didn't match and so on
09:30 sri every new check you call on the ->topic is a refinement
09:30 batman ah! topic. thanks
09:31 batman what i like about topic is that it makes it simpler. less overhead with 1 million almost useless objects.
09:31 batman at least the way i would solve it (having 1M objects :P)
09:31 batman topic++
09:31 sri think my point is that if you're running these checks right away you don't need introspection, which is what objects would provide
09:32 batman i agree.
09:33 * sri thinks $validarion->is_submitted might be useful, for checking if something has been submitted at all
09:33 sri so you can do "return $self->render unless $self->validation->is_submitted;"
09:34 sri (to handle the initial state of a form)
09:34 crab validarion, the noble elf city?
09:35 * sri sets crab on fire
09:35 batman sri: so it would return false if ->input() holds an empty hash?
09:35 crab wtf! that's yko's job.
09:35 batman it = is_submitted()
09:35 crab to be set on fire, that is, not to set people on fire.
09:35 sri batman: yes
09:36 crab hm, i don't much like that
09:36 sri crab: just doing my job!
09:36 batman sri: makes sense
09:36 crab it means you're reusing an action for multiple things
09:37 crab but then it's also kinda convenient to do so sometimes
09:37 sri i wouldn't say that
09:37 sri different actions for initial form state and submitted form is not a better design
09:39 sri it's the same REST resource for me
09:39 sri of course i redirect to a show action after submitting the form has been successful
09:43 mire_ joined #mojo
09:46 nic I'm writing a command that would benefit from having an object, ie a class, but that would only ever be used by this command
09:46 nic Can/should I define it within the command file?
09:47 nic Or does it need to be a separate file?
09:48 crab eh, define it in the command file
09:48 nic ta
09:49 sri i only embed classes like that if they don't need their own documentation
09:49 nic good guideline, ty
09:52 kwa sri: When validating, if the previous constraint fails, which resulting constraints not be run? Is that what ->output is for? If it's undef, assume the previous constraint failed?
09:52 sri kwa: exactly
09:52 kwa I like that.
09:53 kwa I've had problems in the past where I check a column as a valid uuid, the next constraint checks the database and dies because it's checking a uuid field with bad data.
09:54 mire__ joined #mojo
09:54 kwa sri: Does that mean that by default, empty fields will be ''?
09:55 kwa Actually, no. It just means that you will have a single error, as opposed to an array of errors.
09:57 batman adding Mandel::model() makes life so much smoother :) https://github.com/jhthorsen/mandel/commit​/bb16edee2650c141c855afbd347584df69d17d1f
09:58 * nic likes the name 'mandel' -- like a handle but more masculine
09:59 * nic expects tempire to be sporting a mandelbar moustache any day soon
10:00 crab mandel = almond
10:00 batman nic: thanks
10:00 nic crab: which language?
10:00 batman crab: exactly. mandel = mango + model
10:00 batman nic: norwegian
10:00 nic ahh
10:00 sri in german too
10:00 batman nic: https://www.google.com/search?q=mandel+bread
10:01 batman nic: and english...sort of
10:01 nic yum
10:01 sri batman: how does mandel handle validation? die if data doesn't fit into the schema?
10:02 batman sri: i'm waiting for Mojolicious::Validation to do that ;)
10:02 batman or was it ::Validator
10:02 batman sri: i haven't added validation yet
10:02 sri validator, which creates validations
10:03 batman i see
10:04 batman i'm really not sure how to do validation... i'm thinking about doing $model->add_field(name => \%args); where args might contain validation
10:05 batman $mandel->model('person')->add_field(name => { validation => 'name', ... }); # just throwing out ideas...
10:05 batman s/validation/validator/
10:06 batman $mandel->model('person')->add_field(age => { validator => 'positive_int', ... });
10:10 batman comments?
10:12 batman should probably use Moo here: $mandel->model('person')->add_field(age => { isa => 'positive_int', ... }); or { isa => sub { ... } }
10:23 kwa batman: Would you be able to ascertain within the validator if it's being created or updated?
10:23 batman kwa: that is not the plan
10:24 sri why would validation code care?
10:24 sri seems like a red flag
10:24 kwa I'm using DBIC::Validation heavily for validaing a RESTful app, and it's helpful.
10:24 sri validation ensures that input fits into the specific data model, not if it makes sense
10:25 kwa It might not be through your validator sri, I just wondered if it could be exposed to a custom validator.
10:30 kwa So I guess the primary validation is through ->add_field(age => { validator => { range => [0,100] } }). I would find it useful to add extra validations to see if it "make sense" too. But I guess that's down to the user again. I suppose I need to think less about what's appropriate to me. :P (It's why I've never got around to releasing anything on CPAN :()
10:33 Vandal joined #mojo
10:35 good_news_everyone joined #mojo
10:35 good_news_everyone [mojo] kraih pushed 1 new commit to validation: http://git.io/Fc1suA
10:35 good_news_everyone mojo/validation 9bada75 Sebastian Riedel: added is_submitted method to Mojolicious::Validator::Validation
10:35 good_news_everyone left #mojo
10:36 batman kwa: yeah. adding a callback would allow you to do *stuff*
10:36 sri perhaps has_data would look better in context
10:36 batman i could add a in_database attribute to the ::Document which is set to true when stored or retrieved from the backend
10:37 batman in_storage() might be better....
10:37 crab i like has_data()
10:37 kwa batman: It's only appropriate for me for when people use PUT to change a resource. I want the primary key to be readonly, or added_by fields (so they can not be set to anything other than what they're intended to be).
10:38 kwa As sri said, it's nothing to do with validation as so long as it's a uuid or integer it will pass in your validator.
10:38 batman kwa: right. i would believe that could be achieved by setting ro => 1, ...
10:38 good_news_everyone joined #mojo
10:38 good_news_everyone [mojo] kraih pushed 1 new commit to validation: http://git.io/7UR-Ew
10:38 good_news_everyone mojo/validation 17ccd89 Sebastian Riedel: renamed is_submitted to has_data
10:38 good_news_everyone left #mojo
10:38 batman *brb*
10:39 crab now i like is_submitted again
10:39 * crab hides
10:39 sri :O
10:39 crab (just kidding. i like has_data)
10:39 sri if you weren't still burning...
10:41 sri suppose a regex check is the next logical choice for adding... but no clue what the default error message should be
10:42 kwa batman: In DBIC I use $self->in_storage and $self->is_column_changed.
10:43 sri btw. whoever was worried about error message callbacks being too verbose for i18n... you can also just use custom error messages with $validator->error(loc('REQ​UIRED'))->required('foo');
10:43 sri and since the validator has the same lifetime as the stash... you can build helpers around it to do that stuff smarter
10:44 kwa batman: so yeah, in_storage would definitely be useful.
10:45 * sri thinks in_storage would be useful too
10:45 kwa sri: I was worried about how arguments would be parsed within errors (in your range constraint for example) in il18n. But that might be directed at someone else.
10:46 sri is_synced or so might be a better name though
10:46 sri kwa: i don't think i18n would be done that way
10:47 sri i mean, with the callbacks you definitely could, but in my experience it's usually just very app specific messages
10:51 dqw6 joined #mojo
10:51 kwa sri: True. When doing something like "relies_on" (which I use quite often) I like to include the name of the field within the error. But you mentioned such specific errors wouldn't really be handled in i18n.
10:52 sri hmm... instead of ->has_data i could also make empty hash a special case that disables all checks
10:53 crab too magical
10:53 sri and it could get in the way of advanced logic
10:53 crab yes
11:01 dvinciguerra_ joined #mojo
11:20 batman what about the $doc->update($bool) attribute? is it useful?
11:20 batman should i have a map of what has changed instead?
11:20 batman and should that map $doc->{dirty}{$field} only be set if actually changed to a new value?
11:22 sixBB joined #mojo
11:37 batman replaced updated with is_changed() and add "dirty" attribute, which hold a hash ref
11:38 kwa Yeah, DBIC uses get_dirty_columns I think.
11:39 kwa Store in a _dirty_columns hash.
11:40 kwa The ->update() method checks the dirty columns has to see if it has anything to actually update.
11:41 kwa An additional field is added which is make_column_dirty() too which will force an update.
11:41 kwa s/field/method/
11:52 bowtie_ joined #mojo
11:53 batman i'm checking is_changed() in save()
11:53 batman i'm doing the same. still haven't tested anything, but that is what i'm aiming for
11:54 batman sri: is it possible to make Mojo::JSON::Pointer->set() ?
11:54 sri batman: that would be json patch
11:54 sri and no, i have no plans for it atm
11:54 sri (as usual, it's about use cases inside the framework)
11:55 batman ok. have you thought about if it's actually possible to guess the right path, if the elements in the json is undefined?
11:55 batman $json = {} $pointer->set($json, '/foo/1/bar', 42); # <--
11:56 sri ->contains is for checking if an element exists
11:57 batman yeah. i saw that
11:58 batman what is this: $p =~ s/~0/~/g; ?
11:59 batman ~ looks weird :)
12:01 sri http://tools.ietf.org/html/rfc6901#section-3
12:01 batman aha. thanks
12:03 sri i might add an implementation of this in the future if it becomes popular for REST apis http://tools.ietf.org/html/rfc6902
12:03 batman that would be cool.
12:04 batman i want that for my Mandel::Document: $doc->set('/foo/bar', $data);
12:04 kwa Adding rfc6902 would be very cool.
12:05 sri what would you use it for?
12:05 batman you=me?
12:05 sri kwa, you just told me your use case ;p
12:05 batman :)
12:09 kwa sri: Just for supporting PATCH in my API. At the moment I'm only supporting PUT, using normal params to update the columns and restricting updating to a single resource. I believe the PATCH would allow me to add support for single resources as well as multiple resources.
12:10 kwa I'm happy with just using PUT, but really I like what PATCH provides.
12:12 * sri has not encountered an api using json patch yet
12:13 kwa So at the moment if someone reads a message, they need to submit a new request to say they've read it against the message resource. Using PATCH they can submit a single request to say they've read 10-20 messages.
12:13 kwa Or at least that's how I understand its usefulness.
12:14 sri not quite
12:14 denis_boyun joined #mojo
12:14 sri you can perform multiple operations, but only on the same object
12:14 kwa hmm
12:15 sri unless you make up your own high level constructs
12:15 sri [["id": "1234567", "patch": [...ops...]], ...]
12:15 sri s/[]/{}/
12:16 kwa ahh
12:17 kwa I'm using a fixed schema db, so I guess PATCH is even more useful for mongo.
12:19 kwa Talking of mongo, what would be a good use case for using it? Isn't the size of the database restricted to the memory on the machine?
12:20 moltar joined #mojo
12:22 rem_lex joined #mojo
12:31 sri kwa: no
12:32 sri for performance to be good the working set should just fit into memory
12:32 moltar joined #mojo
12:32 sri mongodb is a good general purpose database, best use case is dynamic unstructured data, like for a cms
12:35 dod joined #mojo
12:36 kwa That makes more sense. I will look into it for #work in that case when I rewrite the "call scripting" system. Will be useful for creating forms of arbitrary lengths and features.
12:50 batman add $doc->set('/path', $val): https://github.com/jhthorsen/mandel/commit​/9a53d321acf0e4ca8ca25031eaf08f4725b2e77b
12:58 * sri still hopes tokumx will get merged into mongodb http://www.tokutek.com/pro​ducts/tokumx-for-mongodb/
13:00 sri batman: will you support non-blocking and blocking?
13:00 batman sri: when enough people ask
13:00 Adura batman, what do you think of gun control?
13:00 batman i had blocking yesterday, but i'm not a big fan
13:00 batman Adura: seriously?
13:01 Adura I'm poking fun at your nick. :P
13:01 batman Adura :P
13:02 batman Adura: norway is one of the countries with highest weapon density (if not the highest)
13:02 sri hunting rifles though
13:02 batman has nothing to do with control though :)
13:02 Adura Some sort of... forced military thing?
13:02 batman sri: nah. everything
13:03 sri i read somewhere recently that other kinds of guns have stricter regulations in norway
13:03 batman military weapons, hand guns, hunting rifles, shotguns...
13:03 batman shotgun is not very strict, but the rest is strict / regulated.
13:05 batman sri: mandel+blocking: i'm itching my own itch first. i always look if the blocking api would work. if it *can* then i'm happy.
13:05 batman i hardly ever need it, so i don't bother to add a lot of extra logic which i won't maintain.
13:05 batman but if *someone* add the logic, i will merge it.
13:09 moltar joined #mojo
13:11 sri oh 1011 stars on github already :o
13:11 batman wow!
13:11 batman that's pretty awesome :)
13:13 crab what's 1011 stars on github?
13:14 batman crab: 1011 clicked the "star" button for https://github.com/kraih/mojo
13:14 crab ah. neat.
13:17 tianon let's see Moose do _that_! :)
13:17 tianon but seriously, we need to take meatcpan back :P
13:19 arthas joined #mojo
13:22 marty o/
13:23 tianon the metacpan, even, although the meatcpan sounds cool - only modules with real meat can get it :)
13:23 tianon *get in
13:23 tianon wow - not my morning
13:24 marty I'd also like to add that mongodb works quite well for ecommerce also.  I'm using it exclusively in my ecommerce app and it's working out quite well
13:25 batman marty: that's why i'm writing Mandel :)
13:25 batman ecommerce
13:26 Lathan joined #mojo
13:28 marty \o/ for mojo+mango+ecommerce
13:28 aleksey joined #mojo
13:28 jan joined #mojo
13:28 aleksey left #mojo
13:29 dvinciguerra__ joined #mojo
13:31 crab marty: was your ecommerce app the one which sold automatic sprinklers and whatnot for computer-controlled irrigation?
13:32 marty crab: yes.  but mostly just plain old irrigation stuff.
13:32 jberger o/
13:32 jberger batman, yeah, I don't care about the name updated vs is_dirty or whatever, thats all good
13:33 jberger I'll have to read about ::Model, but it sounds nice
13:33 batman :)
13:33 jberger MEATCPAN!!!
13:34 moritz and MEATPAN is a repository of Perl developers, right?
13:34 jberger (meatcpan is for cpan authors :D)
13:34 jberger haha
13:34 moritz ok, now I know what my next perl jobs page will be called :-)
13:34 jberger moritz, please oh please oh please, do it!
13:35 jberger batman, we should have an easter-egg module ::Brot :-)
13:35 batman ::Brot?
13:35 moritz jberger: I already have the login process (with Persona) set up, and one database table :-)
13:35 dvinciguerra joined #mojo
13:35 jberger http://en.wikipedia.org/wiki/Mandelbrot_set
13:36 jberger moritz, \o/
13:36 batman jberger: sorry, i don't follow :(
13:36 * jberger is a scientist, its a disease really
13:36 batman hehe
13:36 batman i'm mostly a n00b. i think that's worse :P
13:38 jberger batman, my plan is, as soon as I have some time (ha!), to make a fork of that comic site using Mandel, which will let me get a feel for it
13:38 jberger but after reading it last night, it seems to be a logical extension from what I had in mind
13:38 jberger good work
13:38 tianon fyi, it looks like meatcpan.org might be available ;)
13:39 batman thanks!
13:39 batman i've started writing tests now...
13:39 tianon and you'll have the possibility of typoers trying to hit metacpan.org :D
13:39 batman going to sink the boat with them i think ;)
13:39 jberger moritz, brings up a good point, is it meatpan or meatcpan?
13:40 btyler joined #mojo
13:40 sri comprehensive meat archive network
13:41 batman :D
13:42 jberger sri: you really can't be proposing cman can you :o
13:46 tianon "I have the power!"
13:49 good_news_everyone joined #mojo
13:49 good_news_everyone [mojo] kraih pushed 1 new commit to validation: http://git.io/Y2nC9Q
13:49 good_news_everyone mojo/validation 484e68c Sebastian Riedel: renamed has_errors to has_error
13:49 good_news_everyone left #mojo
13:49 moritz jberger: I find that "meatpan" sounds nicer and is easier to pronounce
13:49 moritz (fuck correctness)
13:49 good_news_everyone joined #mojo
13:49 good_news_everyone [mojo] kraih pushed 1 new commit to validation: http://git.io/yE1Ktw
13:49 good_news_everyone mojo/validation c91aae1 Sebastian Riedel: fixed a few test descriptions
13:49 good_news_everyone left #mojo
13:50 sri with meatcpan you get the people that typo metacpan too though :)
13:50 moritz maybe I'll just register both domains
13:50 tianon and then they go - wait, this isn't metacpa... JOB LISTINGS! \o/
13:51 tianon or just have a big hypnotoad and a link directly to the Mojo ++ button on metacpan >:)
13:55 marty haha.  Talking about has awesome mongo+mango is and today I have to work with mysql. :O    but I found a kewl native osx mysql editor.   Sequel Pro, it's pretty good.
13:55 marty s/has/how/
14:02 good_news_everyone joined #mojo
14:02 good_news_everyone [mojo] kraih pushed 1 new commit to validation: http://git.io/21ANFA
14:02 good_news_everyone mojo/validation 8af0e78 Sebastian Riedel: added regex check
14:02 good_news_everyone left #mojo
14:13 good_news_everyone joined #mojo
14:13 good_news_everyone [mojo] kraih pushed 1 new commit to validation: http://git.io/Oc5J3A
14:13 good_news_everyone mojo/validation 237d540 Sebastian Riedel: added equal_to check
14:13 good_news_everyone left #mojo
14:15 gryphon joined #mojo
14:17 kwa sri: Good work adding the extra validators. When will it stop though? :)
14:17 kwa Ah, you've renamed range to size.
14:17 kwa Makes sense.
14:18 good_news_everyone joined #mojo
14:18 good_news_everyone [mojo] kraih pushed 1 new commit to validation: http://git.io/01jY6A
14:18 good_news_everyone mojo/validation 2587e03 Sebastian Riedel: a few more equal_to tests
14:18 good_news_everyone left #mojo
14:18 sri kwa: i won't add too many checks, just the basics you need all the time
14:19 kwa sri: How about an enum equivalent? Boolean?
14:19 sri boolean is pointless, required() already does that
14:21 sri enum maybe
14:21 mire__ joined #mojo
14:23 * sri wonders if anyone is still against validation in core
14:23 Lathan left #mojo
14:23 kwa What if a boolean field is optional. If it is submitted it needs to be 0 or 1? I suppose the enum would work there.
14:23 sri it would
14:24 sri needs a better name than enum though :o
14:24 batman set?
14:24 sri too confusing
14:24 kwa sri: I think it suits Mojo's goals. The validators you're proposing would fit most cases.
14:24 sri "what are you setting?"
14:24 batman :)
14:25 batman true
14:25 sri the integration with tag helpers is also really sweet
14:25 kwa SQL uses 'IN' which could work.
14:25 kwa ->in(qw/0 1/)
14:25 sri (<div class="field_with_errors">...</div> around tags that failed validation)
14:26 sri i like ->in
14:26 batman in++
14:26 sri ->required('foo')->in(qw(bar baz yada))
14:26 doby joined #mojo
14:28 kwa Works for me.
14:28 crab i like in
14:38 batman i wonder if any events should be visible in Mango
14:38 howitdo joined #mojo
14:39 batman i'm thinking the main Mango events should probably be able to hook into..? or is $connection->mango->on(error => ...) good enough?
14:39 batman vs $connection->on(error => ...);
14:48 asarch joined #mojo
14:52 ryozi joined #mojo
14:59 yakudza joined #mojo
15:00 batman https://github.com/jhthorsen/ma​ndel/blob/master/t/model-anon.t # anon models :)
15:01 batman going to actually start using mandel now...
15:01 batman let me know if something is seriously broken :)
15:01 batman mst: wanna go in with your sledgehammer? ;)
15:02 mst I would suggest, if you can, making the class name Mandel::Document::__ANON__::DOC1::Person
15:02 mst i.e. tack something on the end to make debugging easier
15:03 batman clever
15:05 good_news_everyone joined #mojo
15:05 good_news_everyone [mojo] kraih pushed 1 new commit to validation: http://git.io/euWrYg
15:05 good_news_everyone mojo/validation d05705c Sebastian Riedel: added in check
15:05 good_news_everyone left #mojo
15:09 mst also, consider maintaining a separation between the collection itself and a subset thereof - the DBIC ResultSet vs. ResultSource distinction isn't perfect but it has its uses
15:10 sri in mongodb terms that would be collection and cursor
15:10 batman where did i go wrong? ::Model is supposed to be the same as ::ResultSource and ::Collection should match ::ResultSet
15:14 mst ahhh
15:14 mst batman: sorry, there's no test for ::Model's class unlike the other two and I blanked on the intermediate stage
15:15 mst also, do make sure to make the cursor object a third thing
15:15 mst $rs->next is in hindsight just as gross as 'each %hash'
15:15 batman no test for ::Model's class? i thought i had covered that in t/model-anon.t :(
15:16 batman was $rs->next a wrong turn? should it had been $rs->cursor->next ?
15:17 mst it should be something like 'my $iter = $rs->iter; while (my $row = $iter->next) {'
15:18 mst so the iterator is independent of the 'virtual collection' (or whatever you want to call it conceptually) that it's iterating over
15:18 batman ok. i think it's nice as long as the $rs is always a new object once you do search()
15:18 batman but i trust your judgement. so i should add Mandel::Iterator ?
15:19 mst yes. what happened with DBIC was ResultSet evolved from Class::DBI::Iterator
15:19 mst had I realised the 'collection class' part would be so important I'd never have left them as the same thing
15:20 moltar joined #mojo
15:20 batman ok. can i still have Mandel::Collection::all(), ::remove() and other stuff that doesn't mess with the cursor?
15:20 mst oh, absolutely
15:20 batman sweet. i'll give it a shot
15:21 mst this way you can stash a collection object that you're planning to iterate over
15:21 mst and not end up screwed if you forget to ->reset after exhausted ->next
15:21 batman right.
15:21 mst which is the key easy-to-introduce bug, same as 'each'
15:21 batman i see
15:22 * batman jumps into the hackmobile *nanananana*
15:22 mst it's nice to be able to pre-build a collection object and re-use it
15:25 * sri wonders if he's handling the ?foo=bar&foo=baz case correctly by running the check against each value individually and stopping with an error if one fails the check
15:32 * batman wonder if model() always should return the model object instead of allowing chaining
15:40 Dandre I have some issue using cover from Devel::Cover, can anyone help me?
15:40 batman not without you telling us the issue
15:41 Dandre I want to create report for lib/foo but not for lib/bar
15:42 Dandre I have tried cover -select_re lib/foo
15:42 batman have you tried ( cover -select_re '.*lib/foo.*' ) ?
15:42 Dandre and plenty of other alternatives but I get everything under lib
15:42 batman what about -ignore_re '*bar*' ?
15:42 Dandre I think so
15:43 Dandre doesn't work
15:43 batman so what is your exact ignore_re? ...since mine is full of errors
15:44 Dandre cover -ignore_re '.*lib/Mango.*'
15:45 batman i think there's something you aren't telling us...
15:45 batman try to clear out everything (cover_db, blib, ...) and start from scratch
15:46 Andreas joined #mojo
15:48 Dandre batman: http://pastebin.fr/28885
15:51 batman i thought you needed to ignore files when testing...
15:52 batman DEVEL_COVER_OPTIONS="-ignore_re,.*lib/Mango.*"
15:52 batman or something like that
15:53 mire__ joined #mojo
15:53 Dandre ok seems to work. Now I'll try -select_re
15:56 Dandre doesn't work for select
15:56 batman why do you care?
15:56 sh3 joined #mojo
15:58 Dandre because I don't want reports for external modules put i my lib directory
15:58 batman but "-ignore,..." worked..?
15:58 Dandre yes but I have 3 or 4 other path to exclude
16:02 Gedge joined #mojo
16:03 batman mst: https://github.com/jhthorsen/mandel/commit​/2fe962e8c33f8d140b391d846884d6b11b449eaf
16:04 mst you, erm, probably want the iterator to own the underlying cursor as well
16:05 good_news_everyone joined #mojo
16:05 good_news_everyone [mojo] kraih pushed 1 new commit to validation: http://git.io/hYl2IQ
16:05 good_news_everyone mojo/validation 1f74004 Sebastian Riedel: added error message for in check
16:05 good_news_everyone left #mojo
16:05 batman ::Iterator has "cursor" attribute. What, but the cursor object is constructed in the ::Collection
16:05 batman not sure what you mean...
16:05 sri guess it's time to write some validation recipes for the guides :o
16:06 batman s/What, but/but/
16:06 dod joined #mojo
16:07 batman mst: i thought that would be enough, since ::Iterator::_cursor is now a method, not an attribute?
16:08 * batman wonder if he can make Mandel work with Mojo::Redis as well... *evil thoughts*
16:10 Dandre joined #mojo
16:10 dqw6 joined #mojo
16:11 mst batman: er, I mean that the iterator object should, by default, have an independent cursor
16:11 mst batman: otherwise two iterators will share it
16:11 mst batman: and, um, still screwed
16:12 good_news_everyone joined #mojo
16:12 good_news_everyone [mojo] kraih pushed 1 new commit to validation: http://git.io/Yb6RcQ
16:12 good_news_everyone mojo/validation bcad6ff Sebastian Riedel: hide validation
16:12 good_news_everyone left #mojo
16:13 batman mst: how is it not independant?
16:14 batman each time you do $collection->iterator; you will get a new ::Iterator object with a fresh $cursor
16:14 mst ohh, I see what you did, right
16:14 mst I would've renamed it to _new_cursor or something
16:14 mst but that's ... that's really not a big deal
16:15 mst you're right, I misread the code
16:15 batman so i'm good?
16:16 batman https://github.com/jhthorsen/mandel/commit​/0ea2b579f75204ea097a9f8dfa9918e46d84be48 :)
16:16 batman and the commit message: "Add Mandel::Iterator because mst told me to" ?
16:17 batman ;)
16:20 batman mst: i really appreciate the dbic-fu, because then i don't have to step into the same pit holes
16:21 mst the commit message amused me, yes :D
16:21 batman excellent! after all, that's why i write commit messages...
16:21 mst my greatest regrets are probably ->next and making ->search care about list context
16:22 batman yeah. thanks for letting me know that :)
16:23 batman i'm pretty satisfied with the modelling of Mandel objects now
16:23 batman i feel a 0.01 is closer
16:26 batman i wonder if validation should be done on save()
16:27 batman or earlier
16:28 kwa Home time. Good luck with your hacking batman.
16:28 kwa Jiminy jillikers.
16:28 batman kwa: thanks
16:28 batman have a good weekend
16:28 kwa You too.
16:28 * kwa disappears in a haze of B.O.
16:35 dvinciguerra joined #mojo
16:37 dvinciguerra__ joined #mojo
16:40 bluescreen joined #mojo
16:40 asarch joined #mojo
17:12 wrnick joined #mojo
17:25 batman i wonder if it was a bad idea to call it "id" instead of "_id"
17:26 batman https://github.com/jhthorsen/mandel/b​lob/master/lib/Mandel/Document.pm#L42
17:27 theSmallAirline joined #mojo
17:49 rem_lex|pivo joined #mojo
17:56 btyler joined #mojo
18:12 basiliscos joined #mojo
18:13 thePopularKid joined #mojo
18:25 mire__ joined #mojo
18:27 d4rkie joined #mojo
18:30 batman it's alive :) https://metacpan.org/module/Mandel
18:31 sri batman++
18:31 da5id joined #mojo
18:45 batman thanks
18:58 marty batman++  \o/
18:59 batman i think it's better to get experimental stuff out there, than nothing at all :)
19:04 * sri wonders what example to use for explaining validation
19:04 * sri is not very creative today :S
19:08 Lee joined #mojo
20:14 andrefs_ joined #mojo
20:16 mtths joined #mojo
20:25 dotandimet joined #mojo
20:33 rem_lex| joined #mojo
20:35 rem_lex joined #mojo
20:36 omega joined #mojo
20:40 sri guess a number check would also make sense, with optional min/max
20:44 Andreas joined #mojo
21:04 marty sri:  Maybe ecommerce examples might be good. (it's all I know) :)   Somethings like cart_qty min/max  or maybe street_address length checks.  Just tossing out ideas
21:05 SmokeMachine joined #mojo
21:05 sri marty: too big i'm afraid
21:06 sri when i say example, i mean rendering guide recipe
21:06 marty ahhh, ok.  go it.
21:07 sri i've only done a silly login example with two small templates and it's already 40 lines :S
21:19 mire__ joined #mojo
21:34 marty joined #mojo
21:42 good_news_everyone joined #mojo
21:42 good_news_everyone [mojo] kraih pushed 1 new commit to validation: http://git.io/v4Jd9w
21:42 good_news_everyone mojo/validation dced100 Sebastian Riedel: added some documentation for form validation
21:42 good_news_everyone left #mojo
21:42 sri phew, thats a start
21:46 marty that actually looks real nice.  easy to read and follow.   looks like a good start to me.
21:46 sri \o/
21:47 marty I'll even try and use it as soon as I have the oportunity
21:48 marcus Guess I should try it as well.
21:50 sri i still need to explain advanced logic (dependencies between fields) and how to make your own checks/errors :o
21:54 sri but i suppose it's getting merge ready
21:54 sri and i see a field_error_block or so helper in our not so distant future, to control the <div class="fields_with_errors"> generation
21:54 sri btw. i'm not sure showing dynamic error messages when validation fails is such a big thing
21:54 sri i like just painting the input field red and describing the requirements upfront above the field
21:56 ilbot2 joined #mojo
21:56 Topic for #mojo is now 🎩, indubitably | http://mojolicio.us | http://irclog.perlgeek.de/mojo/today
22:12 ilbot2 joined #mojo
22:12 Topic for #mojo is now 🎩, indubitably | http://mojolicio.us | http://irclog.perlgeek.de/mojo/today
22:25 good_news_everyone joined #mojo
22:25 good_news_everyone [mojo] kraih pushed 1 new commit to validation: http://git.io/MMIF2A
22:25 good_news_everyone mojo/validation ddf1ffb Sebastian Riedel: test custom checks
22:25 good_news_everyone left #mojo
22:27 good_news_everyone joined #mojo
22:27 good_news_everyone [mojo] kraih pushed 1 new commit to validation: http://git.io/yvsxRQ
22:27 good_news_everyone mojo/validation 1215a07 Sebastian Riedel: more validation tests
22:27 good_news_everyone left #mojo
23:12 dqw6 joined #mojo
23:35 asarch joined #mojo

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