Camelia, the Perl 6 bug

IRC log for #mojo, 2013-09-25

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

All times shown according to UTC.

Time Nick Message
00:01 punter found the cause of my problem (it was my fault)
00:21 shmuel joined #mojo
00:26 k0xa joined #mojo
00:48 Daga joined #mojo
00:52 Daga If I make an unblocked call to ->get on a UserAgent object, is there a way to associate the returned page with a database ID (or any other static information)?
00:53 Daga at the moment I am rebuilding the URL and hoping there wasn't a redirect
01:02 hrupp joined #mojo
01:04 dvinciguerra joined #mojo
01:09 d4rkie joined #mojo
01:16 laouji joined #mojo
01:34 _sri haha, here's something cool we can do because we have validation in core
01:34 _sri steal the rails feature that puts <div class="fields_with_errors">...</div> around generated form elements that failed validation
01:36 jberger _sri, ooh, if you do that, try to make the failure class configurable, I know that bootstrap has classes for validation fail which are displayed in red
01:37 _sri how?
01:37 jberger hm, maybe that is hard
01:37 jberger just an offhand thought
01:38 jberger the div is going around the element, not the class on the element
01:38 jberger sound like a job for a jQuery onload
01:45 _sri works perfectly btw :)
01:49 good_news_everyone joined #mojo
01:49 good_news_everyone [mojo] kraih pushed 1 new commit to validation: http://git.io/CzkDWA
01:49 good_news_everyone mojo/validation c325cb4 Sebastian Riedel: added validation support to form helpers
01:49 good_news_everyone left #mojo
01:49 _sri \o/
01:51 _sri you don't have to do anything besides calling $self->validation->required('foo'), form fields get wrapped if it fails
01:53 _sri and it's unobtrusive, if you don't use validation nothing happens
02:02 crab what do i have to read to understand validation?
02:02 _sri real documentation is not written yet
02:03 _sri https://github.com/kraih/mojo​/compare/master...validation
02:03 _sri all still in the design phase
02:03 crab ok
02:03 _sri connecting validation and tag helpers is a huge step imo though
02:14 _sri this is basically what going more full-stack looks like
02:18 good_news_everyone joined #mojo
02:18 good_news_everyone [mojo] kraih pushed 1 new commit to validation: http://git.io/bNQnOw
02:18 good_news_everyone mojo/validation 13e8ae1 Sebastian Riedel: documentation tweaks
02:18 good_news_everyone left #mojo
02:19 _sri i imagine there will be many cool little details like ->errors returning a collection of messages in the end
02:22 _sri #= validation->errors('title')->map(sub { tag(div => sub { $_ }) })
02:31 _sri jberger: i suppose if we really wanted to make the wrapping pluggable we could add a validation_wrap helper or so
02:31 _sri you pass a name and the html that should be wrapped and it just does it
02:32 _sri $self->validation_wrap(foo => $self->text_field('foo'))
02:32 _sri then you could just replace the helper
02:42 _sri oooh, a new high quality open source typeface for the collection http://mozilla.github.io/Fira/
02:43 _sri apparently a Meta fork designed by erik spiekermann :o
02:48 rem_lex|pivo joined #mojo
03:00 Daga1 joined #mojo
03:06 jberger__ joined #mojo
03:08 abhishekisnot1 jberger__: thanks for your suggestions. I ended up using Mojo::Exception to throw errors in helpers and application uses try catch from Exception::SEH to return from action - http://pastie.org/8353395
03:10 sri abhishekisnot1: there was a discussion about that on the mailing list https://groups.google.com/forum/​#!topic/mojolicious/oU-JMIiFxQ4
03:12 preflex_ joined #mojo
03:21 asarch joined #mojo
03:23 abhishekisnot1 sri: that's awesome. I guess I need to study hooks in more details.
03:30 abhishekisnot joined #mojo
03:35 abhishekisnot wow these hooks are really handy.
03:35 abhishekisnot sri, thanks you very much for pointing to the thread
03:45 lukep joined #mojo
04:06 spacechicken joined #mojo
04:07 KindTwo joined #mojo
04:10 spacechicken Hi. Is this guide http://mojolicio.us/perldoc/Mojolicious/G​uides/Growing#WELL_STRUCTURED_APPLICATION complete? The Login controller appears to be missing the 'protected' action
04:11 sri it's a route without action
04:12 * sri wonders how he ended up with the method name element_exists_not()
04:12 sri element_doesnt_exist makes more sense
04:13 spacechicken okay. But running the application under the morbo server returns messages complaining about the absence of the action in the controller
04:14 spacechicken by the way - thanks for replying and for building Mojo :)
04:15 sri define complain
04:15 spacechicken [debug] GET "/protected".
04:15 spacechicken [debug] Routing to controller "MyApp::Login" and action "protected".
04:15 spacechicken [debug] Action not found in controller.
04:15 spacechicken [debug] Nothing has been rendered, expecting delayed response.
04:15 spacechicken [debug] Inactivity timeout.
04:16 sri STOP!
04:16 sri never ever paste into an irc channel
04:16 spacechicken sorry
04:21 crab "doesnt" without an apostrophe makes baby jesus cry
04:22 sri crab: it's fine, we use _isnt_ as well
04:22 sri not just we...
04:23 sri maybe a native english speaker can clarify if element_exists_not is bad english
04:25 crab it's merely a little old-fashioned and odd, not bad.
04:26 crab very "maths textbook from the 1940s"
04:29 crab (yes, i am a native english speaker. :-P any pucca englishman would refer to me as a native, and here i am speaking english.)
04:31 spacechicken element_exists_not isn't grammatically correct English but it conveys the message of being the opposite to element_exists which is what I assume you're going for (to avoid the word native - English is my mother tongue)
04:31 spacechicken sri - http://pastebin.com/8xcs4yuh
04:37 zivester joined #mojo
04:42 jberger_ joined #mojo
04:58 dqw6 joined #mojo
05:11 basic6_ joined #mojo
05:31 dqw6 joined #mojo
05:38 ver joined #mojo
05:42 jberger_ joined #mojo
06:01 dotandimet joined #mojo
06:02 TheCrimsonRadish__ joined #mojo
06:07 howitdo joined #mojo
06:11 abhishekisnot left #mojo
06:12 abhishekisnot joined #mojo
06:21 Vandal joined #mojo
06:21 sjn joined #mojo
06:24 jberger_ joined #mojo
06:29 KindTwo joined #mojo
06:36 ladnaV joined #mojo
06:40 Vandal joined #mojo
06:42 jberger_ joined #mojo
06:51 yakudza joined #mojo
06:54 dod joined #mojo
06:55 dod joined #mojo
07:09 denisboyun joined #mojo
07:09 marcus Foreman looks pretty neat, guess you could use it to manage mojo apps as well as ruby - http://blog.daviddollar.org/2011​/05/06/introducing-foreman.html
07:11 jberger__ joined #mojo
07:11 marcus I see there's an early perl port on cpan http://search.cpan.org/~kazeb​uro/Proclet-0.22/bin/proclet
07:16 dod joined #mojo
07:24 mire_ joined #mojo
07:31 jberger joined #mojo
07:42 trone joined #mojo
07:43 themage joined #mojo
07:53 kwa crab: I feel your pain with "doesnt" but I've had to succumb to doing something similar. Would you write your method as element_does_not_exist so you can sleep at night? :)
07:56 crab yes. or no_such_element or something.
07:56 crab i'm a very big fan of sleeping at night.
07:56 kwa haha
07:57 kwa What about apostrophes for styling?
07:58 crab what about them? (i don't know what you mean)
07:58 kwa I'm upset by T's and C's, but have to admit it does make things clearer.
07:58 crab i hate those too. but i write them if i have to.
07:59 kwa Do you only lose about half an hour sleep for those?
08:00 crab no. once i decide something has to be done, i'm pretty good about not losing sleep over it.
08:00 kwa Spoken like a potential murderer.
08:01 kwa However, it makes justifying killing those who don't use punctuation properly easier.
08:01 crab of course, it's pretty easy to begin with.
08:02 kwa Murder, or punctuation?
08:03 crab the murder of mispunctuators.
08:03 crab or rather, putting them out of my misery.
08:04 kwa :)
08:06 d4rkie joined #mojo
08:18 basiliscos joined #mojo
08:55 dod1 joined #mojo
08:57 alnewkirk joined #mojo
08:57 kwa sri: I like your use of subs for setting errors in the validator (https://github.com/kraih/mo​jo/commit/199a67fe7993#L2R7), but won't that make it more difficult to set custom errors using config files/internationalisation?
09:00 dod joined #mojo
09:04 dod1 joined #mojo
09:05 kwa I suppose it would just require errors to be set using Perl. Doing it that way allows much more control in the error than using custom parsing like "Value needs to be :arg1-:arg2 characters long."
09:05 kwa s/that way/your way/
09:13 fhelmber_ joined #mojo
09:21 dod joined #mojo
09:24 dod joined #mojo
09:49 mire joined #mojo
10:03 bowtie_ joined #mojo
10:03 Daga1 Scratch my earlier question. It looks like I should be using a closure instead of a reference to a function...
10:11 Dandre hello,
10:12 Dandre Is there a possibility to get all available plugins under a given namespace?
10:12 Dandre or must I use Plugable module?
10:39 rem_lex joined #mojo
10:45 maxhq joined #mojo
11:12 batman Dandre: Mojo::Loader
11:31 dqw6 joined #mojo
11:52 asarch joined #mojo
11:53 mire joined #mojo
12:00 dod joined #mojo
12:22 Dandre Ok I'll try
12:22 Dandre can I use these found modules as plugin?
12:29 KindTwo joined #mojo
12:58 batman i have no idea
13:01 Dandre aparently it doesn't find my modules
13:06 Dandre How can I know whether a plugin is already loaded?
13:07 ryozi joined #mojo
13:20 batman My::Plugin->can('register'); # something like that
13:33 Dandre what happens if I load a plugin twice?
13:36 kwa Dandre: https://metacpan.org/module/Cl​ass::Inspector#installed-class
13:38 Dandre ok
13:39 kwa Well, that tells you if it's installed at least. You can then load it, or use UNIVERSAL::require or your own implementation.
13:41 kwa Dandre: If you just want to load the modules, you might be able to use something like Module::Find. (If you don't want to do the work yourself, not quite sure what it is you're trying to achieve.)
13:43 batman Dandre: you're not telling us what you really want
13:43 batman sounds like you're doing something you don't need to
13:48 Dandre I have an application that can potentially be extended (add routes and functionnalities). This will be done registering into th Mojolicious pligins as it can extend routes. What I am trying is to automatically discover those plugins and load them if available and not previously loaded
13:51 Dandre here is what I have coded:
13:51 Dandre http://pastebin.fr/28868
13:55 kwa Dandre: You might want to add them as plugins explicitly. If you automatically load the plugins, what happens if you add a plugin into the namespace that you don't want to require. E.g., if you're writing a new plugin.
13:55 sh4 joined #mojo
13:56 kwa If you're sure you do, you could use Module::Find::useall. It's not much code, so it might be worth checking the source and implementing it yourself.
14:01 Dandre I don't see any difference between  Module::Find::useall  and my code.
14:01 Dandre You're right I must find a way to better filter the modules found
14:02 Dandre but I don't see how without loading or requiring the module
14:04 Dandre perhaps I could require the module, do some check whetther autoload is allowed ($module->can(autoload) for instance) and then cal $self->plugin
14:07 btyler joined #mojo
14:09 marty joined #mojo
14:11 kwa Dandre: If you're adding Mojolicious plugins, you can just check for the 'register' method. Plugins without this will not autoload.
14:11 kwa Still doesn't solve the problem of testing a plugin. :)
14:12 kwa (Unless you add it outside of the 'autoload' plugin namespace I suppose.)
14:15 mire joined #mojo
14:15 Dandre kwa: can I check for the 'register' method withour requiring it?
14:17 kwa Nah, doubt it.
14:18 dotandimet joined #mojo
14:20 marty joined #mojo
14:28 marty these_are_not_the_elements_you_are_looking_for
14:35 sh3 joined #mojo
14:40 denisboyun joined #mojo
14:54 Dandre marty: what do mean?
15:03 marty Dandre:  21:12  wonders how he ended up with the method name element_exists_not()  --  (I was late but I could not resist)   :)
15:04 gryphon joined #mojo
15:08 Adura element_exists_totally
15:09 Dandre ok I thought it was related to my issue, sorry
15:14 yakudza joined #mojo
15:28 TheCrimsonRadish__ joined #mojo
15:35 abhishekisnot_ joined #mojo
15:48 bluescreen joined #mojo
15:50 D4RK-PH0ENiX joined #mojo
15:59 doby joined #mojo
16:03 mire joined #mojo
16:04 d4rkie joined #mojo
16:46 batman jberger: https://github.com/jhthorsen/MangoModel/comm​it/ad6fafde9c6cadaeeffd2e18fc76cde4c738b607
16:46 batman jberger: do you see what i do with MangoModel automatically?
16:46 batman just curious how the flow could be...
16:46 batman or if you bluntly ignore my commits :)
16:51 batman also, why did you call it ::Type and not ::Document ?
17:39 mire joined #mojo
17:59 dvinciguerra joined #mojo
18:01 yakudza joined #mojo
18:47 trone joined #mojo
18:56 basiliscos joined #mojo
19:08 jnbek joined #mojo
19:24 basiliscos joined #mojo
19:28 moritz is there any helper sub inside a template for generating JSON?
19:29 batman moritz: <% use Mojo::JSON 'j'; %> <%= j { data => 123 } %>
19:29 batman so i guess the answer is no
19:29 batman would be easy to add though
19:31 moritz batman: .. or easy enough to use as is. Thanks.
19:31 batman :)
19:31 batman np
20:30 craigwood joined #mojo
20:49 btyler joined #mojo
20:56 spacechicken joined #mojo
21:15 duncanthrax joined #mojo
21:17 dvinciguerra joined #mojo
21:21 SmokeMac_ joined #mojo
21:44 rem_lex|pivo joined #mojo
21:49 lukep joined #mojo
21:58 perlite_ joined #mojo
22:02 moltar joined #mojo
22:05 tianon joined #mojo
22:35 spacechicken joined #mojo
22:48 marty joined #mojo
23:15 basic6 joined #mojo
23:29 dqw6 joined #mojo
23:50 asarch joined #mojo

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