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

IRC log for #mojo, 2014-10-30

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

All times shown according to UTC.

Time Nick Message
00:01 d4rkie_ joined #mojo
00:04 tbushell joined #mojo
00:05 tbushell left #mojo
00:09 Averna joined #mojo
00:11 axlrose joined #mojo
00:22 good_news_everyon joined #mojo
00:22 good_news_everyon [mojo] kraih tagged v5.56 at 4c1d0b7: http://git.io/89odxQ
00:22 good_news_everyon left #mojo
00:24 good_news_everyon joined #mojo
00:24 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/KNPwvQ
00:24 good_news_everyon mojo/master f03f916 Sebastian Riedel: bump version
00:24 good_news_everyon left #mojo
00:34 good_news_everyon joined #mojo
00:34 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/cW6qgg
00:34 good_news_everyon mojo/master 7d3d069 Sebastian Riedel: better AUTOLOAD examples
00:34 good_news_everyon left #mojo
00:36 good_news_everyon joined #mojo
00:36 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/awnSLA
00:36 good_news_everyon mojo/master 8c79010 Sebastian Riedel: simplify AUTOLOAD example
00:36 good_news_everyon left #mojo
00:46 henq joined #mojo
00:59 marcus joined #mojo
02:37 klapperl joined #mojo
02:54 doublelel joined #mojo
03:13 noganex joined #mojo
03:33 fhelmber_ joined #mojo
03:51 KCL joined #mojo
03:56 Eke- joined #mojo
04:01 basic6_ joined #mojo
04:31 irq joined #mojo
04:37 rem_lex| joined #mojo
04:51 zivester joined #mojo
04:53 mib_7g63xt joined #mojo
04:56 mib_7g63xt Hello eceryone. Just updated to last version of mojolicious on my dev, and construction @list = $self->param('some_list'); does not work for me now. Is there was some changes about that?
04:56 mib_7g63xt everyone*
04:57 preaction mib_7g63xt: yes. it is a security problem to allow that. i think there is a param_list method now
04:58 preaction maybe it's called every_param: http://mojolicio.us/perldoc/Mojo/Parameters#every_param
04:59 preaction https://groups.google.com/forum/#!topic/mojolicious/aJTYjRCPjOE <- here's the thread about the issue
04:59 basic6 joined #mojo
05:00 mib_7g63xt Thanks a lot preaction! I will RTFM before asking next time :)
05:01 preaction eh. it took me a bit to find it. the mojolicious team was being proactive about fixing it, so the internet didn't blow up with massive amounts of buzz about a security hole in mojolicious
05:01 preaction bugzilla got hit, which hopefully put the final nail in the "using wantarray to choose between returning an array or an arrayref" coffin
05:02 * preaction wrote too many APIs that use wantarray like that, and hates every single edgecase he trips on because of it
05:07 mib_7g63xt Strange I've missed that discussion in google groups. looks like i need to check my email often.
05:13 sujithm joined #mojo
05:45 oetiker joined #mojo
06:36 basiliscos joined #mojo
06:38 Guest-quest joined #mojo
06:51 sujithm joined #mojo
06:57 crab joined #mojo
06:57 Eke- joined #mojo
07:13 Vandal joined #mojo
07:21 ver joined #mojo
07:33 fhelmber_ joined #mojo
07:51 dp_ joined #mojo
07:53 doublelel joined #mojo
08:02 dod joined #mojo
08:08 rawler joined #mojo
08:10 basiliscos joined #mojo
08:15 jamesaxl joined #mojo
08:15 amon joined #mojo
08:30 neyasov_ joined #mojo
08:31 trone joined #mojo
08:37 arthas joined #mojo
08:57 fhelmber_ joined #mojo
09:32 irq joined #mojo
09:33 batman it doesn't seem as if the browser is sending the Authorization header if the webpage you're on is using "https" and the link you try to followpoints to "http" in chrome.
09:33 batman any idea if that's the way it has been forever in all browsers?
09:39 neyasov joined #mojo
09:39 Shaeto joined #mojo
10:00 nicomen batman: you mean secure and non-secure sites should exchange data?
10:03 batman i mean it's awesome that they don't, but i'm curious if that's a "new" thing or if browsers have always done it this way
10:05 nicomen aha
10:06 nicomen it might be that browser makers have been better at finding related issues when implementing CORS
10:07 nicomen (I don't know
10:07 nicomen )
10:26 Xyem joined #mojo
10:29 Xyem Just started using Mojolicious an hour or so ago and while it has been simple so far, I can't figure out how to get it to pass HTML given to $c->render through the layout/templates(?) without escaping it
10:29 Xyem Or, indeed, if that is how I should be doing it at all
10:30 Xyem Can someone point me in the general direction of how to do this?
10:34 Xyem It seems whenever I use 'render' with text or data, it skips the templates
10:39 batman Xyem: maybe you want to do %= include "other"; # in your template instead?
10:40 batman I'm pretty sure that you're making a security issue, but to solve you're specific problem, you can do two things:
10:41 batman 1) Mojo::ByteStream->new($html); will not be escaped.
10:41 batman 2) use <%== $html %> (note the double ==)
10:42 Xyem Perhaps I need to explain this a bit more. In my controller, I am converting a text file to HTML using Text::WikiCreole
10:42 Xyem So I only have the HTML in the controller
10:42 batman Right. Then use solution #2
10:42 batman It will not try to replace "evil" characters
10:42 batman (Both solutions work)
10:44 Xyem Excellent, that works
10:44 Xyem And I found it in the documentation too, it just wasn't clear to me that it would do that
10:44 Xyem Thanks very much :)
10:45 batman Xyem: cool!
10:46 Xyem Still amazed how neat it is, even using Mojolicious::Lite
10:48 d4rkie joined #mojo
10:51 Xyem I'm basically making a html viewer for my wiki and I have the bulk of it already in.. 50 lines?
10:51 Xyem Let's just say that is significantly smaller than the first version..
10:52 henq joined #mojo
10:53 Eke|| joined #mojo
10:59 batman Xyem: I hope you have control on the input, so users can't inject embed, script or other crap...
11:00 batman Xyem: glad you like it :) any feedback is appreciated
11:01 Xyem I'm the only user, it's a private wiki
11:02 batman Xyem: https://metacpan.org/pod/distribution/Mojolicious/lib/Mojolicious/Guides/Rendering.pod # might have related information...
11:03 Xyem So far, I am using Leo (edit on desktop), WikiMind (edit on Android), Meld (phone->desktop sync) and now Mojolicious so I can view it in any browser
11:03 Xyem So I can have it on, say, my Kindle too
11:04 Xyem Next up is having a generated navigation bar on the side
11:05 Xyem A static one will do for now though :)
11:07 Xyem It looks like for that, I need a controller that will create a data structure to pass to the template to be converted to HTML
11:07 Xyem So.. I need to run two controllers (one for navigation, one for content)
11:22 tudorconstantin you said that for now, a static side menu would suffice,
11:22 tudorconstantin you could use a partial to include it in your layout
11:23 Xyem Yeah, I'm just thinking ahead
11:29 tudorconstantin there's this MVC pattern, with wich you can build any web app - in MVC you have only one controller action at once, so, whenever we think we might need 2 controller actions, it's a signal that we might not think correctly
11:30 denny joined #mojo
11:31 tudorconstantin if you need the same behavior embedded in multiple actions (like when you want to populate the side menu), you could create a separate library/object to contain the common behavior, and call the methods 'by hand' from there
11:37 tudorconstantin or create an around_action hook and populate there the sidebar menu
11:38 tudorconstantin anyway, I'd go with the static partial embedded in the layout until the app evolves to the point of generating dinamically the sidebar
11:39 tudorconstantin and then, you simply modify the partial which is already included
11:39 Xyem Yeah, I'm familiar with how MVC is supposed to work, it just doesn't jive with my brain at all
11:43 marcus joined #mojo
11:43 Xyem Only having one controller, for example, makes no sense to me, when you multiple elements and some commonality
11:44 bpmedley Let’s say I have a process that takes 30 seconds to run and outputs one line of text every 3 seconds.  How can I run the command and display the output “as it happens”?  I have a solution; however, I’m wondering if there’s a more succinct way to do it.
11:44 Xyem For example, you have a website that always shows a sidebar.. your one and only controller then must have the sidebar in it *and* the logic for doing whatever else
11:45 Xyem Makes more sense to me to have one controller call another (HMVC)
11:55 tudorconstantin it looks like the ruby on rails guys also favor the hook approach: http://stackoverflow.com/questions/18833038/dynamic-menu-sourced-from-db-in-rails
11:56 neilhwatson joined #mojo
11:58 tudorconstantin in catalyst they have the 'forward' method, in which you call another controller action - I think this was made especially for people who really want to call another controller action
11:58 sujithm_ joined #mojo
11:59 Xyem tudorconstantin: So, if I understand correctly, you basically add a controller in before the main controller, which can pass the menu to the main controller?
11:59 Xyem Which can then pass it to whatever template it wants..
12:03 Xyem Oops, that wasn't what I expected
12:03 tudorconstantin ummm...not quite
12:04 tudorconstantin in order for a variable to be accessible in a template, it needs to be set in the stash
12:04 Xyem get '/style.css' => sub { shift -> render; } => 'style';
12:04 Xyem Does not do what I expect (return the contents of "@@ style.html.ep")
12:05 Xyem Oh
12:05 Xyem Now it does
12:05 Xyem Forgot.. rule order matters :)
12:05 tudorconstantin so, you have to set the variable that contains your menu structure for every request
12:05 moritz Xyem: are you aware of the static files mechanism?
12:06 Xyem moritz: Using the 'public' directory?
12:06 moritz Xyem: yes
12:06 Xyem Yup
12:06 moritz of @@ public/style.css  from the __DATA__ section
12:06 moritz s/of/or/
12:06 Xyem Oh.. I'm doing this in a weird way, aren't I? :)
12:07 tudorconstantin you could set that variable in an around_action hook: http://mojolicio.us/perldoc/Mojolicious#around_action
12:07 Xyem tudorconstantin: I'll keep that in mind when I come to that part
12:07 Xyem It makes sense to me
12:10 Xyem moritz: Cheers, that makes much more sense
12:10 Xyem I thought it would be looking up public/ in the directory it is started in, rather than the directory the script was in
12:11 Shaeto joined #mojo
12:12 Kripton joined #mojo
12:16 Shaeto1 joined #mojo
12:21 denis_boyun joined #mojo
12:24 Jonis joined #mojo
12:25 Jonis joined #mojo
12:27 neilhwatson joined #mojo
12:27 Shaeto1 left #mojo
12:28 Jonis_ joined #mojo
12:28 Jonis_ joined #mojo
12:29 Jonis_ joined #mojo
12:39 denis_boyun joined #mojo
12:45 Shaeto joined #mojo
12:57 tbushell_ joined #mojo
12:57 tbushell_ joined #mojo
13:00 doby joined #mojo
13:01 tbushell left #mojo
13:10 D4RK-PH0ENiX joined #mojo
13:10 Xyem Okay, I'm really liking Mojo so far
13:10 Xyem Definitely going to use it on an upcoming project
13:17 marty joined #mojo
13:19 nicomen \o/
13:22 ignacio_ joined #mojo
13:23 D4RK-PH0ENiX joined #mojo
13:47 * sri wonders if the deprecation warnings will be of enough help for people using Mojo::DOM during the next 3 months
13:49 nicomen why not use major numbers to show backwards compatibility breakage?
13:50 sri wat?
13:51 DaTa phew, i guess i never used that autoload thingy :)
13:52 Shaeto1 joined #mojo
13:54 sujithm joined #mojo
14:19 marcus joined #mojo
14:20 disputin joined #mojo
14:22 basiliscos joined #mojo
14:24 Xyem So.. this is going to be a little weird but.. would it be possible for Mojo to make a call to itself and inline the result?
14:25 Xyem e.g. in the template, something like <%= get /nav.html %>
14:28 Xyem Then I could have Mojo generate the navigation bit independently, get caching etc.
14:28 Xyem But also makes it easy for me to have a #no-nav thing which doesn't fetch it
14:29 batman i think you're trying to optimize in reverse
14:29 batman just put make "nav.html.ep" and do <%= include "nav" %>
14:29 Xyem I'm looking at making it dynamic now
14:30 batman and add a helper which creates the content required in nav.html.ep
14:30 Xyem Oh?
14:30 * Xyem slides over to the helper docs
14:36 disputin joined #mojo
14:38 Xyem batman: Am I right in understanding that the helper can only return text to the template that calls it?
14:38 batman no. a helper can return anything. it's just a method.
14:39 batman you can call the helper as <% my_helper() %> or $c->my_helper from anywhere in your code
14:39 Xyem So I can put stuff into a structure for the template to format?
14:39 batman yes
14:39 Xyem Awesome
14:39 batman like:
14:39 batman % for my $item (menu_items()) {
14:40 batman and $item can be a hash or whatever.
14:40 batman you decide :)
14:46 Xyem Oh!
14:46 Xyem <% perl code %> is a thing
14:52 zackiv31 joined #mojo
14:53 Xyem batman: I now have an ugly, but working, dynamic menu.. and I still haven't gone over 100 lines!
14:54 Xyem Thanks for your guidance
15:02 henq joined #mojo
15:10 ignacio_ joined #mojo
15:18 ignacio_ joined #mojo
15:20 neilhwatson joined #mojo
15:23 sh4 joined #mojo
15:27 henq joined #mojo
15:28 Xyem I *really* like this
15:29 Xyem Just added a link to disable the navigation area.. easypeasy
15:30 Xyem Enabling it again is a bit.. bleh, as it leaves the param in (sets it to 0)
15:30 Xyem But that's alright
15:30 Xyem Oh
15:30 Xyem Setting it to undef removes it
15:30 Xyem Perfect!
15:40 hernan joined #mojo
15:45 doublelel joined #mojo
15:45 ceej__ joined #mojo
15:52 panzana` joined #mojo
15:53 davido_ joined #mojo
15:54 arthas_ joined #mojo
15:57 basic6_ joined #mojo
16:01 rem_lex|pivo joined #mojo
16:18 Shaeto joined #mojo
16:32 neilhwatson joined #mojo
16:32 Xyem I wonder if it is possible to use Mojolicious as a frontend to another website..
16:35 Jonis In what way?
16:41 Xyem I'm thinking something where I can make a request to Mojo like.. frontend.org/forum/xyz/abc?page=1
16:41 Xyem ANd it will convert that to a request to the backend site, parse the information out of it and then return it in a nicer, customised format
16:41 Xyem Basically, allowing me to redesign the other site :)
16:42 Xyem Say for example, I don't like the limit on the number of posts per page
16:43 Xyem If I tell Mojo I want 75, but the maximum is 25, it will make the 3 requests and return it as one page to me
16:43 sri that's literally what our frontpage example does, with websockets
16:44 sri (sooo... to sum it up, our little frontpage example is a super advanced version of what you want)
16:45 Xyem Wait.. you mean the "Duct tape for the HTML5 web" thing?
16:46 sri http://mojolicio.us/perldoc/Mojolicious/Lite#User-agent
16:47 sri a less advanced example
16:48 Xyem Mojo will let me completely redesign a site I hate using :| I.. I.. don't even know what to say to that
16:49 Xyem Aside from maybe: Damn myself for not finding it earlier!
17:04 basiliscos joined #mojo
17:09 panzana` joined #mojo
17:22 Kripton joined #mojo
17:26 tempire joined #mojo
17:27 tempire_ joined #mojo
17:28 tempire Bender: trust tempire_
17:28 Bender OK, tempire
17:42 hasan joined #mojo
17:43 hasan hi all. can anybody explain why this does work please? http://nopaste.info/5dd5e2e837.html
17:43 Ptolemarch joined #mojo
17:43 hasan [Thu Oct 30 18:40:16 2014] [error] I/O Error Connection reset by peer at /home/hasan/Documents/devel/perl/projects/mojolicious/neo/script/../lib/Neo.pm line 77.
17:44 hasan respectively: Can't locate object method "get_value" via package "Net::LDAP::Entry=HASH(0x4903450)" (perhaps you forgot to load "Net::LDAP::Entry=HASH(0x4903450)"?) at /home/hasan/Documents/devel/perl/projects/mojolicious/neo/script/../lib/Neo.pm line 51
17:44 sri STOP!
17:44 hasan and line 51 is line 29 in nopaste
17:44 hasan ?
17:44 sri please don't paste into the channel
17:44 hasan oh ok
17:46 hasan so any hints?
17:48 Shaeto perhaps you forgot to load "Net::LDAP::Entry" ? :)
17:49 nicomen it might look like you are passing $user as a string?
17:49 nicomen ie. somewhere it has been stringified before sending it to the helper?
17:49 Xyem Pretty sure that it is being stringified
17:49 nicomen how does the load_user call look like?
17:50 hasan when I print Dumper $uid. I get a string with my name in it
17:50 hasan so get_value must work therefor.
17:50 dod joined #mojo
17:50 hasan on line 29
17:50 nicomen except the error message says it doesn't work?
17:50 hasan nicomen: yes.
17:50 nicomen but, the error is probably wherever you call load_user
17:50 nicomen so
17:50 nicomen how does the load_user call look like?
17:51 hasan I don't call the load_user method. it is the plugin doing it for me
17:51 nicomen oooh
17:51 hasan how can I see how it looks like?
17:52 hasan well I could look at the code of the module. why is the $user passed to load_user gets stringified?
17:52 hasan what would be the reason behind this?
17:52 nicomen you can run the server with PERL5OPT=-MCarp::Always and hopefully get a stacktrace
17:52 nicomen (need to make sure Carp::Always is installed)
17:53 hasan ok
17:53 Xyem I htink it is this bit
17:53 Xyem if (my $uid = $c->session($session_key)) {
17:53 Xyem my $user = $load_user_cb->($c, $uid);
17:54 Xyem Doesn't 'session' stringify everything?
17:54 nicomen wouldn't think so
17:54 nicomen or maybe yes
17:55 hasan from the docs of Mojolicious::Plugin::Authentication "Do not return hashrefs, arrayrefs or objects, since the behaviour of this plugin could get a little bit on the odd side of weird if you do that."
17:55 hasan :/
17:55 Xyem I would have thought so because it ends up in the cookies, right?
17:55 nicomen right, I would hope the actual data was stored somewhere, and the cookies only contained a reference to it
17:55 nicomen but I guess it's a very simple session solution
17:56 hasan what is your recommendation regarding authentications/session handling?
17:56 hasan mabye I could switch to another module. or hand made bridges.
17:57 Xyem Only started using Mojolicious a few hours ago, so I can't help there.. sorry
17:57 nicomen make sure only the uid is stored in the session, not the user-object?
17:58 hasan nicomen: yes. I changed it now and it works.
17:58 hasan the valiadate_user method has to return a string
18:00 edestler joined #mojo
18:27 franzkafka Hi all, I am this close to being done with what I am working on. I am looping over some children, each which looks roughly like this: <p><b>Psychology</b><br>  Psychology, General B<br> Therapy C A M<br></p>
18:28 franzkafka I can get the field of study (in this case psychology) with $_->at('b')->text; however, how do I get each field before <br>?
18:29 franzkafka I get them with $_->text, but what I end up with is something like this: $VAR1 = 'Criminal Justice/Law Enforcement Administration B Forensic Science and Technology B';
18:30 franzkafka i.e., a long string containing all <br>'s space delimited. I want to grab each element.
18:30 franzkafka So 'Criminal Justice/Law Enforcement Administration B' is an element, and 'Forensic Science and Technology B' is another.
18:41 davido__ joined #mojo
18:48 franzkafka my god my script should be include in Mojo documentation as a bad example of how to never solve anything ever
18:48 franzkafka haha
18:48 franzkafka Under the 'Total Shit' heading.
18:49 Ptolemarch joined #mojo
19:06 cfedde we don't learn anything if we don't make mistakes
19:22 franzkafka cfedde, when I am done I am going to share this mistake with #mojo, and you will see that I have learned nothing :D
19:23 franzkafka Actually, not completely true. I am not using regexes anymore... so there is *some* progress.
19:24 tempire Ugh
19:24 tempire All of the ec2 modules use LWP
19:24 tempire WHY
19:25 * tempire rants
19:25 tempire LWP is the devil
19:25 * tempire ends rant
19:26 sri i think the HTTPS bugs in LWP have mostly been fixed now
19:26 tempire I hate LWP for 2 reasons
19:26 tempire 1) The api is ugly
19:27 tempire 2) No out-of-band monitoring
19:27 tempire I can deal with a lot of things if something is pretty.
19:27 tempire But #2 is so frustrating
19:28 sri true
19:29 mst it's on github. the problem is (a) finding people with tuits (b) figuring out how to not break the billion lines of darkpan code that depend on it
19:33 * sri almost got a heart attack the first time he looked into LWP
19:34 sri while i couldn't salvage much for Mojo::*, i still managed to fix some nasty bugs in LWP along the way :)
19:34 mst sri: you (indirectly) made me read the NEXT internals
19:34 mst few things scared me after that
19:34 sri haha
19:35 sri i remember when we all thought multiple inheritance might be a good idea
19:35 mst works fine with C3, tbh, it just confuses people too much
19:35 sri of course roles were not a thing yer
19:35 sri s/r/t/
19:36 mst I mostly regard roles as 'an intentionally castrated MI, in the same sense that UNIX was a castrated MULTICS'
19:47 Eke- joined #mojo
19:54 jamesaxl joined #mojo
19:54 Ptolemarch joined #mojo
19:59 ignacio__ joined #mojo
20:01 Eke- joined #mojo
20:21 disputin joined #mojo
20:34 ignacio_ joined #mojo
20:38 fhelmber_ joined #mojo
20:58 Ptolemarch joined #mojo
21:16 tbushell joined #mojo
21:31 irq joined #mojo
21:38 tempire huh
21:38 * tempire doesn't know anything about tor
21:39 tempire I think I need a bridge ip
21:49 marcus Tor is the god of Thunder, tempire. Now you know something.
21:52 tempire That helps.
21:52 tempire Has anyone used tor with mojo::useragent?
22:04 mst tempire: have you seen the CLI program torify?
22:08 sri mst: not necessary, we support SOCKS natively
22:09 mst sri: sure. but, equally, torify may involve less effort
22:10 sri it's literally as easy as "brew install tor; tor; HTTP_PROXY=socks://127.0.0.1:9050 perl -Mojo -E '...'"
22:10 kablamo joined #mojo
22:18 * sri hopes he never has to deal with a security issue like this https://www.drupal.org/PSA-2014-003
22:18 kablamo joined #mojo
22:20 sri tempire: see instructions above
22:21 sri important thing to know is that tor is just a fancy SOCKS5 proxy on the outside
22:24 mst I love that some attackers patched the hole on the way
22:27 jzawodn Dear Drupal Users: ur owned.  all of you.
22:28 sri wow, this ad is amazing... press 'R' every now and then while watching it! https://www.youtube.com/user/HondaVideo
22:28 sri must be the first time i watched a whole ad on youtube
22:32 hernan great ad
22:33 sri dat cinematography
22:58 bvierra joined #mojo
23:20 zackiv31 joined #mojo
23:35 bpmedley Let’s say I have a process that takes 30 seconds to run and outputs one line of text every 3 seconds.  How can I run the command and display the output “as it happens”?  I have a solution; however, I’m wondering if there’s a more succinct way to do it.
23:50 marmez joined #mojo
23:50 jberger bpmedley: this is an external command you are running?
23:50 bpmedley Yes
23:51 jberger https://metacpan.org/pod/Capture::Tiny#tee
23:51 jberger bpmedley: ^^
23:52 bpmedley Hrmm.  I’m not sure how that will help.  My understanding is that for every new line of output I’ll need to do a $c->write_chunk so the user agent will get the output as it happens.
23:54 bpmedley Oh, I was ambiguous when I said “display the output”.
23:55 bpmedley I’d like to run the command in a “get” route and send the output to the browser as it happens.
23:56 d4rkie_ joined #mojo
23:59 bpmedley jberger: Would you like ot see what I have now as a specific example?
23:59 jberger oh
23:59 jberger no I get it

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