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

IRC log for #mojo, 2015-04-25

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

All times shown according to UTC.

Time Nick Message
00:11 mattastrophe joined #mojo
00:18 asarch joined #mojo
00:44 absolut_todd joined #mojo
01:25 klapperl_ joined #mojo
01:43 wingfold joined #mojo
01:54 melo1 joined #mojo
01:56 punter joined #mojo
02:01 Grinnz joined #mojo
02:09 mattastrophe joined #mojo
02:11 theshane joined #mojo
02:12 theshane Hello all, I was wondering if someone could help me with a regex issue that I am having.
02:14 wingfold joined #mojo
02:15 theshane I am looping through files and and trying to get files that end in .css but keep getting .scss files too. I also need it to find .js files and not .js(X). How can I match the end of the string exactly with a variable name? my $ext = '.css'   my $ext_qr = qr/$ext$/; if($file =~ m/$ext_qr/) #Matches extension exactly
02:16 Grinnz_ joined #mojo
02:20 Grinnz interpolated variables are still regexes. use quotemeta or \Q (or just escape the ., if you're only using it for that)
02:21 Grinnz if ($file =~ m/\Q$ext\E$/)
02:23 theshane Thanks! That did it
02:23 memowe joined #mojo
02:55 wingfold joined #mojo
02:57 irq joined #mojo
02:58 noganex joined #mojo
03:04 absolut_todd joined #mojo
03:09 memowe joined #mojo
03:21 basic6_ joined #mojo
03:56 wingfold joined #mojo
04:14 eduardow joined #mojo
04:24 Oleg joined #mojo
04:33 good_news_everyon joined #mojo
04:33 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/vfogT
04:33 good_news_everyon mojo/master 6bdb356 Sebastian Riedel: mention the name method
04:33 good_news_everyon left #mojo
04:45 absolut_todd joined #mojo
05:12 kaare joined #mojo
05:24 wilma joined #mojo
05:44 wingfold joined #mojo
06:07 Lee_ joined #mojo
06:28 dotandimet joined #mojo
06:31 absolut_todd joined #mojo
06:38 basic6 joined #mojo
07:01 dod joined #mojo
07:06 dod joined #mojo
07:13 eduardow joined #mojo
07:17 eduardow joined #mojo
07:28 eduardow joined #mojo
07:33 wingfold joined #mojo
07:37 Vandal joined #mojo
08:10 trone joined #mojo
08:38 dotandimet joined #mojo
08:55 wariat joined #mojo
09:04 memowe joined #mojo
09:08 Oleg joined #mojo
09:09 melo joined #mojo
09:22 wingfold joined #mojo
09:30 berov joined #mojo
09:43 riche q on Mojo::Collection: is the map method the only 'clean' way to add elements?
09:44 sh4 joined #mojo
09:45 riche no that is wrong ... I guess creating a new collection is the only real way
10:00 mattastrophe joined #mojo
10:03 memowe joined #mojo
10:05 lluad_ joined #mojo
10:34 kaare joined #mojo
10:35 absolut_todd joined #mojo
10:53 wingfold joined #mojo
10:58 ToApolytoXaos joined #mojo
11:01 mattastrophe joined #mojo
11:01 batman ribasushi: it's an array-ref: https://metacpan.org/pod/Mojo::Collection#DESCRIPTION
11:02 batman push @$collection, @whatever;
11:02 batman ooops! I meant riche
11:02 absolut_todd joined #mojo
11:22 robinsmidsrod joined #mojo
11:24 riche joined #mojo
11:25 riche batman: I am trying to use Mojo::Collection for an attribute so it gets cumbersome
11:25 riche would rather do $foo->bar->add or $foo->bar->push
11:26 riche I might just subclass it anyway because I want to do blessed ref type checking
11:28 riche i wouldn't bother but I like ->tap and i basically reuse code from other places for stuff like ->flatten
11:29 riche gotta go back offline ... just logged in to respond to you.. saw your comment in logs
11:50 robinsmidsrod joined #mojo
12:02 absolut_todd joined #mojo
12:05 genio joined #mojo
12:08 robinsmidsrod joined #mojo
12:15 robinsmidsrod joined #mojo
12:17 absolut_todd joined #mojo
12:36 juikuen joined #mojo
12:42 wingfold joined #mojo
12:49 mattastrophe joined #mojo
12:54 theshane joined #mojo
13:03 absolut_todd joined #mojo
13:22 theshane joined #mojo
13:32 riche joined #mojo
13:58 wingfold joined #mojo
14:05 irq joined #mojo
14:18 chansen joined #mojo
14:24 batman riche: i don't get why you can't do push @{$obj->bar}, "whatever".
14:26 riche i can, but I don't want to.
14:26 jberger batman: chaining
14:26 purl rumour has it chaining is Catalyst::DispatchType::Chained or http://www.catalystframework.org/calendar/2006/10 or the bizomb
14:26 riche that too
14:26 riche but
14:26 riche I will need some more functionality later for constraints
14:27 * batman pulls out. not interested.
14:31 mattastrophe joined #mojo
14:35 cpan_mojo Mojo-JWT-0.03 by JBERGER https://metacpan.org/release/JBERGER/Mojo-JWT-0.03
14:45 eduardow1 joined #mojo
15:02 absolut_todd joined #mojo
15:18 ajr_ joined #mojo
15:35 diginet_ joined #mojo
15:36 batman off-topic: can someone translate this python snippet to perl? return ('00' + str)[-2:]
15:37 batman is it substr "00$str", -2; ...?
15:38 lluad Yes. Or substr('00' . $str, -2)
15:38 lluad (Assuming I'm understanding the python, anyway :) )
15:39 batman ok...
15:47 wingfold joined #mojo
16:02 memowe joined #mojo
16:23 preaction or sprintf "%02d", $str
16:23 preaction i think that is what it is effectively trying to do
16:36 absolut_todd joined #mojo
16:38 DesertFox joined #mojo
16:41 mattastrophe joined #mojo
16:42 batman preaction: ok. thanks. makes more sense actually. i still don't get the logic though :(
16:43 sri but... python is basically executable pseudocode!
16:44 batman :D
16:51 coolo batman: the logic of? str is a string object and '00' + str is too - but to call a function on it you have to put it in (). so this is string.[-function with the argument of -2: - which translates to the sequence of end-2 till the end
16:51 coolo so this is gives the final 2 chars - or 00 if the string is empty
16:52 coolo http://paste.opensuse.org/93055730
16:53 coolo but you already found the perl translation
16:54 preaction or if str is one character, you'll get '0'+str
16:55 coolo as batman said: substr "00$str", -2 - but python devs are more eager to go with sequences and lambdas and the like
16:55 preaction this is a huge reason why code should describe what it is doing, not how to do it.
16:55 gatitskiy joined #mojo
16:55 preaction which i swear is python's number 1 rule
16:56 preaction but, it'd probably be more idiomatic python to use format strings
17:03 absolut_todd joined #mojo
17:35 cpan_mojo Mojolicious-Plugin-SizeLimit-0.001 by GRAF https://metacpan.org/release/GRAF/Mojolicious-Plugin-SizeLimit-0.001
17:36 wingfold joined #mojo
17:37 wariat joined #mojo
17:49 asarch joined #mojo
17:55 gatitskiy joined #mojo
18:28 dotandimet joined #mojo
18:52 disputin joined #mojo
18:56 jberger TIL there are over 200 Mojolicious::Plugin:: modules on CPAN
18:56 jberger probably closer to 250
18:58 absolut_todd joined #mojo
19:00 sri 470 reverse dependencies https://metacpan.org/requires/distribution/Mojolicious?sort=[[2,1]]
19:01 jberger I was trying to see if anyone had done the thing that I'm about to release to CPAN yet
19:01 jberger and I wasn't confident in my query, so I read through the entire search of Mojolicious::Plugin::
19:02 jberger and the answer is, I didn't see it
19:02 jberger https://github.com/jberger/Mojolicious-Plugin-ReplyTable
19:02 jberger coming soon ^^
19:05 disputin joined #mojo
19:07 wingfold joined #mojo
19:10 riche joined #mojo
19:25 mattastrophe joined #mojo
19:30 riche jberger: i am thinking Mojo::JWT needs to have the ability to define the exp-iat value
19:31 riche right now I am hardcoding default to 3600, which is the goog default
19:37 KindOne joined #mojo
19:51 riche jberger: nevermind -- I fix it so I set the goog default if ->expires is not set ... which is the right thing to do anyway
19:54 lluad joined #mojo
20:31 Onigiri joined #mojo
20:32 lluad_ joined #mojo
20:35 jberger exp-iat? is that a reserved claim?
20:36 jberger IIRC exp is an absolute time and yes I thought about trying to figure out how to do a delta given the api I'm aiming for, but haven't come up with anything I like yet
20:37 jberger https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.4
20:40 lluad_ joined #mojo
20:47 Grinnz delays++
20:48 Grinnz exception handling via eventemitter is just so nice...
20:49 Grinnz i've adopted a paradigm of "method taking callback and returning delay object for exception handling" for my bot's nonblocking methods, it works rather smoothly
20:55 jberger delays++ indeef
20:55 jberger gah
20:55 jberger indeed
20:55 batman jberger: can you add txt support as well? Using Mojo::Util::tablify()
20:55 jberger batman++ great idea!
20:55 batman jberger: The plugin looks very nice btw :)
20:56 wingfold joined #mojo
20:57 jberger in converting the old site at $work, the $boss keeps telling me "this report used to be excel, but can it be json too" or "this report needs to be csv, but it might be handy to have excel"
20:57 jberger to the point that I just asked, "can they all just be everything?"
20:57 jberger this code is more or less already being used on our internal site, and $boss is a big CPAN fan, so I keep finding things I can ship out there
20:58 DesertFox all the things!
20:58 batman jberger: That's awesome :)
20:58 jberger that's also why it comes with a convenient way to set the default response type
20:59 batman I'm glad I'm allowed to spend so much time on CPAN stuff as well.
21:00 jberger cpan friendly jobs are the best
21:00 batman Or... I'm glad I know how to *take* the time, hehe
21:00 jberger well, there's that too
21:01 batman It's impossible to release in house code to CPAN, but we are allowed (required) to send back fixes.
21:01 jberger Mojo::JWT was me just going to cpan first, I knew we were going to need it and it was going to be a completely isolated part of our codebase, so I just did it straight to cpan instead
21:02 jberger batman: that was a question I asked when I was being interviewed
21:02 batman So whenever I start a new project I want to open source, I take a 15min break to create the got repo and make the initial release that "work" can contribute to ;)
21:02 jberger could I send patches for cpan software we use, $boss said that that is a responsibility
21:02 jberger batman: hahahaha, nice
21:03 batman jberger: It's also a legal responsibility, unless it's BSD...
21:03 batman Or at least a lot of the software require you to out the patch somewhere online.
21:03 batman Software = licenses
21:04 batman got repo = git repo
21:04 preaction you have to give the source to the people you deliver the runnable thing to. you aren't required to notify upstream you did something
21:04 preaction at $work, for example, since it's all internal, we don't have to do shit
21:04 preaction but i use that "start it on github at home" to get around the issue as well
21:05 batman preaction++
21:06 preaction a bit of my work code also starts out as perl mongers talks ;)
21:07 batman Hehe
21:07 Adura joined #mojo
21:08 jberger preaction gave the DBIx::Class talk this month
21:08 jberger preaction: did you see, that plugin is in the works!
21:08 preaction yep! can't wait!
21:10 mattastrophe joined #mojo
21:10 batman jberger: Could you point me in a direction or explain in the POD when JWT is useful?
21:11 batman I tried to explain it to a coworker, but I kept on finding holes in my explanation :/
21:11 batman So I guess I haven't really understood it.
21:11 jberger batman: it is essentially as useful as the typical mojo session storage, except when you need it to be sent between different sites that trust each other
21:11 preaction over an untrusted connection
21:11 riche batman: I will be extending the pod for Mojo::JWT::Google to show the scenarios
21:11 jberger preaction: right
21:12 preaction and i think recent stuff has shown that all Internet connections should be considered untrusted
21:12 riche oh you are looking for 'why jwt' rather than 'where jwt'
21:12 preaction (even, quelle horreur, SSL and TLS connections, despite the encryption)
21:12 jberger preaction: right, though jwt isn't encryption, just signature
21:12 riche to me it's just another token mechanism ... just an easier krb5
21:12 jberger it can be used WITH encryption
21:13 preaction but don't you need the secret to reconstruct the message?
21:13 jberger preaction: no
21:14 jberger just like mojo sessions
21:14 preaction ah
21:14 riche going afk to go back to making lasagna and drinking wine...
21:15 jberger <3 lasagna
21:15 preaction <3 wine
21:15 jberger riche: do you use the no bake noodles?
21:16 riche no ... barely cook them and let them finish to al dente during the bake
21:16 batman jberger: I was thinking I could use it for single sign on... But then I thought: how come the same token can't be used over again later..? But I guess the thing fixing that is the expire timestamp..?
21:17 riche batman - it is oauth2 so yes you are on the right track
21:17 jberger batman: sure
21:17 riche but to me I use it for server to server only... service accounts
21:17 batman riche: oauth2 is _not_ the same thing
21:17 batman jberger: Ok...
21:17 jberger for us, we have silo-ed health data and silo-ed users
21:18 batman riche: oauth2 is not for authentication. Only for authorization.
21:18 jberger and when a user needs to have limited access to a different silo, it will get a jwt from their home silo and present it to the remote silo in order for it to trust the user for that one action
21:18 riche so shit ... that is why you define scopes in the payload
21:19 batman jberger: Cool. I think this will make my life easier :)
21:20 batman And I guess kill M::C::OAuth2 :P
21:20 jberger all actual communication is over ssl, but I need some proof that the user should be authorized to do the action on the remote server
21:21 batman Sweet.
21:22 jberger why kill M::C::OAuth2?
21:23 jberger this is just a message scheme, you still need the OAuth process
21:24 batman jberger: Why?
21:25 jberger because OAuth sevices?
21:25 jberger you might not need it as often though
21:25 batman Who cares? It's super complicated.
21:27 batman Not a big oauth fan :( 20 pages of spec and a 200 pages security appendix..? :(
21:27 batman (Not accurate numbers. Just making a point)
21:28 riche batman, different operations require different schemes. jwt is for server to server, etc.  not for normal web logins and getting claims that way
21:28 batman riche: Why not?
21:28 riche because that is not how industry uses it
21:29 batman riche: I'm not tied to corporate rules.
21:29 riche okay
21:29 gryphon joined #mojo
21:31 riche marcus: your last RT is awesome
21:32 jberger riche: seen "best ever"?
21:33 jberger riche: http://perl.plover.com/obfuscated/
21:33 riche no haven't
21:34 jberger it links to this: Here it is
21:34 jberger oops
21:34 jberger http://perl.plover.com/obfuscated/bestever.pl
21:34 jberger un-effing-believable
21:34 riche i think I just felt like I had a hangover and I just got barely started on the bottle
21:36 jberger do you have ps2pdf installed?
21:36 jberger you can use ps2pdf to emulate a printer
21:36 riche jberger: I am doing more work on getting right the interop with your new method
21:36 riche in so doing, I am making it more mojo-ified
21:36 jberger hahaha, you are SUPPOSED to be cooking lasagna
21:37 riche yeah
21:37 riche but someone tried schooling me on oauth2 so I am not in the mood... delegated to my son
21:38 riche he's 15 and has done it with me for a few years... so it's ok
21:41 theshane joined #mojo
21:45 batman riche: Am I "so
21:45 batman "Someone"?
21:50 riche yes but forget about it.  it is the reason why I never liked irc since the very early days of the inet, stuff just comes across as wrong
21:50 Grinnz jberger, cool plugin! maybe i can get my coworker to use that instead of WriteExcel stuff :)
21:51 jberger Grinnz: its going to be pretty basic, so if you need more than "dump this to excel" you might be better off doing what you already do
21:51 jberger but, if you do want that, then be my guest :-)
21:51 Grinnz well, i'd have to look at what he is doing with it yeah
21:52 Grinnz but usually it is "get this stuff from excel spreadsheet, make a new excel spreadsheet"
21:52 Grinnz also, those mime types, lol
21:53 gatitskiy joined #mojo
21:55 jberger yeah, that xlsx mime type is hilarious
21:55 jberger sooo, it seems that quotemeta mangles unicode?
21:56 jberger I'm trying to test tablify output
22:05 jberger does my use of encode make sense here? https://github.com/jberger/Mojolicious-Plugin-ReplyTable/blob/master/t/basic.t#L64
22:05 jberger the tests pass, I'm just worried if I'm doing it right?
22:09 jberger balls, I'm not 100% sure that that is the correct character
22:09 jberger gods I hate unicode
22:18 mattastrophe joined #mojo
22:18 jberger hmmmm, it seems that I have the character in the code correct (I hope)
22:31 Grinnz jberger, no, quotemeta mangles UTF-8 bytes
22:31 Grinnz whatever you're trying to do here you should probably do with decoded characters
22:31 theshane joined #mojo
22:32 Grinnz like decode the lines from UTF-8 maybe
22:32 Onigiri joined #mojo
22:40 Adura joined #mojo
22:45 wingfold joined #mojo
23:10 Onigiri joined #mojo
23:26 punter joined #mojo
23:46 wingfold joined #mojo
23:50 mattastrophe joined #mojo

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