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

IRC log for #mojo, 2017-01-16

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

All times shown according to UTC.

Time Nick Message
00:44 marty_ joined #mojo
00:51 aborazmeh joined #mojo
01:07 tardisx joined #mojo
01:33 aborazmeh joined #mojo
02:15 tardisx joined #mojo
02:27 coolo_ joined #mojo
03:09 absolut_todd joined #mojo
03:56 tardisx joined #mojo
04:01 gizmomathboy joined #mojo
04:03 tardisx joined #mojo
04:07 sh14 joined #mojo
04:58 prajith joined #mojo
05:04 dboehmer_ joined #mojo
05:37 lluad joined #mojo
06:32 dotan_convos joined #mojo
06:40 avkhozov joined #mojo
06:47 martin joined #mojo
06:56 sugar joined #mojo
07:00 stryx` joined #mojo
07:04 ste joined #mojo
07:06 Vandal joined #mojo
07:06 ste left #mojo
07:17 inokenty-w joined #mojo
07:19 dod joined #mojo
07:31 avkhozov joined #mojo
07:45 janl joined #mojo
07:45 inbioz joined #mojo
08:26 ashimema joined #mojo
08:31 trone joined #mojo
08:34 stryx` joined #mojo
08:36 kes joined #mojo
08:37 rshadow joined #mojo
08:45 rshadow joined #mojo
08:50 Petru joined #mojo
08:59 tardisx joined #mojo
09:02 noganex joined #mojo
09:14 avkhozov joined #mojo
09:20 cpan_mojo Mojo-Weixin-1.2.9 by SJDY https://metacpan.org/release/SJDY/Mojo-Weixin-1.2.9
09:22 cpan_mojo Mojo-Webqq-2.0.4 by SJDY https://metacpan.org/release/SJDY/Mojo-Webqq-2.0.4
09:23 Petru joined #mojo
09:28 stryx` joined #mojo
09:41 dod joined #mojo
09:44 dod joined #mojo
09:52 kes I am going to create pull request. May some one review please?
09:52 kes https://github.com/KES777/mojo/commit/c4831a0524e6a601a2fea50736e680c547a2c930
09:56 kes all tests are passed
09:59 Lee_ IMO you shouldn't be showing stack traces on staging, testing, etc
09:59 Petru joined #mojo
10:04 kes Then I should provide exception.<mode>.html.ep
10:06 coolo joined #mojo
10:07 kes in other cases for non production mode
10:07 kes 'debug' template is default
10:07 Lee if you want stack traces, yes
10:08 kes for all development modes, I think, traces are preferred
10:08 Lee yes, but staging and testing are not development
10:10 kes Maybe 'staging' is wrong name here. I mean 'xxxx_develop' mode
10:11 Lee misleading commit message then
10:13 kes How it would be to spell better?
10:15 Lee the commit message says "'staging', 'testing' are also
10:15 Lee belongs to development mode
10:15 Lee "
10:15 Lee i think that's incorrect
10:15 Lee staging / testing are closer to production than development
10:17 Lee you probably need to update/add to the docs before you raise this as a PR as well
10:18 Lee i don't know if anyone else is using a mode other than development/production (we're certainly not) but if they are this would be a significant and potentially dangerous change
10:19 kes I try to ask all are agree with this change then will spent time to document this
10:20 kes but you are right Lee. Docs are significant for this significant change.
10:24 kes http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Rendering-exception-and-not_found-pages
10:24 kes >The renderer will always try to find exception.$mode.$format.* or not_found.$mode.$format.* before falling back to the built-in default templates.
10:25 kes The DOC currently do not describe what is used as fallback: 'debug' or 'exception' template
10:25 kes 'debug' or 'not_found' template
10:34 dod joined #mojo
10:36 gregf_ joined #mojo
10:40 foursixnine joined #mojo
10:50 dod joined #mojo
11:37 tchaves joined #mojo
12:02 Dandre1 joined #mojo
12:10 sugar joined #mojo
12:23 schelcj join #metacpan
12:23 schelcj hello monday
13:23 dod joined #mojo
13:24 dod joined #mojo
13:27 kes joined #mojo
13:31 Petru joined #mojo
13:34 mcsnolte joined #mojo
13:45 Dandre joined #mojo
13:46 foursixnine joined #mojo
14:06 stryx` joined #mojo
14:16 Pyritic joined #mojo
14:24 sugar joined #mojo
14:36 jabberwok left #mojo
14:50 Pyritic joined #mojo
15:35 gryphon joined #mojo
15:36 bpmedley joined #mojo
15:37 bpmedley joined #mojo
15:50 zivester joined #mojo
15:59 inbioz joined #mojo
16:05 kes one review (
16:34 jberger kes: that commit changes the fundamental nature of the mode system
16:34 jberger it couldn't be considered until a major release and even then I don't think it is a good idea
16:35 jberger kes: I use several different modes at $work, all of which are not "development" in nature
16:36 jberger we have 3 modes that are all "production" quality: "internal", "public", and "worker"
16:36 jberger we use the "test" mode when running CI tests
16:37 jberger the closest I could come to that idea is that it could be helpful to be able to designated multiple modes as "development" levels, but I don't especially know how that would work
16:39 lluad joined #mojo
16:48 kes So there should be check something like: if $app->production; if !$app->production
16:49 pink_mist I think the check is for development
16:49 kes or plugin which returns the application mode
16:50 kes ->plugin( 'is_development', devel_modes => [qw/ xxx, yyy, zzz /] )
16:50 kes or so
16:51 Grinnz ah i see, reducing the reliance on the exact string 'development'
16:51 Grinnz that might be useful, dunno
16:51 Grinnz the problem is that the inbuilt templates depend on that string as well
16:51 Grinnz i don't know how you'd handle that
16:58 kes I am not sure about names, but this should be plugin where we configure all available modes used in our development/production
16:59 kes so in the code we do not relay on hardcoded: 'production' 'development' etc. Just check $c->is_production; $c->is_development or so
17:00 pink_mist isn't ->is_production hardcoding 'production'?
17:00 kes no, we configure it while plugin is loading
17:02 pink_mist so you'd configure it in a way that you'd need to call a function with a different name?
17:02 kes $app->plugin( 'Modes', prod => [qw/ production stagings testing internal /], dev => [qw/ development xxxxx /])
17:04 kes HEre is just question. What mojolicious should render if no <mode> specific template supplied: 'debug' template or 'exception/not_found' template
17:06 kes By default this plugin may count to show 'debug' template only for 'development' mode. But this plugin will allow configure additional 'development' modes if they are used
17:06 perlpilot joined #mojo
17:07 kes This will not break current behavior and supply more flexibility
17:07 lluad It'd be good to avoid any situation in which a mistake or missing template caused anything other than production data to be shown on production.
17:08 Petru joined #mojo
17:09 jberger lluad: I disagree, the situation that must be avoided is that ANY data be shown on a template that wasn't intended (including not_found and exception) except in known/designated development modes, which at the moment only includes "development"
17:09 jberger kes: here is an option for you
17:09 jberger that would work right now
17:10 jberger in your application startup, check for certain known development modes
17:10 jberger assign that to some application-specific attribute (e.g. your own state)
17:10 jberger then set the app's actual mode to "development"
17:11 sri i think a reasonable proposal could be accepted for this
17:12 sri not the whole plugin shenanigans though, something simple and clean
17:12 kes But in this case $app->mode will always return 'development' and will be obvious to setup other modes for just checking them in startup
17:14 kes ah, I miss: own state. Now I got it. Thank you jberger
17:16 jberger sri: the cleanest thing I can think of (and it would need checking elsewhere) would be to have this line check $c->app->is_development https://github.com/kraih/mojo/blob/master/lib/Mojolicious/Plugin/DefaultHelpers.pm#L110
17:16 jberger rather than $mode eq 'development'
17:17 jberger then you could override is_development in your own app
17:17 jberger and it would add sub Mojolicious::is_development { shift->mode eq 'development' }
17:17 kes there also one more harcoded state: 'production'. Do not remember where it is
17:18 jberger kes: if you'd like to help, having a list of all the places that check for specific modes in the mojo codebase would be helpful to me
17:18 sri hypnotoad
17:18 sri but it's not a check
17:21 Dandre joined #mojo
17:51 dod joined #mojo
17:52 kes yeah, that is not a check. Think I saw only that.
17:56 jberger sri: this is a diff for the code bits as I see them: http://paste.debian.net/909017/
17:56 jberger cost is one line
17:56 jberger I only saw two places in lib/ which checked the mode
17:56 jberger the bundled templates and the log level default
17:57 jberger would need tests and doc of course
17:58 jberger and probably usage in a Guide
17:58 jberger but the idea would be that sub MyApp::is_development could check for other things
17:59 sri how would it work for lite apps?
18:00 jberger is that of major concern? one doesn't overload home in lite apps either
18:00 sri app->home(Mojo::Home->new)
18:01 jberger sure, but in the same way you'd just set the mode, app->mode('something');
18:01 jberger to extend the is_development behavior would be a Full all feature
18:02 Petru hi, what’s the best way to display the logged in user using a layout? I don’t want to pass the variable in each of the render functions
18:02 jberger similar to what we did recently with log, making it a self-contained attribute let us overload it in more complex situations
18:02 jberger Petru just set it in the stash
18:03 Petru thanks, but how do I access variables in the stash inside the layout
18:03 jberger render variables are just shorthand for stash anyway
18:03 jberger same way
18:06 jberger perl -Mojo -E 'a("/" => sub { $_->stash(user => "Joel"); $_->render(inline => q[<%= $user %> says, Hello <%= $place %>], place => "World") })->start' get /
18:06 jberger then again, I don't use the $var form of stash access in templates hardly ever anymore
18:06 Petru inside log in I do this: $self->stash(username => $username); and in layout I do this <%= $username %> but I get: Global symbol "$username" requires explicit package name
18:07 jberger so if you want to access $username, it must ALWAYS be set
18:07 jberger but, if you use stash('username') in your template then you're fine
18:08 jberger perl -Mojo -E 'a("/" => sub { $_->stash(user => "Joel"); $_->render(inline => q[<%= stash("user") || "Someone" %> says, Hello <%= $place %>], place => "World") })->start' get /
18:10 jberger and this is why I almost always use the stash helper in templates and almost never use the $ form
18:11 jberger sri: if you are saying I should make is_development an attribute, that works for me too
18:11 jberger then lite apps could set that value
18:11 jberger and it could still be overloadable in full apps
18:11 jberger just exactly like log
18:13 sri jberger: not a fan of bool attributes
18:14 jberger well then I guess this diff isn't necessary :-P http://paste.debian.net/909021/
18:15 Petru thanks :D
18:19 Pyritic joined #mojo
18:28 Petru why do I get an error if I do this: http://pastebin.com/fKSm6uqm inside a layout?
18:29 jberger don't put perl syntax stuff (like if) in output tags
18:29 jberger <% if
18:29 jberger not <%= if
18:29 jberger and the same for the close bracket
18:30 jberger note that you can just use the line template directive for those
18:30 jberger % if (...) {
18:30 jberger and % }
18:31 Petru thanks :D
18:33 abra joined #mojo
18:54 asarch joined #mojo
18:57 stryx` joined #mojo
18:57 sugar joined #mojo
19:08 sugar joined #mojo
19:45 dod joined #mojo
20:14 PryMar56 joined #mojo
20:25 zach what is the proper way to compare to bcrypt hashes?
20:26 preaction use the provided bcrypt function for comparison
20:34 rshadow joined #mojo
21:06 eseyman joined #mojo
21:11 Petru I’m trying to render a static html file inside my public folder. I’ve tried: $self->reply->static("rankings.html"); but I’m getting redirected to /
21:15 Petru solved it
21:17 Petru how can I make the html file use the css inside the public folder?
21:19 jberger it will get served by the static file server automatically
21:19 jberger remember not to link to "public/..."
21:19 jberger public/ isn't part of it
21:20 Petru here is how I link it: http://paste.debian.net/909060/
21:21 pink_mist that's not linking to anything
21:21 Petru I’ve put the css folders inside public.
21:21 jberger right, that html can just request css and it will get served without you doing anything
21:21 jberger note: the rankings.html would be served automatically too if you don't need it to do anything else
21:22 Petru I want it to be served only if the user is loged in
21:23 jberger ok
21:23 jberger so then yeah, do what you did (with the user check)
21:23 jberger but the css can be served to everyone right?
21:23 Petru is there a way to impose logged in condition on public folder?
21:23 Petru yes
21:24 jberger no, there is no generic way to control all access to the public folder
21:24 pink_mist would be cool if under could work for that
21:24 Petru so what would be a good way then not to serve rankings.html which is also in public?
21:25 jberger don't put rankings.html into public
21:25 jberger serve it from someplace else with reply->asset
21:26 jberger there are also tricks you can play with the reverse proxy, but for only one file it isn't worth it
21:39 zivester joined #mojo
22:08 stryx` joined #mojo
22:20 stryx` joined #mojo
22:46 LQ joined #mojo
22:47 LQ Is Mojolicious open source software?  If yes, what license terms apply? GNU?  MIT?
22:47 pink_mist of course it is
22:48 pink_mist https://metacpan.org/pod/Mojolicious#COPYRIGHT-AND-LICENSE
22:48 pink_mist https://metacpan.org/source/SRI/Mojolicious-7.19/LICENSE
22:50 pink_mist https://tldrlegal.com/license/artistic-license-2.0-(artistic)
22:59 LQ thanks!
23:01 Phil21 darn, I missed that
23:01 Phil21 coulda had some sweet sweet bitcoins
23:05 jberger Phil21: ?
23:05 Phil21 mojo isn't open source, it's phil-source
23:05 Phil21 send phil bitcoins
23:05 lluad joined #mojo
23:05 jberger hahaha
23:05 inbioz joined #mojo
23:05 jberger +1 from me
23:06 * jberger has seen Phil21 sell things
23:06 jberger bet there's some sweet bitcoins there
23:06 Phil21 heheh
23:13 Petru I’ve tried making some pages private, but only restricted_area is forbidden if the user is not logged in. I’m still able to access registered_users. How can I fix it? Code: http://pastebin.com/wbhgkgKP
23:20 jberger that isn't enough of your app to be able to determine that
23:20 jberger there are examples in the Guies
23:20 jberger Guides
23:22 marty joined #mojo
23:28 gizmomathboy joined #mojo
23:37 sugar joined #mojo

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