The web in a box - a next generation web framework for the Perl programming language

IRC log for #mojo, 2015-06-27

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

All times shown according to UTC.

Time Nick Message
00:24 neilhwatson joined #mojo
00:58 bpmedley https://bitbucket.org/snippets/bpmedley/dEkzj <-- What about something like this for validations and filters in the same validator package?
01:10 Grinnz sri, do you mind if i change the variable names in Mojo::Util::secure_compare away from $a and $b, i stumbled on them while testing new perl critic policies
01:10 Grinnz maybe to $s1 $s2
01:11 CandyAngel Changing them from 2 nondescript names to a different 2 nondescript names seems pretty pointless to me
01:12 Grinnz $a and $b are special global variables for sort functions
01:12 klapperl_ joined #mojo
01:12 Grinnz sort isn't called in this function so it doesn't matter, but it's bad practice
01:14 CandyAngel If you are going to change them, maybe just change to $x and $y?
01:14 Grinnz doesn't matter to me, as long as it's not $a and $b and doesn't push the line over 80 chars ;)
01:15 CandyAngel :P
01:26 bpmedley http://browniefed.com/blog/2015/06/07/react-native-layout-examples/ <-- Look how cool this is.  It's made for working with Mojolicious and an API.. :)
01:29 lluad joined #mojo
01:49 sri what exactly makes it bad practice?
01:50 sri not like $a and $b are super special
01:51 sri we don't want to use the package globals anywhere in secure_compare
01:51 Grinnz sri, if you do my ($a, $b); sort { $a ... $b } it screws up the sort
01:52 sri meh
01:53 pink_mist sri: $a and $b /are/ super special :P
01:54 Grinnz they can be used as package vars without declaring it, which makes them kind of scary too
01:56 sri Grinnz: your example is actually no problem at all
01:56 sri it just works
01:58 sri pink_mist: as far as i remember they are not even exempt from warnings
01:58 pink_mist yes they are
01:58 pink_mist $ perl -E 'use warnings; $a = 3; $b = 4; $c = 5'
01:58 pink_mist Name "main::c" used only once: possible typo at -e line 1.
01:58 sri pink_mist: https://metacpan.org/source/PEVANS/Scalar-List-Utils-1.42/lib/List/Util.pm#L28
01:59 Grinnz different perl version maybe?
01:59 pink_mist I'm on 5.20.0
02:00 Grinnz sri, https://metacpan.org/pod/distribution/perl/pod/perlvar.pod#a maybe they fixed that since
02:01 Grinnz if it localizes $a/$b now, like foreach does with $_, that would do it
02:02 sri anyway, i don't care about the name, if it makes you feel better, change it to something nice
02:03 sri $one/$two or whatever
02:03 pink_mist $ perl -E 'sub foo { my ($a, $b); print sort { $a <=> $b } 10,14,39845,24,1; } foo;' #101439845241 <-- if it had sorted it would have been 110142439845
02:03 Grinnz ahh maybe it depends on them being global
02:03 Grinnz to carry values between iteration
02:09 noganex joined #mojo
02:11 good_news_everyon joined #mojo
02:11 good_news_everyon [mojo] Grinnz pushed 1 new commit to master: http://git.io/vt4wa
02:11 good_news_everyon mojo/master caa15a1 Dan Book: avoid special sort variables $a/$b
02:11 good_news_everyon left #mojo
02:11 pink_mist Grinnz++
02:52 Grinnz sri, oops, punycode_encode uses $b as well, but i don't know what it stands for... lots of 1 letter vars in that sub ;)
02:54 df joined #mojo
03:05 kaare joined #mojo
03:24 tim_ joined #mojo
04:03 irq joined #mojo
06:29 trone joined #mojo
06:36 zivester joined #mojo
06:54 berov joined #mojo
07:08 irq_ joined #mojo
07:16 amon joined #mojo
07:32 rwp joined #mojo
08:02 Vandal joined #mojo
08:06 bin_005 joined #mojo
08:30 dotandimet joined #mojo
08:38 batman sri: pretty sure this is ugly, but is it impossible? https://ssl.thorsen.pm/paste/23ce76d95d9d :)
08:39 batman just and idea for validation and being able to change the data...
08:39 bpmedley batman: https://bitbucket.org/snippets/bpmedley/dEkzj <-- May I ask what you think about this?
08:42 bpmedley It's similar to what you did; however, the filters and checks are in different data structures.
08:49 batman i don't like being able to do filtering after a check.
08:49 batman not sure if they are different
08:51 bpmedley Can you elaborate on that?  You're not sure if what is different?
08:53 bpmedley Also, I see your point about restricting filters to be before checks.
08:53 batman i would like if a check can try to coerce the value into something it consider valid.
08:55 bpmedley Hrrm.. I'm thinking that a check should never change a value.
09:01 batman well... i think it's a bit weird to do $c->required("phone")->make_valid_phone_number->validate_phone_number; when $c->required("phone")->phone_number could do it all.
09:01 bpmedley I see your point.
09:08 bpmedley $c->required("phone")->trim->fmt_e164->valid_e164->is_country('iceland')   <-- I was thinking that there would be primitives that many different parameters could take advantage of.
09:12 batman yeah, but what happens if you can't trim() ? i think it should result in error("phone")
09:12 bpmedley When would trim fail?
09:14 bpmedley Or, are you just saying in general?  When a filter would fail?
09:14 batman yes
09:15 batman like clean_up_number() would fail if there's no [0-9] in the string (not sure if that's a good example)
09:15 bpmedley Sure, that makes sense and I agree.
09:17 dod joined #mojo
09:21 dod joined #mojo
09:23 batman sri: the patch i did might be a bit nicer if skipping $_ and just allowing $_[2] to be modified (since it's an alias)
09:30 bpmedley May I ask how you would propose to do these validations and filters: https://bitbucket.org/snippets/bpmedley/gEqzz
09:36 batman bpmedley: do you want me to write example code...? sorry, don't have time for that
09:36 bpmedley Understood
09:58 dotandimet joined #mojo
10:16 sh4 joined #mojo
10:24 dod joined #mojo
10:48 klapperl joined #mojo
10:51 frederico joined #mojo
10:54 klapperl_ joined #mojo
11:03 trone_ joined #mojo
11:11 klapperl joined #mojo
11:14 ToApolytoXaos joined #mojo
11:22 xiv joined #mojo
11:36 sri Grinnz: literally "b" https://tools.ietf.org/html/rfc3492#section-6.3
11:37 pink_mist damn, that's a bummer
11:37 sri but i guess you could call it $basic
11:39 klapperl joined #mojo
11:44 klapperl_ joined #mojo
11:52 klapperl joined #mojo
12:07 klapperl_ joined #mojo
12:08 marty joined #mojo
12:12 klapperl joined #mojo
12:14 good_news_everyon joined #mojo
12:14 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/vtBh7
12:14 good_news_everyon mojo/master 82f200b Sebastian Riedel: avoid special variable $b
12:14 good_news_everyon left #mojo
12:17 pink_mist nice
12:17 pink_mist sri++
12:28 klapperl joined #mojo
12:39 klapperl joined #mojo
12:50 klapperl joined #mojo
13:09 dod joined #mojo
13:13 zivester joined #mojo
13:27 klapperl joined #mojo
13:42 klapperl joined #mojo
13:47 klapperl_ joined #mojo
13:52 sri :)
13:54 klapperl joined #mojo
13:59 sri too bad this has not happened yet https://github.com/rurban/Cpanel-JSON-XS/issues/37
14:03 mattastrophe joined #mojo
14:05 klapperl joined #mojo
14:11 klapperl_ joined #mojo
14:33 klapperl joined #mojo
14:39 klapperl_ joined #mojo
15:04 klapperl joined #mojo
15:09 klapperl_ joined #mojo
15:14 klapperl joined #mojo
15:19 klapperl_ joined #mojo
15:30 klapperl joined #mojo
15:35 klapperl_ joined #mojo
15:40 klapperl joined #mojo
15:40 ajr_ joined #mojo
15:52 PryMar56 joined #mojo
16:09 sh4 joined #mojo
16:10 klapperl_ joined #mojo
16:22 Kogurr joined #mojo
16:25 klapperl joined #mojo
16:43 Grinnz sri, agreed, but i am glad his response was positive
16:57 klapperl_ joined #mojo
17:08 klapperl joined #mojo
17:11 absolut_todd joined #mojo
17:13 klapperl_ joined #mojo
17:17 dotandimet joined #mojo
17:20 klapperl joined #mojo
17:25 klapperl_ joined #mojo
17:30 klapperl joined #mojo
17:38 klapperl_ joined #mojo
17:40 bpmedley https://bitbucket.org/snippets/bpmedley/gEqzz <-- sri, may I ask what you think of this approach for checks and filters?
17:44 klapperl joined #mojo
17:59 klapperl joined #mojo
18:00 sri bpmedley: i left the discussion yesterday
18:00 bpmedley Understood
18:01 sri personally, i have no interest in it anymore
18:01 sri anyone who still wants it will have to go for a majority vote
18:04 sri bpmedley: that said, your paste doesn't look any different than proposals we've had before
18:05 sri pretty sure you'll find a patch from me in the backlog with filters in AUTOLOAD too
18:06 bpmedley I see.  My bad.  I should have read the log more closely; I've skimmed it the last few days.
18:06 sri should have been july 2014
18:06 bpmedley I was out of the loop back then, I think.  I'll look.
18:07 sri anyway, i doubt it has much of a chance now
18:08 bpmedley It's cool.  Thanks for looking at my snippet; I'll try to be more responsive.. a year is a long time to wait.. ;)
18:15 KennV joined #mojo
18:22 klapperl_ joined #mojo
18:25 jberger http://www.builtinperl.com/perl-companies/floridaeastcoastrailway#
18:25 jberger kinda cool
18:28 klapperl joined #mojo
18:34 dotandimet joined #mojo
18:38 klapperl joined #mojo
18:43 bpmedley That is cool.  Interest in Perl and Mojolicious is on the uptick, it seems.
18:49 klapperl joined #mojo
18:56 bin_005 joined #mojo
18:57 klapperl_ joined #mojo
19:07 klapperl joined #mojo
19:11 dotandimet joined #mojo
19:16 klapperl_ joined #mojo
19:20 klapperl joined #mojo
19:33 klapperl joined #mojo
19:33 brainbuz joined #mojo
19:38 klapperl_ joined #mojo
19:46 ajr_ I see there was a flash update on Wednesday http://advisories.mageia.org/MGASA-2015-0248.html
19:47 ajr_ That could explain why my flash player was broken on Friday.
19:47 ajr_ Has anyone else had a problem?
19:48 jberger To fix flash, simply uninstall flash
19:48 jberger Done
19:48 ajr_ Sorry, wrong channel
19:49 jberger Eh, my comment stands anyway :p
19:49 ajr_ Agreed, unfortunately, not all video suppliers have got the message yet.
19:50 jberger Hmm true, but it is getting better
19:50 jberger Apple accomplished that much at last
19:50 jberger Last
19:50 jberger Dammit
19:50 jberger Least
19:52 mst FINALLY
19:55 dotandimet joined #mojo
20:15 klapperl joined #mojo
20:23 klapperl_ joined #mojo
20:35 klapperl joined #mojo
20:40 klapperl_ joined #mojo
20:45 dod joined #mojo
20:46 klapperl joined #mojo
20:51 klapperl_ joined #mojo
21:08 bin_005 joined #mojo
21:37 klapperl joined #mojo
21:42 klapperl_ joined #mojo
21:53 klapperl joined #mojo
22:10 jb360 joined #mojo
22:22 klapperl joined #mojo
22:32 klapperl joined #mojo
22:47 klapperl joined #mojo
22:55 neilhwatson joined #mojo
23:11 klapperl_ joined #mojo
23:16 klapperl joined #mojo
23:26 buu Is there any simple way to get access to the template the renderer would choose by default inside a route?
23:26 klapperl_ joined #mojo
23:29 sri http://mojolicio.us/perldoc/Mojolicious/Renderer#template_for
23:32 buu Oh. Thanks.
23:32 buu I even read down to the render documentation a line above that method but missed that one =/
23:32 buu I dunno why I have so much trouble with the mojo pod
23:35 bpmedley buu: It was common for me to miss things the first few passes, as well.  There was just a lot to absorb.
23:35 buu So, er, do I need to do $self->app->renderer->template_for($self) ?
23:41 bpmedley This worked for me: https://bitbucket.org/snippets/bpmedley/ekqo7
23:43 buu So... yes? =]
23:44 bpmedley Yes, it would seem as such.
23:50 klapperl joined #mojo
23:52 frederico joined #mojo
23:58 dvinciguerra joined #mojo

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