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

IRC log for #mojo, 2015-05-31

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

All times shown according to UTC.

Time Nick Message
00:27 schetchik joined #mojo
00:49 csson joined #mojo
01:28 schetchik joined #mojo
01:31 crab hi.
01:39 klapperl joined #mojo
01:48 disputin joined #mojo
02:13 jberger crab: o/
02:23 schetchik joined #mojo
02:42 noganex joined #mojo
03:20 schetchik joined #mojo
03:29 basic6_ joined #mojo
04:18 schetchik joined #mojo
04:32 zivester joined #mojo
05:18 schetchik joined #mojo
05:25 kaare joined #mojo
05:33 bin_005 joined #mojo
05:56 cpan_mojo Mojo-IRC-0.21 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/Mojo-IRC-0.21
06:14 schetchik joined #mojo
06:16 batman jberger: i think your Test::Mojo::WithRoles api is very strange. i don't understand why you change the global package instead of just making an object with the new methods.
06:17 batman i would do something like this: use Test::Mojo::WithRoles; Test::Mojo->$new_with_roles("MyApp", "Cool::Role");
06:19 mst he actually doesn't
06:20 batman mst: because of unimport?
06:20 mst because the hint stuff he uses is lexical
06:21 batman mst: ok. so bad use of wording from my side.
06:21 mst I mean ... if you don't want the sugar you can do
06:22 mst Moo::Role->create_class_with_roles('Test::Mojo', 'MyApp', 'Cool::Role')->new(...)
06:22 batman sure
06:35 bin_005 joined #mojo
06:54 mattastrophe joined #mojo
07:01 batman mst, pink_mist, marcus: updated https://github.com/jhthorsen/mojo-irc/pull/23/files
07:02 batman also tried to document _write_and_wait() https://github.com/jhthorsen/mojo-irc/pull/23/files#diff-985d80627b18f277fc14be7c75c2052cR358
07:02 batman and add op_timeout() attribute
07:12 schetchik joined #mojo
07:14 marcus Will the real slim shady please stand up?
07:16 marcus lgtm, batman. Much cleaner as a subclass :)
07:16 batman marcus: cool :)
07:17 marcus re already joined, maybe you could whois yourself, and make it an instant error?
07:20 batman why error?
07:21 batman like $err = "Already joined." ?
07:21 batman i'm shipping this now, just to get it out... can still do improvements :)
07:22 trone joined #mojo
07:22 batman marcus: https://github.com/jhthorsen/mojo-irc/blob/master/Changes#L13 <--- really happy about that change :)
07:23 cpan_mojo Mojo-IRC-0.22 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/Mojo-IRC-0.22
07:42 marcus yeah, that's great.
07:44 batman :)
07:49 ToApolytoXaos joined #mojo
07:55 mattastrophe joined #mojo
08:08 schetchik joined #mojo
08:12 berov joined #mojo
08:17 dod joined #mojo
08:20 Vandal joined #mojo
08:22 dod joined #mojo
08:24 anufant joined #mojo
08:40 schetchik joined #mojo
08:55 schetchik joined #mojo
08:56 mattastrophe joined #mojo
09:00 bin_005 joined #mojo
09:05 amon joined #mojo
09:12 anufant joined #mojo
09:14 bin_005 joined #mojo
09:45 schetchik joined #mojo
10:48 schetchik joined #mojo
11:14 sh4 joined #mojo
11:17 schetchik joined #mojo
11:18 schetchik joined #mojo
11:20 schetchik joined #mojo
11:23 schetchik joined #mojo
11:25 schetchik joined #mojo
11:30 schetchik joined #mojo
11:32 schetchik joined #mojo
11:35 schetchik joined #mojo
11:35 kyshtynbai joined #mojo
11:37 schetchik joined #mojo
11:38 kyshtynbai Guys, can I store complex data structures in sessions?
11:39 anufant joined #mojo
11:45 batman yes. it's encoded as json
11:58 berov kyshtynbai:  up to 4kb
11:58 berov if you use the default session
11:58 berov I mean the default session storage
11:59 Adura Is it time to link my plugin...?!
12:01 berov Adura: which plugin :)?
12:01 Adura https://metacpan.org/pod/Mojolicious::Plugin::SessionCompress !
12:04 berov Adura: this is interesting approach IMHO :). How much is the upper limit which you can compress to fit in 4kb?
12:04 Adura Depends on what you're compressing, honestly.
12:05 Adura Or, what compression you choose to use...
12:05 berov Still I gave up throwing 4
12:05 berov usp sorry
12:06 berov Adura: I do not know. offer the best  as default :)!
12:06 Adura Naw, the default is fast and memory conservative.
12:06 berov like a configuration option may be and require the needed module with a fallback or something
12:07 Adura You can use your own compression subs.
12:07 bpmedley joined #mojo
12:08 berov at some point I gave up transferring with every request the session cookie. Also I wanted to store secret things in the session so now i trensfer only the session ID
12:08 Adura It's one way of doing it.
12:08 berov and keep arecord in the database
12:09 berov now transferring only the session ID in the cookie I mean.
12:10 Adura With the signed cookies, you could skip hitting the DB up every request.
12:10 berov but everybody can decode BASE64 and see what is in there
12:11 Adura Yeah... it's signed, not encrypted.
12:11 berov yeah
12:11 Adura I don't care if they know their privileges.
12:13 berov kyshtynbai: So I would store onlu not secret info in session although complex structure and if I need more I will keep another storage around in the database only
12:15 berov If I have a user which tries to exploit some weakness, It is better to not let them know too much. after all this is the best security
12:15 Adura Security through obscurity? You don't seem to understand the value of signed cookies...
12:17 berov Adura: No, please explain what is the value - only that I know theat the cookie can not be modified?
12:18 Adura It's a means of maintaining state that doesn't require a DB lookup.
12:18 berov Adura: is there anything else?
12:20 Adura Well, what else should a cookie do?
12:21 berov ok, in a complex application usually the state of a user is quite complex
12:21 Adura I guess it could be... Certainly a reason to use my plugin.
12:22 berov so if I transfer only minimal data is better than throwing around more data on every request
12:22 berov Adura: ok,agree
12:23 Adura It depends on what efficiencies a developer is prioritizing.
12:23 berov I only mean the least - the better
12:27 jberger batman it may seem a little strange, but as mst said, it's just sugar
12:27 mst I tend to like keeping just the user id in the session, and as much of the rest of the state as possible in the client via javascript
12:27 mst if I'm already into app-ish land
12:27 mst may as well
12:29 Adura I have nothing to benchmark my DB hit avoidance idea on, though.
12:30 berov mst: I do this in Ado and specifically in https://github.com/kberov/Ado-Plugin-Vest (my turn to share what I do :P )
12:30 mst Adura: mostly, from my POV, if I don't stick it in the db, I don't have to figure out when to expire it :)
12:31 berov mst: POV?
12:31 purl i think POV is Point of View
12:31 berov ook
12:32 Adura As for how big the cookie'd be... user id and a bitfield for privileges, it's really not that much berov.
12:32 berov Adura: yes: ok
12:34 Adura I do have an idea that Mojo would help me put into action, but users aren't required, hah.
12:34 berov Adura:  which leads to the conclusion you would rarely hit the 4kb limit (not undervaluing your work of course)
12:36 Adura You can save bytes on cookies under 4k too. :P
12:37 berov sure
13:10 batman jberger: Ok
13:52 zivester joined #mojo
14:04 asarch joined #mojo
14:13 D4RK-PH0ENiX joined #mojo
14:20 kyshtynbai thanks everyone/
14:25 mattastrophe joined #mojo
14:28 asarch joined #mojo
14:29 sh4 joined #mojo
14:55 lluad joined #mojo
14:58 nicomen joined #mojo
15:23 bpmedley_ joined #mojo
15:26 gryphon joined #mojo
15:31 kaare joined #mojo
15:47 dod joined #mojo
15:48 Grinnz batman, Mojo::IRC::UA looks interesting, and i like it as a subclass
15:49 batman Grinnz: thanks :)
15:49 Grinnz i'm not sure about the whois one though. there are just tons of different events returned from whois depending what server
15:49 Grinnz i have subclasses for my bot's network module that almost entirely deal with that
15:49 batman i would really like if someone started using it. maybe things are acting differently then what i've considered :/
15:49 batman what's wrong with whois() ?
15:53 Grinnz i'm just trying to think if there's a way it could be configured to handle different sets of events
15:54 batman i'm not sure if i follow... Mojo::IRC::UA->whois() do look for more events.
15:54 Grinnz for example... on one server i get a irc_335 and irc_330 for "bot" and "identity", on another server i get irc_rpl_whoisaccount
15:55 batman aha! are those custom extensions?
15:55 Grinnz sometimes yeah
15:55 Grinnz this isnt something you can generically cover really
15:56 batman Grinnz: would it help you if _write_and_wait() was public? https://github.com/jhthorsen/mojo-irc/blob/master/lib/Mojo/IRC/UA.pm#L312
15:56 Grinnz i'm not sure
15:56 batman if i could: help me make a public api for it :)
15:56 batman i'm not sure how it should look yet...
15:57 batman *if it
15:57 pink_mist it shouldn't be hard to cover it
15:57 batman pink_mist: what is "it" ?
15:57 pink_mist anything you get between the first whois rpl, and the whois END is part of the whois data
15:58 Grinnz it's not that simple...
15:58 pink_mist yes it is
15:58 batman :)
15:58 batman Grinnz: please make sure you understand _write_and_wait() before you make any hard conclusion
16:01 batman or even better: let me know if _write_and_wait() could be written a better way ;)
16:02 kiwi-guy joined #mojo
16:12 jberger marcus: would you accept a patch to Mojolicious::Plugin::MountPSGI to add a Test::Mojo::Role::PSGI to it
16:12 jberger I could do it in another dist of course, but I see this as being related functionality
16:12 jberger marcusr: same question :-P
16:17 PryMar56 joined #mojo
16:27 batman jberger: marcus is not around atm. maybe later...
16:29 Grinnz pink_mist, the reason i say it's not that simple, is that yes you could get all the relevant events, but then how do you parse them without knowing what $custom_event is even supposed to represent about that user?
16:30 batman Grinnz: that's how _write_and_wait() works: if some events are missing before the final event, they are simply ignored
16:31 batman and you have to provide a default, if you want anything.
16:31 batman Grinnz: so if i add support for irc_335 and irc_330, Mojo::IRC::UA would still work for standard irc servers
16:32 batman (that doesn't emit irc_335)
16:32 Grinnz batman, sure, but i think there are too many edge cases to just keep adding to that main function
16:32 Grinnz i dunno
16:33 batman could be. i've already added support for irc_479, which i can't seem to find any documentation for :P
16:34 pink_mist Grinnz: you'd just use the default event parser, basically just splitting it up in event number and message; if you don't have a custom handler for it, that's just good enough. most of the non-standard things will just have a plaintext message anyway that is not suitable for parsing anyway.
16:34 batman i would add anything that is useful for a public irc server. if you're behind closed doors, it's your problem :)
16:34 * pink_mist overused the word 'anyway'
16:34 Grinnz batman, these are public servers
16:34 Grinnz they can still add whatever custom extensions they feel like
16:35 batman sure. then please submit a patch for Mojo::IRC::UA, and document which server support the feature, and why it should be added.
16:35 batman (if you want)
16:35 batman i'll probably take it, if it's nicely documented and just not too specific :)
16:41 schetchik joined #mojo
16:45 mattastrophe joined #mojo
17:59 marcus jberger: Yes
18:15 punter joined #mojo
18:20 Grinnz_ joined #mojo
18:20 Repaster joined #mojo
18:56 mattastrophe joined #mojo
19:38 bin_005 joined #mojo
19:56 bin_005 joined #mojo
21:04 bin_005 joined #mojo
21:05 sh4 joined #mojo
21:06 sh4 joined #mojo
21:07 nicomen joined #mojo
21:16 bin_005 joined #mojo
21:23 bin_005 joined #mojo
21:27 jberger failing tests on LWP::Protocol::https makes me wish everything used Mojo::UserAgent
21:37 Adura Tell that to cpanm.
21:45 damaya_ joined #mojo
21:45 damaya_ joined #mojo
21:45 damaya_ Is there any way to render to an anchor on a page?
21:46 damaya_ I have a single page with login/registration forms, and I want /login to go to #login (tab), and /register to go to #register (tab).
21:46 damaya_ :D
21:46 jberger marcus: on second thought, you don't probably want the dependence on Role::Tiny
21:46 jberger I can just make another dist
21:47 jberger damaya_: huunh?
21:47 pink_mist damaya_: the #fragment part is only for the browser; so the only code you can create that can deal with that is in JS
21:48 damaya_ ok, that's what I figured. I guess I can check the req url in js and load the proper anchor based on URI.
21:48 damaya_ it didn't seem possible to do in Mojolicious, guess my intuition was right :D
21:48 damaya_ thanks pink_mist
21:48 pink_mist np
21:48 damaya_ Hey jberger, are you in physics or biology?
21:48 jberger damaya_: do each of these uris map to the same page?
21:48 jberger physics
21:49 damaya_ Yeah, they map to the same page, just different anchors
21:49 jberger but when you load the page ... its just a strange thing I guess
21:49 damaya_ I have a login/register page combined, tabbed login/register forms. /login and /register render the same page, but it to go to the correct tab (form).
21:49 jberger why not just do /#register or /#login
21:50 damaya_ yeah, I may just seperate them.
21:50 damaya_ wait, I think I got you.
21:50 damaya_ jberger: Do you use Perl in physics?
21:51 jberger I did, back when I did more physics than I do now
21:51 damaya_ :P
21:51 damaya_ Trying to convince my wife (a biologist) to learn Perl (because that'd be awesome).
21:51 jberger damaya_: https://metacpan.org/pod/Physics::UEMColumn
21:51 jberger https://metacpan.org/pod/Physics::RayTransfer
21:51 damaya_ Not sure how Perl is used in biology though, figured I'd ask you because I thought you were a biologist.
21:51 jberger its used in DNA analysis all the time
21:52 jberger see the BioPerl project
21:52 damaya_ haha, I have zero idea what RayTransfer is all about. Sounds cool though!
21:52 jberger http://korflab.ucdavis.edu/unix_and_Perl/
21:52 jberger ^^ that is what you are looking for
21:53 damaya_ Awesome! I am sending that to her now. Thanks jberger!
21:55 jberger oh man, I forgot that ::RayTransfer still depends on MX::D
21:55 jberger don't tell mst
22:15 mattastrophe joined #mojo
22:23 lluad joined #mojo
22:24 asarch joined #mojo
22:39 Grinnz haha
22:43 damaya_ jberger, I have a question for you. In Galileo you do $page->delete in Admin.pm to delete a page. However, I don't see a delete helper, command, or anything else in the code. What is the delete method from?
22:44 damaya_ Ah, sorry, got it. I just realized $page is a DBIx::Class resultset, so you're deleting it that way.
22:44 jberger yeah
22:45 damaya_ I'm using Mojo::Pg now, so my mind is not really in the DBIx::Class mode.
22:50 damaya_ To check the success of a delete with Mojo::Pg, can I simply do 'my $result = $db->query('delete ...'); if ($result) { } ?
22:50 Grinnz it depends what postgres and DBI::Pg return on a delete, i think
22:51 Grinnz for mysql you could check that the returned value is >0, as it returns the number of rows affected
22:51 damaya_ Yeah, I know how to check on insert/select, but not on delete. I will need to test, unfortunately I don't have access to add anything to this empty database that I am working with, so I will just set up postgresql locally to check.
22:51 damaya_ Oh yeah! There's the rows method on Mojo::Pg::Results, I could probably check that.
22:53 ajr_ joined #mojo
22:53 Grinnz it doesn't return rows. it returns the number of rows
22:54 Grinnz i'm not sure if DBD::Pg does the same
22:55 damaya_ yeah, number of rows affected
22:56 damaya_ So, if 0 rows were affected, then it didn't work out. I guess I could wrap in try/catch to actually catch the error.
22:59 frederico joined #mojo
23:03 guru joined #mojo
23:04 nicomen joined #mojo
23:16 mattastrophe joined #mojo
23:25 sri when you're looking for Mojo::Pg tricks, Minion::Backend::Pg is usually a good place to look
23:26 sri https://github.com/kraih/minion/blob/master/lib/Minion/Backend/Pg.pm#L93-L97
23:39 guru joined #mojo
23:55 mattastrophe joined #mojo

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