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

IRC log for #mojo, 2018-01-11

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

All times shown according to UTC.

Time Nick Message
00:10 marty joined #mojo
01:08 mib_y8w3u6 joined #mojo
01:09 aborazmeh joined #mojo
01:50 schelcj joined #mojo
02:16 aborazmeh joined #mojo
02:17 FROGGS joined #mojo
02:29 itaipu joined #mojo
02:59 FROGGS_ joined #mojo
03:06 vicash maschine you would use Mojo::Asset::Memory to stream
03:08 vicash maschine: you would zip the data, add "gzip" to the header, add content-length and then use reply->asset(Mojo::Asset::Memory->new->add_chunk($zipped)) . the Mojolicious Cookbook has an example on how to stream chunks with or without Transfer-chunked-encoding
03:10 vicash maschine: you might still need Archive::Zip if you want to stream multiple files, but the concept is the same.. you can zip everything in memory and stream the memory blob using Mojo::Asset::Memory
03:12 noganex joined #mojo
03:34 Seth joined #mojo
03:35 purplecoffee joined #mojo
04:16 ghenry joined #mojo
04:39 aborazmeh joined #mojo
05:04 dboehmer_ joined #mojo
06:13 Vandal joined #mojo
06:58 dod joined #mojo
07:06 dod joined #mojo
07:25 McA joined #mojo
07:44 dod joined #mojo
07:48 CHYC joined #mojo
07:50 AndrewIsh joined #mojo
08:18 kes joined #mojo
08:27 trone joined #mojo
08:27 karjala_ joined #mojo
08:58 McA Good morning. Can someone point me in the right direction where to change the response header 'Server:' for a mojolicious app?
09:00 inokenty-w joined #mojo
09:03 itaipu joined #mojo
09:04 CandyAngel McA: It gets set in Mojo::Server::Daemon.. https://github.com/kraih/mojo/blob/c3b309d21113229181dfc5439a177d453dbc8665/lib/Mojo/Server/Daemon.pm#L79
09:05 CandyAngel So I think you would need a hook to change it
09:05 CandyAngel after_build_tx perhaps?
09:06 CandyAngel Or after_dispatch, which specifically says: "Useful for rewriting outgoing responses and other post-processing tasks"
09:14 itaipu joined #mojo
09:39 McA @CandyAngel: Thank you. I'll have a look
09:59 dotan_convos joined #mojo
10:22 McA If someone has a Mojolicious git repository under his/her fingers than he could change the following documentation bug: http://mojolicious.org/perldoc/Mojo/Template#SYNTAX
10:22 McA In the first code box the eplanation for <%= %> and <%== %> is changed.
10:24 itaipu joined #mojo
10:25 CandyAngel Nice spot! I'll send in a PR to fix it
10:33 McA Thank you.
10:43 CandyAngel Oh wait.. that.. might not actually be wrong
10:46 pink_mist the first section says one thing, and the very next section says the absolute opposite
10:46 pink_mist _one_ of them must be wrong
10:47 pink_mist I am under the impression that the first section is mistaken there
10:47 pink_mist s/section/code box/g
10:48 pink_mist McA++
10:49 pink_mist the third code box also implies that <%= %> is the one that escapes
10:49 pink_mist (except for Mojo::ByteStream objects)
10:52 CandyAngel It says the opposite because auto_escape is set, which reverses the behaviour
10:53 pink_mist oh you're right, it does say that ... why is that a thing? 0_o
10:54 pink_mist I never even noticed that until now, and have been relying on <%== %> not XML-escaping for years
10:54 CandyAngel And the third box uses the %= because that is the escaping one, because that would be in .ep template where auto_escape is set..
10:55 pink_mist it should clarify that then
10:55 pink_mist because it's not apparent
11:01 itaipu joined #mojo
12:06 tchaves joined #mojo
12:25 tyldis I need a drink. What on earth am I doing wrong here? https://gist.github.com/tyldum/2e4a2d37c29856d1599bbc8c29c35aea
12:29 CandyAngel tyldis: You're stringifying the promise?
12:32 tyldis I want the bloody res->code returned
12:32 tyldis As a rersolve of the promise
12:35 tyldis Is the only resolve to have a variable scoped outside the promise and return that?
12:37 CandyAngel Aren't you supposed to do what you need in the ->then bit?
12:38 CandyAngel Or in 'finally'
12:47 tyldis I swear I saw examples online that did this exact thing.
12:50 CandyAngel I don't see anything in Mojo::Promise that shows how to get the result of a promise :|
12:52 tyldis https://www.reddit.com/r/perl/comments/7hya5q/mojolicious_wrapping_mojouseragentget/
12:52 tyldis Grinnz says it can!
12:53 tyldis I tried that double return also, without luck.
12:56 CandyAngel I don't think that is what Grinnz is saying
12:57 CandyAngel He is returning the promise, so whatever called 'fetch' could add another ->then, to do whatever
12:57 CandyAngel So like..
12:57 purl well, so like is case insensitive ?
12:57 CandyAngel fetch()->then(sub { ... })
12:58 tyldis I need to work more onthe layout to make it more testable
12:59 tyldis Which is what brought me down this rabbithole. But returning anyhting but a promise will be an antipattern, I guess
13:04 CandyAngel Sure, because then you are writing blocking code, rather than non-blocking
13:20 purplecoffee joined #mojo
13:25 sri pink_mist: that is a thing because people don't like breaking changes
13:26 sri why do you thing we have EPRenderer and EPLRenderer plugins?
13:26 sri s/g/k/
13:26 sri that said, Mojo::Template is used to generate other stuff than HTML
13:27 sri its first use was actually https://github.com/kraih/mojo/blob/master/lib/Mojolicious/Command/generate/app.pm#L116
13:28 sri this might come as a shock to you, but not all of this stuff was designed like that from the start, it evolved over time
13:28 sri and people used the old things, like .epl templates and didn't want for us to break that
13:29 Ya_ALLAH_Ya_Muhmd joined #mojo
13:29 Ya_ALLAH_Ya_Muhmd left #mojo
13:29 sri just because i thought there was a better ay to do templating... (which is now mainstream .ep templates)
13:29 sri s/ay/way/
13:31 Ricaz left #mojo
13:31 Ricaz joined #mojo
13:31 sri tyldis: your gist is gone
13:35 sri CandyAngel: the only way to get the result of a promise is in a ->then callback
13:35 sri or ->finally
13:38 CandyAngel Thought so :)
13:41 tyldis sri: Yeah. What I was trying to do doesn't make sense and was ultimately an antipattern
13:41 tyldis Ending the promise chain inside a sub is just silly.
13:42 tyldis And looking at the testts for Mojo::Promise I was inspired on how to properly test them, so my problem went away :)
13:45 Ricaz So I made a regular Perl module (class) that I would like to use in Mojo. I've been told a Plugin is the best way to do this - but what is the best way to expose this class in the plugin?
13:48 Ricaz left #mojo
13:48 Ricaz joined #mojo
13:50 bwf joined #mojo
13:55 Ricaz left #mojo
13:55 Ricaz joined #mojo
14:27 marcus Ricaz:  What kind of module?
14:28 Ricaz my IRC client is messing up I think
14:28 Ricaz can you repeat that message?
14:28 marcus Ricaz: what kind of module is it?
14:28 marcus What are you using it for in your application/
14:29 Ricaz what do you mean 'kind'? It's a class, I'm gonna be using it to do some external authentication
14:29 Ricaz It can check username/password against an AD server and sync that to a file
14:30 ChmEarl joined #mojo
14:31 marcus Ricaz: Does it need any configuration? If so probably just set it up in a helper in your startup method, otherwise just use it directly in your controller class?
14:31 marcus or write a helper in a plugin if you're going to use it in more than one app.
14:31 Ricaz So using a helper would make the most sense? What if I just need to use it in one controller?
14:36 Ricaz marcus: I can configure it when I initialize it from the plugin
14:38 Guest69 joined #mojo
14:39 sri see how the model classes are integrated into the blog example app https://github.com/kraih/mojo-pg/tree/master/examples/blog
14:41 kes joined #mojo
14:41 sri alternatively, an instance of your class can always be a property of the app ($c->app->foo)
14:42 kes hi.
14:43 kes Interesting case: the mojo report that templates was not found but still renders content right
14:43 kes http://paste.scsys.co.uk/566350
14:43 maschine I got a streaming zip file to work (thanks vicash - I was close, but wasn't using Mojo::Asset::Memory)
14:43 kes here is ';' sign missed after 'layout'
14:44 maschine ended up using Archive::Zip::SimpleZip because it supported output to a string reference
14:45 Pyritic joined #mojo
14:45 maschine now to figure out why the zip archive is munging the linebreaks in my text files :p
14:46 exp-innit imho munging line-ends is normal, you should embrace it and normalise line-ends on input if it is important to you
14:47 purplecoffee joined #mojo
14:47 jacoby joined #mojo
14:50 maschine not sure how to do that - it is important though :)
14:54 exp-innit maschine: if you can describe your problem, poeple can offer advice
14:55 exp-innit re: mojo, i've installed mojo.vim and it's setting syntax=ep, but no highlighting is being done whatsoever (in an .html.ep file)
14:55 exp-innit is it known to be broken? :)
14:56 maschine it's something to do with windows line breaks - \r\n vs \n
14:57 exp-innit maschine: if you're accepting text files, this is a common ocurrence
14:57 maschine the file I'm compressing is set up for windows (and works ok when you download it directly) but when it's zipped it loses the \r (I believe)
14:58 maschine actually, it will still work for the intended purpose, but if a user opens it it will not look right
15:01 gryphon joined #mojo
15:07 maschine interesting - if I use Mojo::Asset::Memory to generate two of the files, the linebreaks are fine - but if I use Mojo::Asset::File, it breaks.. which is strange, because I was using Mojo::Asset::File to stream it before and it was fine.
15:08 jabberwok joined #mojo
15:13 exp-innit maschine: i don't know much about mojo's line-end normalisation, but if you explicitly needs windows line-ends in the output
15:13 exp-innit instead of preventing mangling, you should adopt the strategy of rewriting line-ends on output
15:13 exp-innit the reason i say that is that there are several different line-end standards, and tools behave inconsistently with them
15:17 maschine yeah - the good thing is, this is only a temporary requirement, so it doesn't have to be pretty
15:25 maschine is github down?
15:25 purl yes
15:25 Jonis yep
15:26 Jonis ignore purl :)
15:26 exp-innit purl was right
15:26 purl exp-innit: excuse me?
15:26 exp-innit you heard
15:33 CandyAngel botsnack
15:33 purl thanks CandyAngel :)
15:37 exp-innit fixed
15:40 maschine they seem to have a lot of outages
15:51 pink_mist https://status.github.com/messages 23 minutes today, 6 minutes yesterday, and before that no actual outage since july? not that bad I'd say
15:53 exp-innit pink_mist: yet when I looked at that site minutes ago, it showed errors for a week+ beforehand
15:56 Pyritic joined #mojo
15:56 haarg yeah, status page seemed to be having some issues
16:00 maschine http://bit.ly/2qZiibF - working zip streaming example :)
16:01 haarg https://gist.github.com/bimmerlabs/70460319be1c4aa235046ed6399f57f8#file-myapp-pl-L27 probably better as Archive::Zip::SimpleZip->new(\$zipfile)
16:02 bc547 joined #mojo
16:03 maschine yeah I just copied that from their documentation
16:09 maschine that does look cleaner :)
16:11 maschine the only thing I'm not sure of is if I need the content-length header like vicash suggested
16:11 maschine it seems to work fine without it
16:29 CandyAngel Sadtimes. Found out I could get a server from IT.. but Windows only, so totally useless -.-
16:29 haarg what were you thinking of doing with it?
16:30 CandyAngel using Minion
16:33 CandyAngel Well, and Mojolicious
16:34 maschine if you can get Windows 10, i think it would work
16:34 maschine you can install windows linux subsystem - haven't tested it though, we have windows 7 here :(
16:35 CandyAngel It is Win8
16:37 maschine ew :p
16:38 maschine unfortunately it only works in windows 10
16:59 rick_soc1 joined #mojo
16:59 rick_soc1 hey jberger
17:00 jberger o/
17:03 marty joined #mojo
17:06 jberger can someone remind me the term for that routing feature that Catalyst has and Mojo doesn't
17:06 jberger something about canceling the route from a deeper function call
17:07 jberger I know it comes up from time to time
17:07 CandyAngel hey-bailing?
17:30 maschine what was it called where mojo would detect the file extension from a route so you could change the controller action?
17:31 maschine like get /:foo/:bar where :bar could be file.txt or file.zip as an example
17:33 jberger content negotiation
17:33 purl content negotiation is very difficult.
17:33 jberger shut it purl
17:33 * purl shuts it
17:38 maschine thanks
18:07 bwf joined #mojo
18:29 sh14 joined #mojo
18:30 chandwki joined #mojo
18:37 trone joined #mojo
18:47 rick_soc1 yawn
18:52 Seth1 joined #mojo
19:08 Pyritic joined #mojo
19:11 gryphon joined #mojo
19:11 jnbek joined #mojo
19:24 jamesaxl joined #mojo
19:25 ranguard hi, we're about to start our first mojolicious site.. smallish at the moment, but might grow, mostly going to be a OpenAPI thing.. I've seen the CpanTesters api repo.. anyother larger sized Mojolicious projects out there I can have a nosey at? - mostly interested in the dir/code structure rather than specific details
19:31 jberger ranguard: I don't know of too many full sites that are open source
19:31 jberger but have you looked at the Mojo::Pg example blog app?
19:32 jberger the structure there is basically the recommendation
19:32 jberger https://github.com/kraih/mojo-pg/tree/master/examples/blog
19:32 mohawk there's the openapi mojo advent calendar entry too
19:35 mohawk https://mojolicious.io/blog/2017/12/22/day-22-how-to-build-a-public-rest-api/
19:36 mohawk jberger, as soon as i've fixed a couple of gremlins revealed by using my convert plugin on the "swaggy jenkins" openapi spec, will you be receptive to effectively the long-referred-to part 2 of batman's article above?
19:36 mohawk ranguard, ^^
19:44 jberger mohawk: posts to mojolicious.io are always welcome
19:44 jberger the calendar is over (for this year) but the blog continues
19:45 jberger and I will be posting there too soon
19:54 mohawk banter
19:57 mohawk jberger, i'd really like to see comments enabled on it though
20:00 jberger :s yeah I don't love disqus though ...
20:00 jberger I wonder if there is an embedded reddit?
20:01 tyldis Facebook?
20:01 purl Facebook is a  social networking site used at most large universities or about 30% less annoying than myspace or too high friction to be really useful or http://photobucket.com/albums/w89/pickledpizza/facebook2.jpg or a high school reunion where you can weed out the losers.  Venue still sucks, though or failbook or assbook or a broken, glorified telephone
20:01 * tyldis ducs
20:02 ranguard jberger: mohawk thanks
20:02 jberger tyldis riiiiight
20:05 Grinnz *augh*
20:07 tyldis ;)
20:08 tyldis You can probably embed some hosted Sharepoint there.
20:08 tyldis Okay. I'll stop.
20:12 marty joined #mojo
20:22 berov joined #mojo
20:47 Leffe joined #mojo
20:57 maschine joined #mojo
21:55 perlpilot joined #mojo
22:01 Seth joined #mojo
22:27 marty joined #mojo
22:29 jacoby joined #mojo
23:02 Seth1 joined #mojo
23:06 CHYC_ joined #mojo
23:31 cromedome joined #mojo

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