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

IRC log for #mojo, 2016-07-05

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

All times shown according to UTC.

Time Nick Message
02:04 noganex joined #mojo
02:19 irqq_ joined #mojo
02:32 prajith_ joined #mojo
03:42 prajithp joined #mojo
04:10 prajith_ joined #mojo
04:15 prajith joined #mojo
04:15 _prajith joined #mojo
04:29 inokenty-w joined #mojo
04:33 prajith joined #mojo
04:52 prajith_ joined #mojo
05:36 prajith_ joined #mojo
05:54 punter joined #mojo
06:15 prajithp joined #mojo
06:16 _prajith joined #mojo
06:25 dod joined #mojo
06:35 prajith joined #mojo
06:48 dod joined #mojo
06:52 dod joined #mojo
07:00 prajithp joined #mojo
07:09 prajith joined #mojo
07:11 AndrewIsh joined #mojo
07:11 Vandal joined #mojo
07:24 trone joined #mojo
07:45 eseyman joined #mojo
07:57 cuechan joined #mojo
08:08 Akron joined #mojo
08:10 osfabibisi joined #mojo
08:17 berov joined #mojo
08:44 irqq joined #mojo
08:52 Akron joined #mojo
08:57 ashimema joined #mojo
09:24 punter joined #mojo
09:31 prajith_ joined #mojo
10:30 cuechan joined #mojo
10:50 salva joined #mojo
10:51 kes joined #mojo
10:55 good_news_everyon joined #mojo
10:55 good_news_everyon [mojo] kraih pushed 2 new commits to master: https://git.io/vKTLA
10:55 good_news_everyon mojo/master 53a15b2 Akron: Fixed css selector for value-less attributes
10:55 good_news_everyon mojo/master 8da4f71 Sebastian Riedel: Merge pull request #979 from Akron/test-dom-attribute...
10:55 good_news_everyon left #mojo
11:07 good_news_everyon joined #mojo
11:07 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vKTq3
11:07 good_news_everyon mojo/master c430b64 Sebastian Riedel: update Changes
11:07 good_news_everyon left #mojo
11:08 sri akron is right though, that selector code does not look optimal yet
11:08 tchaves joined #mojo
11:43 kid51 joined #mojo
12:01 nic gtodd: A pattern that might help you: put only your project-specific modules under 'lib' and put everything installed from a pkg in 'dep/lib' via "cpanm -l dep --installdeps ."
12:02 nic Personally I don't put dep/bin in my path [could be dangerous] so I just get used to invoking dep/bin/morbo ...
12:14 kaare joined #mojo
12:24 perlpilot joined #mojo
12:31 a6502 joined #mojo
12:46 jabberwok left #mojo
12:51 neilhwatson joined #mojo
13:05 punter joined #mojo
13:05 ramortegui joined #mojo
13:09 prajith_ joined #mojo
13:12 gizmomathboy joined #mojo
13:15 marty joined #mojo
13:23 marty joined #mojo
13:36 gtodd nic: thanks ...
13:39 gtodd nic: I think the pattern I am seeing here (by unearthing old attempts at creating Mojo apps) is similar:  lib/ MyApp/[Models|Controlers]but   and with non app specific dependencies ./local ...  how I installed things to ./local remains a mystery :)
13:41 gtodd since never really did any deployment though so I'm not sure how robust the set up was.  Everything worked fine on the development box but local::lib perlbrew and ~/local had everything that was in the project's ./local directory ...
13:42 mcsnolte joined #mojo
13:43 nic Sounds like you've got it under control
13:43 nic [accidental pun]
13:46 nic I find MyApp::Controller::Something a bit of a mouthful, so I take advantage of Mojolicious's option of doing something like C::Something.  (My model classes are also like M::User)  But that's definitely a minority taste
13:48 gtodd nic: ahah I found a VM where I "deployed" something and documented it   I used the mst method:   Perl::Build and then carton
13:49 nic carton is even better cos you're not constrained to keeping the dev box the same as the live box
13:51 gtodd nic: yeah ... I like the flexibility and agnosticism of Mojolicious ... but there's advantages to having strict-ish conventions (c.f Rails) that buy you shortcuts by default
13:52 sri what shortcuts does rails have that we don't?
13:53 gtodd sri:  none really but their docs are less TIMTOWDI and more "do it this way"
13:57 gtodd I remember I was following a series of articles to get a sense of "best practices" (or just "how most people do it because ...") for deployment http://oliverguenther.de/2014/04/applications-with-mojolicious-part-one-introduction/ but they ended before the deployment chapter :-D
13:58 sri wish someone would finally write an o'reilly book about mojolicious
13:59 cuechan joined #mojo
14:00 gtodd hmm OK github shows Olivier is doing more rails stuff because of OpenProject ...  anyway it is pretty easy to switch back and forth between the two approaches / frameworks / languages
14:01 gtodd sri: ++ that'd be a good thing :)
14:03 gtodd and if, say, O'Reilly won't allow extinct or mythical animals on their covers then unicorns and raptors can appear inside and the cover could have a descendant of a raptor ... like a ...
14:03 ptolemarch joined #mojo
14:04 nic ?
14:06 gtodd golden eagle ? :-D
14:06 sri cassowary
14:06 gtodd wait ... I have a perl book with a dragon on it somewhere
14:06 gtodd might not be ORA though
14:07 asarch joined #mojo
14:07 nic oh, it wasn't intended as a comment about ptolemarch
14:08 nic Not sure I like the insinuation that rainbow-spewing raptors didn't really exist, btw
14:09 gtodd they might require them to exist currently though ...
14:11 gtodd I'm sure  they have page somewhere that lists all animals in use replete with editorial policies about allowable animals  ;-)
14:12 gtodd srii: wow... "The average lifespan of wild cassowaries is believed to be about 40 to 50 years."
14:15 gtodd cassowary++ colophon could mention long lifespan, link to prehistoric raptors, kicking with sharp claws, glistening rainbow plumage ...
14:17 nic Now I realise that previous discussions have been too focused on the table of contents
14:24 PopeFelix joined #mojo
14:24 PopeFelix joined #mojo
14:45 * ptolemarch is not a rainbow-spewing raptor.
14:46 nic it was more vague than that
14:46 nic http://irclog.perlgeek.de/mojo/2016-07-05#i_12787312
14:49 dod joined #mojo
14:58 dotand joined #mojo
15:12 orev joined #mojo
15:31 * sri wonders if the mojo menu bar should contain a chat link to mibbit too
15:32 sri it's definitely our best support channel
15:32 sri although, i guess too many drive-by questions might be unnerving for the regulars
15:32 sri (including me!)
15:36 cpan_mojo Mojo-UserAgent-Mockable-1.30 by POPEFELIX https://metacpan.org/release/POPEFELIX/Mojo-UserAgent-Mockable-1.30
15:46 lluad joined #mojo
15:55 absolut_todd joined #mojo
16:15 irqq joined #mojo
16:28 disputin joined #mojo
16:49 PryMar56 joined #mojo
17:10 gtodd hmm how can I use Mojo::DOM   "perl oneliner style"    perl -ne 'if (/matching/.../end/) { print }' giant_file.txt  ... to pull apart and auto edit html files ?
17:10 gtodd perl -MMojo::DOM -ne '$f = do{local undef $/; <>} ; $dom = Mojo::DOM->new(); print $dom->parse($f)->at("div#secondary")->all_text;'  giant_file.html
17:11 gtodd I can find the div I want to rip out ... ^^^  but ... not sure what to do after that :-D
17:12 jberger gtodd: seen ojo.pm?
17:12 jberger perl -Mojo
17:12 gtodd oh yeah :)  ok I'll figure it out ... it's heck of a lot faster than regexes :-P
17:13 jberger If I weren't on my phone I'd give a little example
17:15 marty joined #mojo
17:21 dod joined #mojo
17:23 odc joined #mojo
18:39 mattp_ joined #mojo
18:39 [0xAF joined #mojo
18:42 [0xAF Hi. I was wondering how to get html design templates with mojo. The user should be able to switch template at any time from dropdown menu. I was going to use:     unshift @{$app->renderer->paths}, '/home/sri/themes/blue/templates';    but then I realized that this could possibly change the template for everyone, and not for the current user. So how should I change the template path on each http request,
18:42 [0xAF instead of changing it for the whole app?
18:44 [0xAF I'm not perfectly familiar with mojo yet. I was thinking to put such "unshift" in 'before_renderer' hook.
18:45 [0xAF Any advice on how to do it properly is welcome. ;)
18:45 bpmedley [0xAF: perhaps:  render(template => "$dir/foo/bar/baz")
18:46 bpmedley Also, you could create your own render handler
18:47 [0xAF bpmedley: I want to keep separate folders for each templates, where I should have all the renderer files *.html.ep and the layout/* subfolder.
18:47 [0xAF I'm not sure, I'm in the right direction of acheiving my goal
18:47 [0xAF bpmedley: own render handler?
18:48 bpmedley [0xAF: Yeah, i can create an example in a few hours
18:49 [0xAF] bpmedley: I dont want to take so much of your time. Thanks, but if you can point me in the right direction, I will read what it takes to understand it myself.
18:50 nicomen you can use layout stash, and there is even a variant parameter
18:50 bpmedley http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Adding-your-favorite-template-system
18:52 [0xAF] nicomen: I though of that, but my problem is that I want my themes to be different in html.ep and in css files. So if I go for layout templates, then I will have to put something like "$theme=asd" into layout file and then check "if ($theme eq 'asd')" in every html.ep for every difference I have. At least that far I imagine.
18:53 nicomen AFAIR you can even have different dirs of templates for the different themes
18:54 [0xAF] nicomen: any "keyword" to search for. I've been looking into this in last 2 hours, but didnt found any pointer to it.
18:54 [0xAF] bpmedley: That looks promissing. Looks like the way I should go. Thanks a lot. Will read further.
18:55 [0xAF] bpmedley: anyway, if you feel like you have the time for the example, I would much appriciate your way of doing it. I'm not insisting of course, I will read it myself.
18:56 good_news_everyon joined #mojo
18:56 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vKk0E
18:56 good_news_everyon mojo/master fb09643 Sebastian Riedel: link to plugin
18:56 good_news_everyon left #mojo
19:02 sri [0xAF]: it's an uncommon problem, and i don't think a best practice exists yet
19:03 sri suppose most just generate dynamic template names
19:04 [0xAF] sri, sorry for the stupid question, but what do you mean by dynamic template names. I should have my routes remaped to different templates based on theme selection?
19:09 sri http://irclog.perlgeek.de/mojo/2016-07-05#i_12789247
19:10 [0xAF] sri: I see. Thanks.
19:14 [0xAF] sri, bpmedley: the solution with dynamic templates looks like the easiest one. On the other hand, I can achieve it with own render handler. If I go for the render handler, I could try to make it as a separate plugin for Mojo (I guess), then it would be possible for others to use it. Am I thinkig right here?
19:17 jberger [0xAF]: I'd try to pin down a workflow that works for you before trying to make something totally reusable
19:17 jberger of course keep reuse in mind
19:18 jberger but it sounds like you have very high level questions that need answering first, if you bog down in best ways to reuse these things it might never go anywhere
19:20 [0xAF] jberger: Sounds reasonable. But the problem is: if I go for the easiest way, which seems not compatible with universal reusing (like the plugin), then I will probably never come back to make it reusable ;)
19:21 disputin joined #mojo
19:23 [0xAF] anyway, I will go with the dynamic templates, I guess. And when it works, I will try to make it as a plugin.
19:23 jberger personally I would just abstract away the dynamicism
19:23 jberger declare a stash variable to be the theme
19:24 [0xAF] jberger: i try to do this, everywhere i can. but i'm not as good as i would like, to be able to see all the abstract ways of doing it.
19:24 [0xAF] jberger: that's the way i'm going to implement it.
19:24 jberger and build a myrender helper which uses that value to build the actual template path
19:24 jberger yeah
19:24 [0xAF] jberger: thanks for the suggestion ;)
19:25 jberger anyway, at that point, how it decides how to figure that theme disctintion out is contained in that helper, so you change it there until you get it the way you like it
19:25 jberger no problem
19:27 [0xAF] Thanks a lot for the help guys. That's the best part of the open-source projects. You can always ask nice people for help. Big respect to all of you!
19:27 sri pay it forward
19:28 [0xAF] always!
19:35 Kripton joined #mojo
19:37 PopeF joined #mojo
19:39 cpan_mojo Mojo-UserAgent-Mockable-1.31 by POPEFELIX https://metacpan.org/release/POPEFELIX/Mojo-UserAgent-Mockable-1.31
19:47 tchaves joined #mojo
19:57 punter joined #mojo
20:03 nic [0xAF]: What aspects of your theme cannot be captured in a layout file?
20:04 nic My layout files list the css and js files to use
20:05 nic and the layout id is easy to pass around in the cookie
20:05 nic s/the cookie/a cookie/
20:08 [0xAF] nic: like different grids in bootstrap (span6 vs span9) and many other difference in the html files
20:09 nic if your inner templates need to know the theme, that's a little more laborious, but simple if you use the main cookie since the value will be in the session
20:11 nic an alternative is to use a secondary cookie so that you can set it (and act upon it) in js, and it's easy enough to make that available via the stash too
20:13 [0xAF] nic: but if it's in the cookie or in the stash, i will need to make many checks in the html files like: "if ($theme eq 'asd') { do this } elsif ($theme eq 'qwe') { do that } else { do whatever }"
20:13 [0xAF] nic: or I'm missing something here?
20:14 [0xAF] this is not portable way, neither easy way to add new themes or even rename a theme
20:14 nic which tradeoffs you choose depends on the what you're doing (and the quantities involved)
20:15 [0xAF] nic: I see. But my problem is that I want to leave other ppl do the themes later and I do not want them to bug me with everything... so I prefer an easier way for them, instead of an easier way for me :)
20:15 nic if the only variation at the html level is grid then you can decide which template to include based on the theme value
20:16 nic the easier way for everybody is to limit your themes to only vary in the css and js (and layout files)
20:16 [0xAF] nic: I do not know what variants will they make later. This is the bigges problem, that's why I look for more universal way.
20:17 [0xAF] nic: that would be perfect for everyone, i agree... but not the case here, unfortunately.
20:17 nic ok, well, just wanted to check you were aware of the easy routes before embarking on your round-the-world voyage
20:18 [0xAF] nic: thanks for the suggestions :) appriciated!
20:48 kid511 joined #mojo
21:22 gtodd ":not" looked hopeful there for a second :)
21:23 gtodd so is:   perl -Mojo -E '$f = do{local undef $/; <>}; $d = Mojo::DOM->new() ; say scalar @{ $d->parse($f)->find(qw|div|)}
21:23 gtodd telling me how many divs I have ?
21:25 jberger it certainly is the number of results found
21:25 jberger btw now that I'm at a computer
21:26 disputin joined #mojo
21:26 jberger wanna do some ojo hacking?
21:26 jberger perl -Mojo -E 'say x(b(shift)->slurp)->find(q[div])->count' filename
21:26 jberger ought to do the same thing
21:27 jberger err s/count/size/
21:29 zivester joined #mojo
21:42 disputin joined #mojo
22:00 gtodd awesome :-D
22:01 good_news_everyon joined #mojo
22:01 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vKkA7
22:01 good_news_everyon mojo/master 70c09a5 Sebastian Riedel: improve Mojo::URL not to include the userinfo part when generating URLs, as recommended by the URL Living Standard
22:01 good_news_everyon left #mojo
22:02 sri i think we could get rid of Mojo::URL::authority too, and merge the parts we need into ->parse and ->host_port
22:03 meshl joined #mojo
22:03 sri don't have time to look into that though, if someone else wants a little task
22:04 gtodd jberger: I was thinking I could write my own errm "parser helpers" like ->filter()     where $dom->parse->filter(elems divs attrs to leave out)  could somehow be strung together from other bits  ... I'm sure one of the perl XML/XPath modules has something like that
22:08 gtodd anyway glad to leave out $f = do{local undef $/; <>}; $dom = Mojo::DOM->new($f)  ....  :-P
22:09 sri gtodd: http://mojolicious.org/perldoc/Mojo/Collection#grep
22:11 jberger sri++ # url change
22:11 sri jberger++ # bringing it up
22:12 gtodd sri: yes exactly  ... so  if I want to start my own collection of parsing "verbs" (?) I can create a package Mojo::DOM::Extras  that inherits Mojo::DOM and then just put all kinds of nonsense in there ...
22:13 jberger gtodd: I'm not sure what you mean
22:14 jberger normally one a combination of find then some tranforms (each/grep/map) and then possibly more find calls until they arrive at the result they want
22:16 gtodd hmm ok  the OO used by Mojolicious seems a bit different ... but I thought I could  then just save that particular combination of transforms as a subroutine that I could package up and use as needed ... but just around then house ... never outside ...
22:16 gtodd like sweatpants
22:17 sri apple is really really slow at the moment
22:18 sri ordered another macbook on thursday last week, and they are still "preparing for shipment"
22:22 sri anyway, i've opened an issue for Mojo::URL::authority https://github.com/kraih/mojo/issues/980
22:23 sri for potential contributors
22:23 disputin joined #mojo
22:27 disputin joined #mojo
22:44 graf joined #mojo
22:44 meshl joined #mojo
22:45 tchaves joined #mojo
22:46 jberger gtodd: of course you can, but will that set of transforms be generic enough for people to reuse?
22:46 marty joined #mojo
22:48 gtodd probably not .. .I might not need to create shortcuts anyway if I learn how to use the Mojo::DOM more effectively
22:54 gtodd jberger: e.g. how to view all the divs in a document that do *not* have  id="temp" ...
22:55 gtodd the obvious stuff didn't work so I did perl -Mojo -E 'say x(b(shift)->slurp)->find(q|div|)->grep(sub { $_ !~ qr/temp/ })->each;'
22:59 punter joined #mojo
23:00 jberger I think that can be done inside a single selector
23:02 jberger perl -Mojo -E 'x(q[<root><div id="foo">hi</div><div id="bar">bye</div></root>])->find(q[div:not(#foo)])->each(sub{say})'
23:02 jberger or if it weren't id
23:03 jberger or better yet, a not starts with
23:03 gtodd hmm the :not bit didn't seem to work earlier ... will try again ...  but I thought maybe I could use/write something like ->not(qr//)
23:04 jberger perl -Mojo -E 'x(q[<root><div id="foo1">bad</div><div id="bar">good</div></root>])->find(q[div:not([id^="foo"])])->each(sub{say $_->text})'
23:04 jberger no, :not is a selector
23:04 jberger so it gets excluded during the search
23:06 jberger http://mojolicious.org/perldoc/Mojo/DOM/CSS#E:not-s
23:06 gtodd OK ... now I see that early I wrapped the whole thing  ->find(q[:not(div#secondary])
23:06 gtodd errm temporary
23:08 PryMar56 joined #mojo
23:10 gtodd anyway I thought of writing a collection of method/subroutine e.g.  ->not()  or ->filter()  to avoid making mistakes
23:12 bpmedley sri: I'm confused; with respect to issue #980.  Isn't Mojo::URL::authority used in lots of places and also Mojo::URL->userinfo?  For example, Mojo::Message::Request::fix_headers.  Also, the test suite seems to use authority and userinfo quite a bit.
23:19 odc joined #mojo
23:25 sri bpmedley: tests are irrelevant
23:25 sri and no
23:27 bpmedley sri: Should the userinfo attribute and authority sub be removed completely?
23:27 gtodd jberger: it doesn't seem to work ... but I get the principle so thanks ;-)
23:29 sri bpmedley: why remove userinfo>
23:29 sri s/>/?/
23:29 * sri is confused
23:31 bpmedley Ok, I think I see the issue now.  You want to remove the automated processing of userinfo and give the user the ability to set userinfo themselves.  Is that correct?
23:32 sri bpmedley: sorry, you seem to completely misunderstand the issue, and i don't have time to explain
23:36 sri is that issue really so confusing? should i remove it again?
23:36 marty joined #mojo
23:36 marty joined #mojo
23:36 bpmedley Just a sec, give me around 30 mins please.
23:41 meshl joined #mojo
23:43 jberger gtodd: what isn't working?
23:48 preaction bpmedley: the userinfo is still in there, but it shouldn't be inadvertently leaked by stringifying the URL. it could be sensitive. it's a literal password in there. so, since the only difference between ->host_port and ->authority is the un:pw bit, and if you remove the un:pw bit, there's no need for authority to exist at all

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