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

IRC log for #mojo, 2015-06-17

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

All times shown according to UTC.

Time Nick Message
00:29 woz joined #mojo
00:29 punter joined #mojo
01:14 bpmedley_ joined #mojo
01:23 klapperl_ joined #mojo
01:27 absolut_todd joined #mojo
01:34 absolut_todd joined #mojo
01:46 thowe joined #mojo
01:52 zackiv31 joined #mojo
02:21 noganex joined #mojo
02:29 mmp joined #mojo
02:37 thowe are $config->{'things'} available in templates?
02:39 thowe $c->config->{'I_Guess'}
02:39 preaction <%= config 'things' %> perhaps?
02:57 hshong joined #mojo
03:11 bin_005 joined #mojo
03:31 Anon021 joined #mojo
03:40 woz joined #mojo
05:27 kaare joined #mojo
05:46 woz joined #mojo
06:03 marcusr sri: I'm neutral on the find_packages
06:52 woz joined #mojo
06:56 woz joined #mojo
07:04 AndrewIsh joined #mojo
07:05 eseyman joined #mojo
07:10 jnbek joined #mojo
07:12 Vandal joined #mojo
08:00 amon joined #mojo
08:15 trone joined #mojo
08:16 davido___ joined #mojo
08:37 bin_005 joined #mojo
08:55 dotan joined #mojo
09:11 arthas joined #mojo
09:13 bin_005 joined #mojo
09:18 icjs joined #mojo
10:01 amon joined #mojo
10:10 dp_ joined #mojo
10:19 bin_005 joined #mojo
10:20 HtbaaPi joined #mojo
10:35 davido__ joined #mojo
11:11 neilhwatson joined #mojo
11:31 ToApolytoXaos joined #mojo
11:41 HtbaaPi joined #mojo
12:56 ajr_ joined #mojo
13:23 zelda joined #mojo
13:25 zelda hello, I have a question: The code is here: https://github.com/borisdaeppen/School-Evaluation-Gibbmers/blob/master/web.pl  the Problem: I need to run the script on port 8443 - how do I do it? normaly I start it with "perl -Ilib web.pl daemon" but there I can't tell wich port. If I use "morbo" I can tell the port but not which libs to include.
13:25 zelda can = can't
13:29 q_gone joined #mojo
13:31 odc zelda, use the environment variable MOJO_LISTEN
13:31 odc it's in the docs
13:38 human39 joined #mojo
13:41 sri perl -Ilib web.pl daemon -h
13:41 sri do not use the environment variable
14:12 odc right
14:12 odc sri, and how do you set the port from inside the app?
14:13 odc i use %ENV >_>
14:17 zackiv31 joined #mojo
14:20 pink_mist BEGIN { push @ARGV, qw!-l http://*:8443! }
14:20 pink_mist (before you load any Mojolicious library)
14:21 jberger pink_mist: ewwwwwww
14:21 odc hah! that's genius
14:21 pink_mist jberger: it's not my fault Mojolicious needs to parse @ARGV the very first thing it does :X
14:23 jberger but then you can't use any other command
14:24 pink_mist you can put a check in there if the daemon command is being used
14:24 pink_mist implementation left as an exercise for the reader
14:24 sri -l is not parsed during startup
14:24 punter joined #mojo
14:28 dod joined #mojo
14:29 pink_mist oh, fair enough
14:33 dod joined #mojo
14:38 asarch joined #mojo
14:40 lluad joined #mojo
15:28 PryMar56 joined #mojo
15:44 mattastrophe joined #mojo
15:49 Kogurr joined #mojo
15:50 sh4 joined #mojo
15:58 shoorick joined #mojo
16:03 Grinnz_ joined #mojo
16:04 Repaster joined #mojo
16:04 shoorick Hi! Did somebody work with Mojolicious::Command::migration? I did read perldoc and didn't understand what can I do. And I googled no examples.
16:06 * shoorick will return in 1-2 hours
16:10 joelb joined #mojo
16:11 joelb I have a full app
16:11 joelb How do I set graceful_timeout?
16:11 joelb using morbo & hypnotoad
16:12 Grinnz_ set it in startup
16:12 joelb $prefork->graceful_timeout(60)
16:12 joelb how do I get $prefork?
16:12 Grinnz_ or set it in hypnotoad config, because it doesn't apply to morbo
16:13 joelb so graceful_timeout => 60 ?
16:13 Grinnz_ yea
16:13 joelb tahnks Grinnz_
16:15 sri haha, glad we added Mojo::JSON::to_json/from_json... because that's actually what Mojo::Pg needs :o
16:15 sri https://github.com/kraih/mojo-pg/commit/6dcc2a760634bfffc3a543af7e13ca1b6f2811bd
16:19 disputin joined #mojo
16:30 * jberger is not joelb btw
16:30 mst or 'joel'
16:31 * jberger optimizes himself away
16:31 jberger sri++
16:35 sri ETOOMANYJOELS
16:38 dod joined #mojo
16:39 jberger I'm sure that people with names like matt get used to it
16:39 jberger people with names like Joel never get accustomed to having others of the same name around
16:40 mst there's a couple social groups where people don't really remember I have a christian name
16:40 mst because there were already several Matts when I joined, so I just introduced myself as Trout
16:41 mattastrophe joined #mojo
16:42 spicyjack mst: is it the influence of the beer that makes them forget your christian name?
16:42 marcusr Everybody probably thought you have a satanic name, mst.
16:44 mst satanic?
16:45 marcusr mst: rather than a a christian one?
16:45 Grinnz_ isn't satanism really just part of christianity?
16:46 mst oh dear
16:46 marcusr according to wikipedia, Satanism is a broad term referring to a group of social movements with diverse ideological and philosophical beliefs.
16:47 Grinnz_ but satan is a christian belief :P
16:47 mst read a copy of LaVey's Satanic Bible sometimes
16:47 mst lovely little work of philosophy
16:47 marcusr Grinnz_: there's atheistic satanism, apparently.
16:48 Grinnz_ that's interesting
16:48 marcusr guess that's what mst is referring to, actually.
16:50 * marcusr managed to set up a fully redundant openshift origin platform today, with 3 nodes and a floating ip for the ha-proxy
16:51 marcusr well, it's been ongoing for a little longer than that, but we actually managed to get it work today :)
17:14 disputin joined #mojo
17:24 shoorick joined #mojo
17:28 dvinciguerra joined #mojo
17:29 shoorick Hello again!
17:29 shoorick I'
17:30 shoorick I'll repeat my question: Did somebody work with Mojolicious::Command::migration? I did read perldoc and didn't understand what can I do. And I googled no examples.
17:32 cpan_mojo Mojo-Pg-2.07 by SRI https://metacpan.org/release/SRI/Mojo-Pg-2.07
17:34 mad_hatter joined #mojo
17:35 mad_hatter Is there a way that you can change the css defined in a layout from a template? For instance, I have a template that uses a particular layout for the look and feel...but I need some of the css to be modified a little bit, but only for this particular template
17:44 shoorick cpan_modo: Thx, but Mojo-Pg is for PostgreSQL. I seek MySQL stuff. I did found Mojolicious::Command::migration — this module written for MySQL. Or there is another module for migration?
17:44 nic joined #mojo
17:46 nic mad_hatter: Read up on template blocks
17:49 jberger shoorick: cpan_mojo is a bot
17:49 jberger announcing releases
17:50 shoorick jberger: OK. I did think he answer me about migration :-)
17:50 jberger it was a little confusing
17:50 jberger for the record, no I haven't used that module, sorry
17:51 Grinnz_ Mojo::mysql or Mojo::MySQL5 have migrations support, though you have to be really careful with migrations in mysql (i believe those modules warn about that)
17:51 shoorick I wrote mail to author of Mojolicious::Command::migration — I hope he will answer
17:52 sri yea, when a mysql migration module doesn't warn you, that's when you have to worry
17:52 Grinnz_ i don't know anything about that command module
17:54 berov joined #mojo
17:55 batman did shoorick leave?
17:55 shoorick I'm here
17:57 batman ah. nice.
17:57 purl ah. nice. is that considered 'dual sport' ?
17:57 batman you can read the discussion about migrations and Mojo-mysql here: https://github.com/jhthorsen/mojo-mysql/pull/16
17:58 jberger purl forget ah. nice.
17:58 purl jberger, I didn't have anything matching ah. nice
17:59 jberger yikes that was a hard one to remove
18:00 mad_hatter nic: after reading the documentation mojo has on template blocks, I'm not sure how this can allow me to get at the css defined in the layout. Would I have to create some sort of function to import the css doc into the template?
18:02 shoorick mad_hatter: how about <link rel="stylesheet" href="path/<%= $some_condition %>.css"> in your template?
18:02 mad_hatter I mean I could simply define a new layout with new css..but this seems unnecessary as I only need to change a single div's dimensions
18:05 shoorick or, maybe
18:05 shoorick <link rel="stylesheet" href="path/to/base.css">
18:05 shoorick % if ( $condition ) {
18:05 shoorick <link rel="stylesheet" href="path/to/override.css">
18:05 shoorick % }
18:08 ajr_ joined #mojo
18:12 Britzel joined #mojo
18:16 stephan48 mad_hatter: you could look at content_for to override the css with another style block
18:21 jberger content_for, with an appropriate construction, can be used like that
18:21 jberger as stephan48 says
18:27 sri shoorick: please don't paste code here
18:28 shoorick sri: even one line?
18:28 purl somebody said even one line was 7 words
18:28 Grinnz_ that was 4 lines
18:29 Grinnz_ purl: forget even one line
18:29 purl Grinnz_: I forgot even one line
18:29 shoorick Yes, I saw four lines — there's no doubt.
18:34 _dave_ ETOOMANYDAVES is far more common =P
18:34 _dave_ there were six of us on the same hall at my first job out of college
18:38 * lb has always suffered a surplus of lars's
18:45 bin_005 joined #mojo
19:07 trone joined #mojo
19:12 mattastrophe joined #mojo
19:20 jonasbn joined #mojo
19:20 jonasbn hello, could anybody provide any good pointers or pointers to example applications using Mojolicious::Validation?
19:21 kaare joined #mojo
19:25 cfedde http://www.poetryfoundation.org/poem/171612
19:28 _dave_ heh
19:29 _dave_ So...is there an event that corresponds with an INT or TERM signal...or any event that I could use to do something when a mojolicious app is about to shut down?
19:31 cfedde you could use perl's END{  } block I suppose.
19:31 _dave_ hm, I'm not sure that will do what I need...I want to send a message to all connected websockets that the server is going away
19:32 _dave_ by the time I get to END{ } half of mojo might be gone
19:32 mst anything not in a global variable will be gone by then, certainly
19:32 jberger _dave_: these events do exist (graceful_shutdown) but I wonder what you are trying to do with them
19:33 jberger also, it only works as much as you are shutting down gracefully (and it doesn't time out)
19:33 mst I think have the websockets notice early rather than when their tcp connections disappear
19:33 _dave_ parse error?
19:33 purl parse error is not caused by missing files
19:33 mst _dave_: I mean, you understand you have to be able to handle the 'server went away suddenly' case -anyway-, right?
19:34 _dave_ I do yes, I'm trying to handle it nicely by sending a websocket message
19:34 mst why?
19:34 jberger _dave_: that seems like something you should just do from the close handler
19:34 mst what do you gain?
19:34 _dave_ just beofre it goes away
19:34 mst yes. why.
19:34 purl yes. why are you doing so?
19:34 jberger on the js side
19:34 mst stop repeating "I am doing X", that doesn't answer the question "why are you doing X?" :)
19:34 _dave_ well I can have the browser side print a message "the server has gone away"
19:34 _dave_ for example
19:35 jberger ws.onclose = function() { alert('server has gone away') }
19:35 cfedde but the browser can do that on its own.
19:35 cfedde what jberger said.
19:35 jberger much more robust than hoping that the server goes away nicely
19:35 mst _dave_: ...
19:35 _dave_ lol mst
19:35 mst you aren't listening to me at all, are you?
19:35 cfedde networks make state management messy.
19:35 _dave_ I actually am
19:36 mst ok, let me start again
19:36 lluad If you want additional status about why the server has gone away you'd need to have a graceful shutdown with a message from the server, and that'd need to be something more active than "server got killed".
19:36 _dave_ but understanding you? that may not be happening
19:36 mst 1. The server may go away suddenly, without time to send a warning message
19:36 mst 2. Therefore, you -must- handle that case
19:36 mst 3. ws.onclose would be a good way to do that
19:37 mst 4. Once you've already handled the 'no message before close' case ... I don't understand what you think adding a message will help with
19:37 mst and you keep dodging answering (4)
19:37 _dave_ ?
19:37 mst everything you've said so far is code that would need to be in the 'server went away suddenly' case
19:37 mst so I don't understand why you want to add an extra one
19:37 _dave_ ok...mst...please reread the time order of my comments here :) I suspect you have a packet that wasn't intended for you
19:38 mst none of your comments explain why having a graceful shutdown handler
19:38 mst will achieve anything that the non-graceful shutdown handler that you have to write anyway can't already do
19:38 mst so I keep asking what you think the graceful one can do that the non-graceful one can't
19:38 mst because if you can't answer that question, then the answer is to not bother with the graceful one :)
19:40 mst _dave_: so, what do you think the graceful one can do?
19:40 mst because if you don't have a specific use in mind
19:40 mst I'd focus on the 'server went away without warning' case first
19:40 mst since you have to deal with that anyway
19:41 _dave_ ok mst hold on :)
19:41 _dave_ I think your goal was to make me realize 1.
19:42 _dave_ and that logically leads to 3.
19:42 _dave_ and that handles all my cases :D
19:42 mst yep.
19:42 _dave_ I think, somehow, you think I said something earlier that I didn't say to you
19:43 _dave_ 1. is a smoking gun, I cannot do anything else but 3. usefully
19:43 mst actually, it was more a question of I'd assumed you'd already realised (1) and were imagining a bad answer to (4) but then not telling me it
19:44 _dave_ mst, I'm getting you're either a consultant or have to deal with a lot of less skilled developers :)
19:44 cfedde fish + barrel + smoking gun
19:44 mst also, it got confused at
19:44 mst 20:33 <@mst> _dave_: I mean, you understand you have to be able to handle the  'server went away suddenly' case -anyway-, right?
19:44 mst 20:34 < _dave_> I do yes, I'm trying to handle it nicely by sending a websocket  message
19:44 _dave_ yeah...when I say "parse error" it means I couldn't parse what you said
19:44 mst because that reply made absolutely no sense, and if I'd stopped to realise why your reply made no sense I'd've got it
19:44 mst but that's why I stopped and went point by point
19:45 mst "no idea how I fucked up explaining this, so start from the top" :)
19:45 jberger _dave_: yes, mst is http://shadow.cat/about/
19:45 _dave_ lol
19:45 mst and, yeah, I'm tech lead for http://shadow.cat/ - I've been doing CPAN consultancy/commercial support for 10 years now
19:45 jberger well spotted
19:45 _dave_ I had no idea who mst was until now lol
19:46 _dave_ though I tend not to pay much attention to identities these days, I should have guessed
19:46 jberger eh, we need not have meatspace respresentations :P
19:46 _dave_ good :)
19:47 mst well, mst is -one- of the people are shadowcat
19:47 _dave_ Mst, thanks much for your attempts to explain :D
19:47 mst mdk does all the business shit
19:48 mst and somehow still manages to be TPF marketing chair and LPW orga and have kids
19:48 mst I'm just chief geek
19:49 _dave_ so you run this irc server then?
19:51 mst about half the network, yeah
19:51 mst we worked out some years ago that it was more cost effective to host ircds than to deal with how much harder it was to get shit done if the network broke
20:05 oetiker joined #mojo
20:11 pink_mist hmm, I have a $id that I got from my $id = Mojo::IOLoop->client(...); ... and I wanted to $loop->remove($id) it after a timeout ... but sometimes it will have closed itself before the timeout, so I get an error: Mojo::Reactor::Poll: Timer failed: Can't call method "res" on an undefined value at ...
20:11 pink_mist is there a way to check if $id is in the loop?
20:12 Grinnz_ remove($id) wouldn't throw that error, it would just return false if it wasn't in the loop
20:12 pink_mist oh, wonder what's throwing it then
20:13 pink_mist let me try to reproduce in a small testcase
20:14 jberger pink_mist: you have to keep a strong reference to the transaction (server) or ua (client)
20:15 Grinnz_ oh, IOLoop->remove is a bit different i guess
20:26 pink_mist jberger: http://p.0au.de/16586a8e <-- this seems to reproduce it ... if you go to /test after running it with morbo
20:26 pink_mist Grinnz_: ^
20:27 pink_mist jberger: is the $client not a strong enough reference?
20:27 Grinnz_ that's an ID, not a reference
20:28 pink_mist what else am I supposed to use?
20:29 jberger pink_mist: what in the world are you doing there :-)
20:29 pink_mist note: this code is from the Mojo::IOLoop synopsis
20:29 jberger why are you creating a new client?
20:29 pink_mist it's just a test...
20:29 Grinnz_ what exactly is that client connecting to?
20:30 pink_mist presumably the morbo server it's running under
20:30 Grinnz_ that's only accidental if so...
20:30 jberger pink_mist: in the original request scope do my $tx = $c->tx
20:31 pink_mist Grinnz_: I could include in the instructions: run it under morbo on 127.0.0.1:3000
20:31 jberger then in the timer refer to the $tx, just enough to close over it
20:31 jberger pink_mist: WHY?
20:31 jberger you are trying to call yourself?
20:32 pink_mist I am trying to call /anything/. it's just convenience that I'm calling myself in this case.
20:32 pink_mist since I can be pretty sure I'm running myself
20:32 jberger use Mojo::UserAgent and then request a page from google or wikipedia or something
20:32 pink_mist I'd rather this work on something not connected to the internet
20:32 Grinnz_ anyway yeah, it's the render in that case. you need to keep $c->tx around until the timer renders
20:33 Grinnz_ (this is done for you if you use the delay helper)
20:34 pink_mist adding a my $tx = $c->tx; inside the timer changed nothing
20:34 pink_mist I guess that wasn't right?
20:34 Grinnz_ not inside the timer
20:34 Grinnz_ by that time it's gone :P
20:34 Grinnz_ my $tx = $c->tx before the async stuff, then undef $tx at the end of the timer
20:35 pink_mist ok
20:35 pink_mist yay! success
20:35 pink_mist thanks
20:37 Grinnz_ the tribulations of avoiding memory leaks
20:38 jberger pink_mist: a prime example: https://github.com/kraih/mojo/blob/master/lib/Mojolicious/Plugin/DefaultHelpers.pm#L80-L86
20:39 pink_mist gotcha
20:40 pink_mist now I wonder if this is documented somewhere and I just missed reading it :>
20:40 Grinnz_ if we had an async guide i'm sure it would be there! :)
20:41 Grinnz_ (it might be somewhere in the cookbook)
20:42 pink_mist I'm kindof surprised the $c itself isn't enough for the tx to be referenced
20:43 Grinnz_ i think it's a case of $c doesn't know you still want to do stuff with the transaction at some future point in the event loop
20:43 Grinnz_ dunno...
20:43 purl Grinnz_ is stupid, he don't know nothin'
20:44 * Grinnz_ sets purl on fire
20:44 * purl basks in the warm glow HEY WAIT A MINUTE
20:47 pink_mist well ok, so it was the $c->render() call in the timer that caused the error then? is there a way to make /that/ conditional on if the $client was remove()d then? :>
20:48 jberger pink_mist: I still don't think you want a raw client instance
20:48 Grinnz_ $c->render doesn't really have anything to do with $client
20:48 Grinnz_ it's a completely different transaction
20:49 pink_mist Grinnz_: yes, hence I wanted to only call it if $loop->remove($client) actually did something :>
20:49 pink_mist jberger: connecting to HTTP is just an example; it's convenient since to run the example, a HTTP server will be running
20:50 Grinnz_ set a boolean when you render from the stream, and don't render in the timer if that's set
20:50 Grinnz_ (in $c->stash might be appropriate)
20:51 bin_005 joined #mojo
20:53 Grinnz_ or if you really want "whether it's finished", set the boolean on the finish event of the stream
20:53 Grinnz_ or close event, rather
21:11 pink_mist ah, doing a check for definedness on $c->tx seems to do the trick nicely
21:13 pink_mist return unless defined $c->tx; at the top of the timer sub
21:14 pink_mist should probably put one of those in the on read sub too
21:16 jberger pink_mist: that will prevent an error, but it is unlikely to succeed either
21:16 Grinnz_ it won't keep $tx around
21:16 jberger you need to keep a strong reference to the transaction in order to respond to it
21:16 jberger I sometimes do $c->render(...) if $tx;
21:17 jberger that serves to close over $tx and in the worst case scenario still prevent errors
21:18 pink_mist since I do $c->render_later(); it should wait for the first ->render() in whichever callback shouldn't it?
21:18 Grinnz_ no
21:19 Grinnz_ render_later just means it won't automatically render when the action method ends
21:19 Grinnz_ it doesn't wait for anything
21:20 pink_mist http://mojolicio.us/perldoc/Mojolicious/Controller#render_later <-- the example here seems to imply it does
21:20 Grinnz_ hmm, that example is incomplete i guess
21:21 Grinnz_ the description however is precise :P
21:22 jberger pink_mist: http://mojolicio.us/perldoc/Mojolicious/Controller#tx
21:22 jberger "Note that this reference is usually weakened, so the object needs to be referenced elsewhere as well when you're performing non-blocking operations and the underlying connection might get closed early."
21:22 purl i already had it that way, jberger.
21:22 Grinnz_ goddammit purl
21:22 pink_mist jberger++
21:22 pink_mist thanks, exactly the kind of documentation I was hoping for :)
21:23 jberger I gave purl a slap upside the head, she seems better now
21:24 jberger (me still kinda wishes that purl wasn't a she, somehow the beatings she is given feel socially unacceptable that way :s )
21:24 * jberger watches "She" and cries a little
21:24 jberger Her
21:24 jberger whatever
21:26 disputin joined #mojo
21:36 sri she'll have her revenge once the robot uprising starts
21:38 sri guess it's more weird for americans... as a german i'm used to calling things he and she :)
21:42 _dave_ I live in LA ... I've learned to be gender neutral ;)
21:44 Grinnz_ americans are quite awkward about 'it's
21:44 _dave_ only some of us are
21:44 Grinnz_ i mean in language :P
21:45 _dave_ same answer to both interpretations ;)
21:45 _dave_ you can also use the plural pronoun, even though slightly inaccurate
21:46 Grinnz_ yeah, "they/them" is commonly used to refer to a single person of unknown gender, i guess because it's less awkward than calling a person "it"
21:46 _dave_ I prefer "more polite" :D
21:46 Grinnz_ that too
21:46 lluad Yeah, "they" is quite acceptable and generally preferred.
21:47 _dave_ probably the single biggest reason I didn't continue learning french is because you apparently have to know what gender the word is
21:47 Grinnz_ same in spanish, all nouns are gendered
21:47 disputin joined #mojo
21:47 lluad (And less of a "statement" than things like "ze", "zir", "hir" ..., though they have their place)
21:48 pink_mist I kindof like the version where you remove 'th' from 'they', 'them', 'their'
21:48 damaya joined #mojo
21:50 lluad If it's good enough for The Joy of TeX ...
22:46 Onigiri joined #mojo
23:16 mattastrophe joined #mojo
23:25 batman joined #mojo

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