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

IRC log for #mojo, 2016-05-07

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

All times shown according to UTC.

Time Nick Message
00:14 frogz joined #mojo
00:20 janus joined #mojo
00:29 asarch joined #mojo
00:32 meshl joined #mojo
01:04 punter joined #mojo
02:04 frogz joined #mojo
02:15 noganex joined #mojo
03:18 frogz joined #mojo
03:24 inbioz joined #mojo
03:36 inbioz joined #mojo
03:59 frogz joined #mojo
04:00 inbioz joined #mojo
04:22 frogz joined #mojo
04:42 kaare joined #mojo
04:47 sri genio: finally got around to setting up windows 10 on the macbook, worked flawlessly \o/
04:47 Adura Most people don't willingly install Win10, heh.
04:48 sri i might even uninstall it again for now, but the important thing is that the macbook now has a digital entitlement thingy and windows can be reinstalled without a key at any time :)
04:49 sri gotta say, there's a lot of things in windows that annoyed the hell out of me
04:49 sri how can anyone handle the 3 lines a t a time scrolling? :S
04:49 Adura See if you can get FUSE working in Win10.
04:50 Adura (you can change that setting)
04:50 sri but can you make it not line based?
04:50 Adura I uh... don't know on 10.
04:50 sri jumpy scrolling is the worst!
04:51 * sri hugs os x
04:51 Adura There's screen-based scrolling, I know FF has various smooth scrolling settings.
05:12 sri hehe, looks like my timing is perfect https://blogs.windows.com/windowsexperience/2016/05/05/windows-10-now-on-300-million-active-devices-free-upgrade-offer-to-end-soon/
05:18 sri guess i could try a few games on windows :)
05:18 sri apparently skyrim runs great
05:19 sri not that i have any windows games on steam yet :/
05:20 Adura I guess the only real reason to have Win10 is DX12...
05:22 Adura I'd rather new games use Vulkan.
05:29 sri wow, apparently this thing can handle gta 5, hope there's a steam sale soon :)
06:56 reneeb joined #mojo
07:54 dod joined #mojo
07:59 dod joined #mojo
08:06 henq joined #mojo
08:25 Vandal joined #mojo
08:45 punter How can I get the method name of the controller that is running?
08:58 batman punter: why do you need that?
08:59 punter The layout has a "login" link on the top-right. I want to hide it if I'm already on the login page
08:59 batman that doesn't sound right. you should rather give it an "active" class
09:00 punter batman: a css class? I want to make it not clickable, or make it go away
09:00 batman right. i'm not going to help you with that, since i consider it bad ux
09:00 punter :-)
09:00 punter So you suggest that the login page should contain a login link?
09:00 batman anyway: the solution to all of these cases are: use the stash()
09:01 punter Ah
09:01 batman yeah, have you ever seen a menu item disappear when you click on it?
09:02 batman at least in 99.99999% of the cases it just changes styling to indicate that the item is active
09:02 batman you can make it non-clickable, but it's very confusing (unless you add some other feedback)
09:03 batman punter: $routes->get("/login")->to(login_page_visible => 1); and then <% if (stash "login_page_visible") { %> ...
09:03 batman or you could also use stash "action" or some helper around $c->req->url
09:04 batman probably want to turn login_page_visible around into (active_page => "login") and then do $app->defaults(active_page => "");
09:04 punter thanks
09:05 batman hope some of that made sense :)
09:05 punter that was interesting
09:05 batman i think it's very useful to know that you can set default stash() variables in $app->defaults(), the route object and of course $c->stash()
09:06 batman just remember that complex data structures in $app->defaults() will be shared, so only modify "plain" strings/numbers/...
09:07 batman hm... that ^^^ might be a bit confusing...
09:07 batman nevermind for now :)
09:08 pink_mist I agree with batman completely -- making the active page unclickable is bad interface imo
09:11 henq joined #mojo
09:21 punter The problem is that the login link takes you to /login?from=<referer>
09:21 punter so if you click on login while on login, the url becomes /login?from=/login?from=referer
09:21 punter and so on indefinitely
09:21 punter search engines crawlers will drive me to oblivion
09:22 punter Easily solvable though
09:22 punter Ok, I'll re-instate the login link
09:22 punter thanks all
09:30 Vandal joined #mojo
10:00 dod joined #mojo
10:14 stephan48 punter: give it a rel="no-follow"?
10:15 stephan48 nofollow*
10:15 punter ok
10:23 inbioz joined #mojo
11:16 punter What's a good way to prevent cross-domain POST requests that didn't happen with JavaScript?
11:17 punter I think inside "around_action", I should check whether the request method is POST, and if it is, then check the Referer's hostname
11:17 punter do you agree?
11:19 punter People who have their Referer hidden will have a problem, though.
11:19 henq joined #mojo
11:20 punter They shouldn't have hidden it, though, should they?
11:23 batman punter: https://metacpan.org/pod/distribution/Mojolicious/lib/Mojolicious/Guides/Rendering.pod#Cross-site-request-forgery
11:25 punter thanks
11:27 punter Is this somehow tied with the built-in sessions of Mojolicious, or will it work with my custom Authentication mechanism?
11:27 punter I bet it' ok
11:28 dod joined #mojo
12:09 trwww joined #mojo
12:09 punter I need to find a trick to help me with something...
12:11 punter I have a lot of forms on my site, and each is associated with a formname_get route method and a formname_post route method. What I want to do is, if formname_post finds the form data to contain errors, to re-draw the form_get page with an error message on the page and the fields filled-in with the user's values.
12:12 bpmedley punter: Have you seen the flash?
12:12 punter Without violating the DRY principle (I.e. without re-implementing all the bits of form_get inside form_post)
12:12 punter oh no, what's that?
12:12 punter and how could it be of use?
12:12 jberger punter: that exact thing is built into mojo
12:13 jberger And also there is html 5 validation in the front end too
12:13 punter Oh
12:13 bpmedley punter: http://mojolicious.org/perldoc/Mojolicious/Controller#flash <-- You could flash an error message in the POST and redirect back to the GET.
12:13 punter jberger: how is it built into? any pointers, please?
12:13 punter thanks
12:13 jberger http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Form-validation
12:14 punter bpmedley: but what about the fields that I want filledin?
12:14 punter ok
12:14 bpmedley jberger: Is punter processing the form in one route and displaying the form in a different route?
12:15 punter bpmedley: That's what I do, yes
12:15 bpmedley punter: Hrmm.  Could you flash all the form variables?
12:16 punter maybe, i don't know
12:16 bpmedley punter: Also, if you had sessions tied to a datastore, then you could stuff the form data into that.
12:16 bpmedley I'd try the flash 1st.
12:17 punter bpmedley: is jberger's form validation of mojo, not good for my case?
12:17 bpmedley punter: I think the validation of mojo is perfectly suitable.  Just that you need to transfer data back to the GET route.
12:17 pink_mist I thought using the flash was frowned upon
12:18 bpmedley pink_mist: May I ask what is better?
12:18 jberger bpmedley: if you follow the pattern you don't need to transfer data
12:18 pink_mist couldn't say, but if jberger is suggesting something else, I'd try that first
12:19 jberger And the flash is handy at times, but it does have its limitations
12:20 bpmedley jberger: Does that pattern work with POSTing a form?
12:22 punter Couldn't I also just call $self->form_get from insde $self->form_post ?
12:23 punter wouldn't that redraw the form and execute all the pre-processing needed?
12:23 bpmedley punter: Probably would work; however, that might create a code smell..
12:24 pink_mist can't you just render the form template again?
12:25 punter pink_mist: there's a bit of proecssing before rendering the template. It would result in too much duplicate code.
12:25 bpmedley punter: The example below may be more helpful: http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Adding-form-validation-checks
12:26 pink_mist punter: then put that code in a helper
12:28 bpmedley punter: Did either example in the Rendering guide strike your fancy?
12:29 punter These examples seem a bit complicated, I can't understand them very much.
12:29 punter I've never used the validation feature
12:30 punter I don't get how it all works.
12:30 bpmedley Perhaps copy 'n paste, run, and debug them?
12:33 punter I should understand at least a little bit before using them
12:34 bpmedley Sure. Perhaps a specific question?
12:37 punter ok, I'm reading this: http://mojolicious.org/perldoc/Mojolicious/Controller#validation
12:37 punter so we have a validator that does validations
12:38 punter if one of these checks in that block of code fails, what happens? does an exception get raised?
12:38 punter or would $title be equal to undef?
12:39 punter Another question: Does "flash" require that I use Mojolicious's built-in sessions? Because I dont'
12:40 punter bpmedley: ^^
12:41 bpmedley punter: $validation->has_error  <-- I just know that has_error will be true if one of the checks fail.
12:42 punter so what happens after that? Do I do: if ($validation->has_error) { return $self->redirect_to('form_get'); }  ? Is that it?
12:42 punter sort of that?
12:42 bpmedley punter: That sounds logical.  Also, what are you using for sessions?
12:43 punter bpmedley: My own homebrewn plugin, which I sent you by email the other day
12:44 punter bpmedley: the Auth.pm plugin
12:44 bpmedley Hrmm.  You may need to add support for something akin to flash in your setup; or, a different approach if you can't.
12:44 punter bpmedley: do i need mojo's builtin sessions for flash to work?
12:45 bpmedley Probably.
12:45 punter anyone else maybe knows?
12:45 inbioz joined #mojo
12:45 punter I'll use my session's store then.
12:57 punter Is it not possible to retrieve a hash of all param names & values? or at least a list of all param names?
12:58 punter req->params->to_hash
13:06 meshl joined #mojo
13:47 eseyman joined #mojo
14:10 * sri wonders if we should remove the windows check from Mojo::Server::Prefork, now that it works with ubuntu for windows
14:10 mmp sri: how do you get that going, does ubuntu have an MSI that installs?
14:12 sri no, it comes from microsoft
14:12 sri i have not tried it yet https://msdn.microsoft.com/en-us/commandline/wsl/install_guide
14:12 sri but i imagine that's the default way everyone will deploy perl on windows now
14:13 mmp is there a new $^O
14:13 sri apparently not
14:13 sri that makes things a bit messy
14:22 sri putting it on the roadmap https://github.com/kraih/mojo/issues/954
14:58 genio sri: \o/  Glad it worked.  Are you trying the developer builds yet with UbuntuWindows?
15:10 inbioz joined #mojo
15:20 frogz joined #mojo
15:21 sri genio: not yet
15:30 dod joined #mojo
15:30 PryMar56 joined #mojo
15:46 genio I'll let you know when they release a build that fixes some of their core problems.  They've done a good job so far, but have a few very key things to fix
15:52 frogz joined #mojo
16:45 inbioz joined #mojo
16:50 punter joined #mojo
16:52 punter Is it possible for a single Hypnotoad server to host multiple subdomains of a domain?
16:52 punter I mean, I'd like to have forums.mydomain.com, mail.mydomain.com, games.mydomain.com
16:53 punter but all under the same "startup" method if possible
16:53 punter is it? (possible)
16:54 punter And, will url_for('other_subdomain_route')->to_abs show the correct subdomain?
16:55 bpmedley plugin Mount => {'*.bmedley.org' => '/opt/bmedley.org/bmedley.pl'}; <-- Look into something like this
16:55 bpmedley punter: ^^ <-- May not give exactly what you what; however, it's a starting point
16:57 pink_mist punter: the startup method is specific to the server, so no
17:00 sri actually it is possible http://mojolicious.org/perldoc/Mojolicious/Plugin/HeaderCondition#SYNOPSIS
17:01 sri get '/' => (host => qr/mojolicious\.org/) => sub {...};
17:01 pink_mist 0_o whuh, wow
17:02 sri all kinds of extra routing rules can be hacked in with conditions
17:03 sri http://mojolicious.org/perldoc/Mojolicious/Guides/Routing#Conditions
17:05 * sri always loved the werewolf condition :) http://mojolicious.org/perldoc/Mojolicious/Guides/Routing#Condition-plugins
17:06 punter sri: but will url_for(...)->to_abs return the correct host?
17:06 sri that question is too vague
17:08 punter I mean, when the user is on forums.mydomain.com and want to know the abs url of route with name = 'login' which normally lies on 'account.mydomain.com', will they have a way of retrieving that correct subdomain?
17:08 sri let me put it this way, if there's no logical way for it to get the host, then of course it can't get it
17:08 punter ok
17:10 punter unless I could somehow reprogram url_for and have it use the hostname from the stash (which can be inheritted by "grandparent route "hostname/")
17:11 punter ...if the grandparent route sets the stash property domain => 'accounts.mydomain.com'
17:14 tchaves joined #mojo
17:41 frogz joined #mojo
17:47 jberger sri: maybe just make it a warning?
17:47 jberger Or a log info?
17:47 sri what would it say?
17:49 jberger "Prefork support is unsupported" or something
17:49 jberger But let them continue
17:49 sri umm, but it's supported
17:49 jberger Sorry, i should have said unsupported on windows
17:49 sri that seems absolutely terrible
17:50 sri if hypnotoad on ubuntu windows works perfectly, why would we confuse people with warnings?
17:50 jberger Until we can tell Ubuntu on windows from say strawberry how can we do anything?
17:51 sri false warnings even
17:51 sri we could say we don't care about strawberry anymore and not do anything special for it
17:52 sri after all it's strawberry's fault that it's not better
17:53 jberger Yeah
17:53 jberger It would be nice if there was a new $^O
17:54 jberger What would be better is a $^{FORK_EMULATED}
18:01 jberger I guess we could check $^O and whatever %Config exists for thread support
18:02 Adura Wouldn't $0 suffice?
18:02 sri you can have a threaded perl under ubuntu windows
18:03 jberger Sure, but if you didn't then you certainly wouldn't have fork emulation
18:03 sri maybe i wasn't clear enough
18:03 sri the point here is to support ubuntu windows as good as we can
18:03 jberger Actually i wonder if Configure.sh would build perl without fork emulation
18:04 sri not to make stupid windows perl more obvious
18:04 jberger Ah that is a different goal
18:04 sri personally, i don't care how strawberry fails
18:05 sri now there is a good windows perl, so we make mojolicious work well with it
18:05 sri that's all that matters imo
18:05 jberger $Config{d_pseudofork}
18:05 jberger From mauke on #p5p
18:16 good_news_everyon joined #mojo
18:16 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vwh0h
18:16 good_news_everyon mojo/master dc0da0f Sebastian Riedel: just check for fork emulation
18:16 good_news_everyon left #mojo
18:16 sri seems reasonable
18:17 jberger sri++
18:18 sri jberger++
18:32 inbioz joined #mojo
18:36 inbioz joined #mojo
19:29 frogz joined #mojo
19:39 sri looks like you don't get windows preview builds right away, so i can't actually test ubuntu on windows yet
19:48 bpmedley That will be sweet.  From Winbuntu to Mojo'd website in 10 minutes, if everything works out.
20:45 meshl joined #mojo
20:59 Vitrifur joined #mojo
21:17 frogz joined #mojo
21:21 genio sri: Right,  It took me 3+ days to get the preview build
21:25 kaare joined #mojo
21:45 bpmedley jberger++ # ACME .. :)
21:49 frogz joined #mojo
22:21 frogz joined #mojo
22:26 ChmEarl joined #mojo
22:43 bzero joined #mojo
22:52 frogz joined #mojo
23:29 PryMar56 joined #mojo
23:47 cgtopher joined #mojo
23:48 frogz joined #mojo

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