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

IRC log for #mojo, 2016-07-18

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

All times shown according to UTC.

Time Nick Message
00:20 kid51 joined #mojo
01:08 cpan_mojo Mojolicious-Command-generate-controller-0.01 by DVINCI https://metacpan.org/release/DVINCI/Mojolicious-Command-generate-controller-0.01
01:33 dvinciguerra joined #mojo
02:10 ivi joined #mojo
02:23 kid51 joined #mojo
02:39 lluad joined #mojo
02:42 noganex_ joined #mojo
02:43 dvinciguerra_ joined #mojo
03:17 cpan_mojo Mojolicious-Command-generate-controller-0.02 by DVINCI https://metacpan.org/release/DVINCI/Mojolicious-Command-generate-controller-0.02
03:45 kaare joined #mojo
05:10 ningu joined #mojo
05:29 anton joined #mojo
06:00 Lee joined #mojo
06:07 Vandal joined #mojo
06:43 dod joined #mojo
06:48 dod joined #mojo
07:07 AndrewIsh joined #mojo
07:10 dod joined #mojo
07:18 trone joined #mojo
07:31 trone joined #mojo
07:47 * batman is back from vacations
07:47 batman i'm completely lost, so i think i had a successful vacation :-)
07:48 ningu I didn't know batman took vacations
07:49 batman that's why i have a sidekick :)
07:56 Jonis :)
07:58 batman coolo: so... i guess this is a bit late, but about the favicon: i'm not sure why you want to use assetpack for that. it should be rather small already
07:59 batman it's not simple, but it's possible to generate an URL to the asset, which you could combine with <link rel="shortcut icon" type="image/x-icon" href="<%= ... %>">
07:59 batman is that what you want?
08:01 batman sorry. bad copy/paste about the <link> tag, but i think you get what i mean :-)
08:01 batman i've been away for too long...
08:15 coolo batman: the main reason why I want it as an asset is to have it in a) in assets/ too and kill public/ and b) have it served with proper expire headers
08:15 coolo batman: the reason I asked was because I've seen it fetched with 304 all the time
08:17 batman coolo: how to do you serve it now? can i see your html?
08:19 batman one thing is that browsers are extremely eager to cache favicons, so even if you change the url, the browser might not download the new asset :/
08:21 coolo batman: https://openqa.opensuse.org
08:21 batman i can't remember all the details, but googling "favicon caching " gave me this http://stackoverflow.com/questions/2208933/how-do-i-force-a-favicon-refresh
08:21 coolo source code https://github.com/os-autoinst/openQA/blob/master/templates/layouts/bootstrap.html.ep
08:22 coolo (slightly outdated deployment)
08:23 batman i don't see any <link rel="icon" ... > tag in that markup
08:28 coolo <link rel="icon" is below the initial <script>
08:29 coolo line 33 here
08:29 coolo (as in view-source:https://openqa.opensuse.org/)
08:31 batman weird! i wonder why i didn't spot that... anyway... here's what you can do:
08:32 batman href="<%= url_for assetpack => asset->processed("whatever.png")->[0]->TO_JSON %>"
08:33 coolo now that looks obvious :)
08:34 batman i don't really want to add $c->asset->url_for() helper, since it has to return an array ref of URL objects ...
08:34 batman yeah, i understand that it's not really obvious :/ please let me know if it works, and how+where to document it
08:35 batman here is the code: https://metacpan.org/source/JHTHORSEN/Mojolicious-Plugin-AssetPack-1.16/lib/Mojolicious/Plugin/AssetPack.pm#L190
08:38 * coolo is getting "Can't use an undefined value as an ARRAY reference at template layouts/bootstrap.html.ep line 38" - I assume this means assetpack has no knowledge about this png
08:41 batman are you sure you replaced "whatever.png" with the right topic?
08:42 jamesaxl joined #mojo
08:42 coolo yes, but I didn't define that topic :)
08:42 batman then how did you expect it to work..? :/
08:43 coolo batman: magic? it's perl!
08:43 batman ...
08:45 Dandre left #mojo
08:46 coolo ok, works
08:47 batman cool. i'm creating some new methods now to make your life easier... (i think)
08:56 cuechan joined #mojo
08:57 coolo batman: https://github.com/os-autoinst/openQA/pull/789
08:57 coolo batman: possibly you can create trivial topics on the fly?
09:01 batman you mean define topics based on the markup?
09:04 batman coolo: i'm going to have lunch, but please comment on https://github.com/jhthorsen/mojolicious-plugin-assetpack/commit/341904047a2631f686f590bdbf9a81207918bc85
09:04 batman also, i'm not going to define assets based on the markup. i have many people wanting it, but i don't see how that's possible without breaking apps by accident.
09:04 batman i think i should make a FAQ :-)
09:06 batman s/markup/template/
09:46 punter joined #mojo
10:16 coolo batman: about time to put mojo on https://en.wikipedia.org/wiki/Convention_over_configuration ;)
10:19 batman hehe :)
10:19 batman coolo: did you look at the git commit i made? do you find it useful?
10:20 coolo batman: I looked at it, but I don't know how to make use of it - beside simplifying my own helper a bit
10:21 batman yeah, that was the whole idea. any better ideas? if not, i'll just revert it
10:21 coolo but it will help to promote the possibility into the documentation
10:22 coolo https://github.com/os-autoinst/openQA/pull/789/files#diff-1ee28d097e9d998346605fc6e455d337L3 is quite sexy IMO
10:23 cuechan joined #mojo
10:25 batman sorry. i don't follow.
10:26 coolo batman: I can't be the only one referencing icons in templates - and wanting the browser refresh if the icon changes
10:29 coolo and if you come from a rails world, you look at assetpack for a solution
10:30 batman i wouldn't know :)
10:31 batman but... i might be missing out on something, but i don't see that you have answered my questions.
10:31 batman so guess i'll just revert the change then
10:33 dotan joined #mojo
10:33 coolo well, your commit doesn't help me at this point - and I can't think many will have the need for the solution you present the helper for
10:34 coolo but I still think that promoting assetpack to use for trivial assets like icons should be done
10:42 batman coolo: i have no solution for that, but eager to hear your proposal.
10:45 coolo batman: how about in Tutorial.pod's 'Asset objects' another example
10:46 batman but the code i gave you sucks. it's way too complicated :(
10:46 batman it should be something like this: %= asset "icon.png" => {fav icon => 1}
10:46 coolo %= image sub { asset->processed('logo.svg')->url_for }
10:47 batman how does image() help?
10:48 coolo batman: well, all I want to achieve is expressing that you can reference assets in templates outside of <header>
10:48 coolo aehm, <head/>
10:48 coolo because all your documentation rotates around that
10:48 batman <head> has nothing to do with it. you can use asset() wherever you like
10:49 batman what you want is to generate something else than a <img> tag for images. you want a <link> tag
10:49 coolo http://guides.rubyonrails.org/asset_pipeline.html#coding-links-to-assets
10:50 coolo batman: but I didn't know that - and looked through your documentation.
10:50 coolo and I suppose the reason why I didn't know is that my expectations were different
10:51 batman didn't know what?
10:51 coolo that I can use asset() in place of image()
10:51 batman oh. what did you expect if you did <%= asset "foo.png" %> ?
10:52 batman generating a <script> or <link rel="stylesheet"> tag for that wouldn't make much sense :-)
10:52 coolo batman: I didn't even consider doing that - and I can't find any reference to pngs in tutorial and cookbook
10:53 coolo actually I was wondering before why you have png pipes - and thought it's about the pngs downloaded
10:53 batman did you read the documentation for the png and jpeg pipes?
10:54 coolo batman: taking that I didn't have use for them - no
10:54 batman i'm very confused :(
10:54 coolo and http://search.cpan.org/~jhthorsen/Mojolicious-Plugin-AssetPack-1.16/lib/Mojolicious/Plugin/AssetPack/Guides/Tutorial.pod#Pipes doesn't even list/link them - or their uses
10:55 batman oh! that's awful. will fix that now.
10:56 coolo batman: you know about your classes, but I only know the tutorial and the cookbook
10:56 coolo and nothing in that makes me think I can use asset 'logo.png'
10:56 tchaves joined #mojo
10:57 batman no. i totally get that after you told me that the pipes aren't listed in the tutorial :(
10:57 batman do you think i should add an example to the cookbook as well?
10:59 coolo batman: for the favicon possibly.
10:59 coolo hah! now that I *do* use asset('logo.svg' => (alt => 'openQA') in the template
11:00 coolo I get <link alt='openQA' rel='stylesheet'
11:00 coolo now i'm lost :)
11:00 batman yeah, there's no svg pipe.
11:00 coolo now I go back into the documentation ;)
11:00 batman only png and jpeg
11:01 coolo ok, then I better stay with my complicated helper :)
11:02 coolo but I tried
11:03 coolo there is nothing to preprocess about it, all I care about is the hash in the url
11:03 batman right. i can add a "dummy" class for that
11:11 tchaves joined #mojo
11:14 cuechan joined #mojo
11:17 batman coolo: i got an idea: if the "topic" is favicon.ico, then i will render it as <link> tag instead of an image.
11:18 batman i'm not sure if i like it, but it's not *too* bad...
11:19 ningu joined #mojo
11:19 coolo batman: convention over configuration ;)
11:23 batman please be more specific in your replies. my brain simply doesn't compute that answer :(
11:23 batman it might be partially because of vacations, but mostly it's just me...
11:56 marty joined #mojo
12:06 kid51 joined #mojo
12:06 Kripton joined #mojo
12:13 perlpilot joined #mojo
12:14 cuechan joined #mojo
12:24 jamesaxl joined #mojo
12:40 Kripton joined #mojo
12:42 CW joined #mojo
12:43 Kripton joined #mojo
12:50 dvinciguerra_ joined #mojo
12:56 Kripton joined #mojo
12:59 batman coolo: i think you will like this one: https://github.com/jhthorsen/mojolicious-plugin-assetpack/commit/3fa3db36de5a93954ed9a825da953937ec8a76de
12:59 batman feedback wanted ^^
13:01 gizmomathboy joined #mojo
13:03 vicash coolo: to embed an SVG into HTML using Mojo, I slurp the contents of the SVG and display it in the template directly. it just works this way
13:05 batman Interesting... This version of AssetPack will allow you do that as well. Just override the tag_for attribute.
13:08 vicash batman: did not know about assetpack plugin. looks interesting.
13:09 zivester joined #mojo
13:11 batman :)
13:13 punter joined #mojo
13:22 cpan_mojo Mojo-Weixin-1.1.6 by SJDY https://metacpan.org/release/SJDY/Mojo-Weixin-1.1.6
13:27 Kripton joined #mojo
13:30 Kripton joined #mojo
13:34 coolo batman: cool!
13:35 batman \o/
13:35 batman coolo: i'm looking into creating a Favicon pipe now...
13:36 batman coolo: anything missing?
13:51 cuechan joined #mojo
13:54 neilhwatson joined #mojo
14:14 kes joined #mojo
14:20 ptolemarch joined #mojo
14:43 ningu joined #mojo
15:01 zivester joined #mojo
15:39 punter joined #mojo
15:40 punter jberger, I wrote a github issue: https://github.com/jberger/Minion-Notifier/issues/2
15:40 punter I hope I didn't break any rules
15:44 blonewolfs joined #mojo
16:09 lluad joined #mojo
16:15 jkramer joined #mojo
16:15 jkramer Ahoy!
16:16 jkramer Is there a way to inject new steps into a delay while it's running or go back to an older step?
16:17 jkramer Or maybe make a step loop somehow, idk. :)
16:17 rubes joined #mojo
16:19 rubes Hi, I'm trying to use mojolicious as a reverse proxy and using Mojolicious::Plugin::Proxy for that
16:19 rubes the only problem is that static files that have absolute path dont work correctly
16:19 jkramer I'm basically trying to fetch data asynchronously with paging. step 1: fetch some data, step 2: check the result. The result includes information if there's more pages to fetch, so I'd have to optionally repeat step 1 before proceeding to step 3.
16:20 rubes so I added a before_dispatch hook but I dont know how to return static files from the hook
16:20 rubes any help ?
16:20 dotan jkramer: I wrote something that submits a query, gets a job id and repeatedly calls a url to check the status of the job until it's done, then continues to the next step
16:20 rubes the hook checks for the referrer and if the path matches something like /proxy/ then it checks if it exists in certain folder and then I try to return the asset but nothing I do seems to work
16:21 dotan it's a little tricky
16:22 jkramer dotan: Yeah I figured as much. :) Do you have a sample somewhere online?
16:23 dotan Let me put the uncompromising parts in a gist, just a sec
16:23 jkramer dotan: Thanks :)
16:33 dotan jkramer: https://gist.github.com/dotandimet/495249522e22405a7d0b729cabacce09
16:37 dotan Line 55 passes the delay->begin callback to a wait_job method, which passes it to a check_job_state method, which returns a sub that either calls wait_job again (if it's still waiting) or calls the original $delay->begin callback with the error or result.
16:37 dotan whew
16:42 dotan Mojo::IOLoop::Delay is more about linearizing nested callbacks (unspooling callback hell?), it doesn't let you build a general state machine
16:44 dotan but if you hang on to the callback that $delay->begin returns, you can run some other IOLoop stuff (like timers) and return back to the delay's steps when you're done.
16:44 cpan_mojo Mojolicious-Plugin-AssetPack-1.17 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/Mojolicious-Plugin-AssetPack-1.17
16:45 batman jkramer: just store all the @steps in an array and push them back to @{$delay->remaining} when you feel like it
16:45 batman coolo ^^^ i've added experimental Pipe::Favicon as well now. not exactly what you wanted, but i think it's much more powerful...
16:52 dotan batman: you just blew my mind
16:57 dod joined #mojo
16:59 punter Is Minion::Backend::SQLite recommended for a production site?
17:00 punter (asking because it's only v0.005)
17:00 Grinnz_ it is stable if that's what you mean
17:01 Grinnz_ I should probably bump that up to 1.000 next release, sure
17:01 punter thanks Grinnz.
17:01 punter Are you dbook?
17:01 dotan rubes: in before_dispatch you can rewrite the request URL path so that it matches a static file in the default paths
17:01 Grinnz_ now, whether you should use a sqlite database in production is another question :)
17:01 Grinnz_ yes
17:02 punter Grinnz_, what's bad about using it in live production system?
17:02 punter Grinnz, what can go wrong?
17:02 punter my traffic is low
17:02 Grinnz_ being file-based, it doesn't scale well (though better than some others)
17:02 punter ok, that's no problem for me
17:03 punter does it lock? i mean when two workers attempt to start a job, is there a chance they'll both start the same one?
17:05 Grinnz_ it does have good transaction and locking support
17:05 punter thank you!
17:09 disputin joined #mojo
17:11 rubes @dotan, how would I do that
17:11 rubes I tried $c->req->url->path("/staging" . $c->req->url->path );
17:11 batman dotan: :)
17:14 dotan rubes: what does ->path contain after that? You could print it to a log with $c->app->log->info(...)
17:17 dotan it looks like it should be the right path
17:18 dotan But can your app serve /staging/... ? Is it inside public?
17:18 punter Where's the wiki page that says what important breaking changes have happened from version to version?
17:18 cuechan_ joined #mojo
17:18 punter i can't find it here: https://github.com/kraih/mojo/wiki
17:21 Grinnz_ https://github.com/kraih/mojo/wiki/Upgrading
17:21 punter thanks
17:24 jberger punter: thanks, I'll take a look
17:27 kid51 joined #mojo
17:29 jberger Also I've never especially liked modifying the remaining steps while running, I've preferred (and it sends to produce better code) to break it into pieces and "recurse"as needed
17:29 jberger Until whatever thing you are trying to do is finished
17:30 jberger I put recuse in quotes because it is usually not actually recursing but trampolining
17:31 coolo batman: sorry for all the trouble I caused you today ;)
17:35 zivester joined #mojo
17:41 batman coolo: yeah... i kind of wasted my own time, but it was nice looking at the assetpack code again. i think it's much better than the 0.x series
17:41 batman coolo: not even sure you wanna use the service, haha
17:42 batman but either way, if you wan to submit a PR, where it doesn't use realfavicongenerator.net but rather just finds the icon files, then go crazy
17:43 batman coolo: just to be clear: don't be sorry at all. i want to use the new pipe myself... some day :)
17:44 batman and thanks for letting me know there was missing documentation
17:45 batman and i think it's really cool that you don't need public/ anymore (at least for most cases)
18:00 marty joined #mojo
18:01 marty_ joined #mojo
18:09 dvinciguerra_ joined #mojo
18:12 rubes joined #mojo
18:40 PryMar56 joined #mojo
18:40 disputin joined #mojo
18:41 dod joined #mojo
18:43 punter joined #mojo
19:07 sri wonder if we'll get the release announcement upvoted on HN again this year
19:13 marcus https://uproxx.files.wordpress.com/2015/12/pinky-and-the-brain-animaniacs-opening.gif?w=650&amp;h=378
19:47 punter I believe I've found a bug in Minion's documentation.
19:47 punter Documentation of https://metacpan.org/pod/Minion#remove_after says: "jobs that have reached the state finished and have no unresolved dependencies". But jobs that have reached the state finished cannot have unresolved dependencies.
19:51 itaipu joined #mojo
19:57 Grinnz_ https://github.com/kraih/mojo/wiki/Upgrading has been updated to 6.66
19:58 sri Grinnz++
19:58 jberger Grinnz_++
19:58 sri 7.0 should be final now, i'm preparing the announcement as we speak
20:00 rubes joined #mojo
20:01 punter joined #mojo
20:03 Grinnz_ I have never seen so many +1 posts :) https://github.com/isaacs/github/issues/215
20:03 Grinnz_ maybe that's why they added the reactions!
20:08 Grinnz_ (for the actual feature: https://github.com/github/markup/issues/904)
20:19 Grinnz_ I think it would be correct to say that remove_after's description is referring to dependent jobs and not dependencies, re: punter
20:21 punter Grinnz, so you believe this is a mistake in the documentation too, right?
20:21 Grinnz_ Yes, repair does not check dependencies with respect to remove_after
20:25 rubes joined #mojo
20:37 marty joined #mojo
21:00 meshl joined #mojo
21:14 pink_mist http://www.theregister.co.uk/2016/07/18/httpoxy_hole *hope mojo's not vulnerable*
21:15 marcus epoxy hole?
21:17 Grinnz_ https://metacpan.org/pod/Mojo::UserAgent::Proxy#detect only if you set MOJO_PROXY=1 or call proxy->detect, i think
21:18 sri and use CGI
21:19 pink_mist right
21:25 itaipu joined #mojo
21:43 mishanti1 So, Mojo now looks for controllers in MyApp::Controllers::Foo only? I'm working on porting an application from 3.97 to 6.66.
21:46 jberger mishanti1: you can change that if you like http://mojolicious.org/perldoc/Mojolicious#routes
21:47 stephan48 there is a method to get/set the search path
21:47 stephan48 jberger++
21:47 mishanti1 jberger, stephan48 : Thanks. :) That seems like what I'm looking for.
21:47 stephan48 good night :D
21:47 stephan48 or day
21:47 mishanti1 nite!
21:53 sri ok, release announcement almost finished
21:53 jberger still morning here (for another few minutes)
21:55 marcus I'm drunk after watching 3 episodes of my wife's new favorite series
21:55 marcus (Younger)
21:56 sri i really want to watch stranger things, the new netflix show
21:56 sri supposed to be amazing
21:57 pink_mist marcus: 0_o you had to swig some strong ones to get through it? :p
21:57 marcus pink_mist: it's like sex and the city for older women :D
21:57 pink_mist lol
21:58 marcus sri: started first episode of stranger things now
21:59 Grinnz_ I thought you said Voyager, and was a bit confused
21:59 sri lol
22:00 sri voyager is like ds9 for older women
22:00 pink_mist heard they're finally in the process of making new star trek series btw
22:00 sri yea, we need a new ds9!
22:00 Grinnz_ we can hope
22:07 marcus for older men
22:23 good_news_everyon joined #mojo
22:23 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vKwvf
22:23 good_news_everyon mojo/master 68a3079 Sebastian Riedel: release preparations
22:23 good_news_everyon left #mojo
22:31 sri guess i'm ready
22:32 sri not sure what time to pick
22:32 Grinnz_ 6:66... wait
22:32 sri tuesday is the best day for a release, but need a time when the most people are awake
22:33 sri so we can make an attempt at HN frontpage
22:33 sri ;p
22:37 good_news_everyon joined #mojo
22:37 good_news_everyon [mojo] kraih tagged v7.0 at 7113fd6: https://git.io/vKwJg
22:37 good_news_everyon left #mojo
22:39 rubes joined #mojo
22:40 jberger I don't know if now is the time, we certainly can't compete with the likes of Net-FullAuto-1.0000202
22:40 jberger :-P
22:41 jberger (mocking that module is less fun since he finally ran out of 9s)
22:44 * jberger anxiously hits the refresh button on metacpan recent
22:47 sri bad time, guess i'll have to wait like 12 hours
22:50 Vitrifur joined #mojo
23:05 rubes joined #mojo
23:12 jberger Midnight europe, after work US (mainland)
23:20 rubes joined #mojo
23:29 good_news_everyon joined #mojo
23:29 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vKwtK
23:29 good_news_everyon mojo/master 409ad44 Sebastian Riedel: bump version
23:29 good_news_everyon left #mojo
23:58 meshl joined #mojo

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