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

IRC log for #mojo, 2015-02-06

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

All times shown according to UTC.

Time Nick Message
00:13 reneeb Grinnz_: IO::Tty (A POE prereq) installation fails...
00:14 Grinnz_ so it is related...
00:17 jzawodn hrm, I think I finally need to bite the bullet and upgrade Mojo
00:17 jzawodn 4.24 is sorta anicent at this point
00:17 Grinnz_ yeah, lots of security fixes in the meantime
00:18 Grinnz_ and other cool stuff
00:18 jzawodn yeah, but I'm more worried abuot the number of times I lookup stuff in the docs and it doesn't exist in my release
00:18 Grinnz_ heh
00:18 jzawodn our limited use cases don't see those security issues (that I can tell)
00:19 Grinnz_ jesus this query (get a bunch of rows from one table, no joins) took almost an hour
00:19 Grinnz_ i hate mysql
00:19 Grinnz_ also, i think this table is corrupted or something lol
00:24 mib_qcteqr joined #mojo
00:37 jzawodn hm, does this make sense to anyone?  I have this code in a module: http://pastebin.com/1VzjYRJd
00:37 jzawodn I get an empty list in both Dumps but there's a ~20 second delay
00:38 jzawodn I'm wondering if I'm using Mojo::IOLoop::Delay wrong
00:39 Grinnz_ if there's no steps remaining, it's already finished, isn't it?
00:40 jzawodn that's what I thought
00:40 Grinnz_ so why call wait?
00:40 jzawodn well, I mis-spoke
00:41 jzawodn there are some calls before the first Dump which use Mojo::UserAgent to connect to a service and grab some data
00:41 Grinnz_ wait on a delay that's already finished would run the IOLoop indefinitely until something else stopped it
00:41 jzawodn I use MOJO_USERAGENT_DEBUG=1 to see that the request indeed runs and completes
00:42 jzawodn oddly it runs for ~20 seconds every time... so something isn't cleaning up
00:43 Grinnz_ i still don't know why you're calling wait on a finished delay
00:44 jzawodn basically following the model "Sequentialize multiple events" here: http://mojolicio.us/perldoc/Mojo/IOLoop/Delay
00:45 jzawodn except that I create the $delay object explicitly
00:45 Grinnz_ wait is used to start the ioloop once the delay is created, if necessary
00:45 jzawodn if I don't call wait, the event loop would never run
00:45 Grinnz_ it should still have all its steps at that point
00:45 jzawodn hmm
00:46 jzawodn I'll have to dig deeper then.  thanks for the sanity check
00:56 jberger jzawodn: do you have a more complete example?
00:57 jzawodn jberger: sadly, no... it's a little tangly.  however, I removed the $delay->wait call and it works fine.  now I need to explain to myself why that works
00:58 jzawodn probably related to the fact that I'm using a few delay() constructs in this group of modules that is only async in a few places
01:00 jzawodn Oh, yeah.  I see how I've shot myself in the foot now.  sigh.
01:02 jberger jzawodn++
01:02 jberger its really easy to do it
01:03 jberger footgun yourself I mean
01:04 sri jberger: the code was written for 4.24
01:04 sri delays changed completely since then
01:05 jberger then the footgun has a large muzzle and a hair trigger
01:05 sri :)
01:05 jberger has it really changed that much?
01:05 sri https://github.com/kraih/mojo/blob/master/Changes#L961
01:07 sri hehehehe https://github.com/kraih/mojo/blob/v4.24/lib/Mojo/IOLoop/Delay.pm#L27
01:13 jberger oh yeah, forgot about that one
01:13 sri around 5.0 the internals changed completely
01:13 jberger there was also ->delay(sub{}) vs delay(sub{}, sub{})
01:14 sri right, no leak protection
01:14 sri no proper exception handling
01:14 * jberger hugs delays
01:14 jberger no exception handling?! I forgot about that
01:14 jberger its one of the best parts now
01:14 sri took a long time to get it right
01:15 jberger I wish I could show off a bit of code I wrote for $work
01:15 jberger so delay, much awe, way non-block
01:17 jberger its a class for interacting with a site that we use
01:18 jberger the class has a ua object
01:18 jberger and there is a non-blocking login method
01:18 jberger which logs in, then sets an attribute "logged in" to true, then calls the callback
01:19 jberger then on future calls, if "logged in" is true, it calls the callback immediately
01:19 jberger so then all the other methods call it, in case it is the first method used
01:19 jberger but it only has to do it once
01:19 jberger a lot like my MojoConf talk in a way, but fun to see it in practice
01:20 sri hope fully you're deferring the callback with next_tick :)
01:21 sri calling it right away is an anti pattern ;p
01:21 * jberger checks
01:22 jberger sure am
01:22 sri jberger++
01:27 good_news_everyon joined #mojo
01:27 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/bVTG
01:27 good_news_everyon mojo/master e60aa74 Sebastian Riedel: just hide the menu
01:27 good_news_everyon left #mojo
02:06 klapperl joined #mojo
02:17 fhelmber_ joined #mojo
03:27 noganex_ joined #mojo
03:27 marmez joined #mojo
03:28 disputin joined #mojo
03:49 hshong joined #mojo
04:10 Kovensky joined #mojo
04:13 btyler joined #mojo
04:22 dvinciguerra joined #mojo
04:38 inokenty-w joined #mojo
04:38 asarch Is there any way to check, maybe using a helper, if a file in /public exists?
04:38 Grinnz http://mojolicio.us/perldoc/Mojolicious/Static#file perhaps?
04:39 Grinnz does a little more than just check if it exists, but you can check for undef
04:39 asarch Thank you
04:40 asarch Thank you very much :-)
04:43 inbioz joined #mojo
04:43 dotandimet joined #mojo
04:44 dustinm joined #mojo
04:48 asarch Is $self->app->static->file('foo.html') a file handle? If not, how could I get it?
04:50 asarch NM: $self->app->static->file('foo.html')->handle
04:50 asarch :-P
04:50 Grinnz :)
04:54 asarch Have a nice day
04:54 asarch Thank you very much
04:54 asarch See you later :-)
05:02 irq joined #mojo
05:32 inbioz joined #mojo
05:44 dotandimet joined #mojo
05:50 dustinm joined #mojo
06:04 inbioz joined #mojo
06:10 dustinm joined #mojo
07:05 melo joined #mojo
07:21 Adurah joined #mojo
07:23 dotandimet joined #mojo
07:24 reneeb joined #mojo
07:42 Vandal joined #mojo
07:47 dod joined #mojo
07:52 dod joined #mojo
07:54 reneeb joined #mojo
08:05 eseyman joined #mojo
08:08 kwa joined #mojo
08:10 jwang joined #mojo
08:10 trone joined #mojo
08:15 pink_mist xdg: ah, so you are =) well here I have some pastes for you then: http://p.0au.de/bc9b4d6a/ http://p.0au.de/3d846b3f/ http://p.0au.de/1fd206dc/
08:17 pink_mist Grinnz: CC ^
08:21 basiliscos joined #mojo
08:23 pink_mist xdg: and here's the tree command for /tmp/foo: http://p.0au.de/70e3c33d/?cs=utf8
08:28 marmez joined #mojo
08:37 marmez joined #mojo
09:07 Insane joined #mojo
09:09 * marcusr has just embraced focus follows mouse. What will be next? Significant whitespace?
09:11 Insane joined #mojo
09:13 irq joined #mojo
09:28 batman focus_follows_mouse++
09:29 nathanael joined #mojo
09:30 nicomen to front on focus maybe?
09:31 * nicomen prefers focus on click, to front on click on window decoration
09:35 fhelmber_ joined #mojo
10:26 nathanael joined #mojo
10:51 xdg mouse?  what is this "mouse" you speak of?
10:53 denny marcusr: raise on focus?  :)
10:55 xdg mst, see pink_mist pastes above ^^
11:01 xdg pink_mist, what version of CPAN.pm
11:01 pink_mist 2.05
11:04 xdg pink_mist, thanks for the pastes, particularly the one showing the local::lib. I'll try to reproduce.
11:04 xdg at first glance it looks like a CPAN bug not noticing that IO::Tty was installed in the local lib
11:05 pink_mist thanks for taking a look at it =)
11:06 pink_mist I need to be off now though, so will check back later
11:40 marcusr xdg: I mean touchpad
11:40 * marcusr is using linux at work now, but brought his mac keyboard and magic touchpad.
11:43 punter joined #mojo
11:46 ZadYree joined #mojo
11:48 alnewkirk joined #mojo
12:11 cpan_mojo Mojolicious-Plugin-OAuth2-Server 0.01 by Lee Johnson - http://metacpan.org/release/LEEJO/Mojolicious-Plugin-OAuth2-Server-0.01
12:13 Lee ^ critique of that module would be appreciated
12:13 Lee i mean, if anyone also fancies banging their head against OAuth2 :)
12:15 marcusr Lee: <3
12:15 marcusr thank you for doing this thing I said I would do ages ago and never found tuits to
12:16 Lee i'm convinced it could be much better, but it seems there is always going to be a large chunk of bespoke code in any OAuth2 authorization/resource server
12:18 Lee hmm, it seems the perl travis-perl helpers have shifted
12:23 marcusr Lee: tiny style suggestion, it's common to have synopsis before description
12:24 Lee ta, will fix
12:41 asarch joined #mojo
12:58 marty joined #mojo
13:00 dvinciguerra joined #mojo
13:07 punter joined #mojo
13:09 neilhwatson joined #mojo
13:20 cpan_mojo Mojolicious-Plugin-OAuth2-Server 0.02 by Lee Johnson - http://metacpan.org/release/LEEJO/Mojolicious-Plugin-OAuth2-Server-0.02
13:35 McA joined #mojo
13:39 aleksey joined #mojo
13:42 holger joined #mojo
13:51 dod joined #mojo
13:58 * genio grumbles in the general direction of OAuth2
13:59 Lee heh
14:00 marcusr http://powerrangers.wikia.com/wiki/Grumble_Bee
14:02 Lee aaaaand the cpantesters fails come rolling in...
14:02 Lee cpantesters++
14:06 cpan_mojo Mojolicious-Plugin-OAuth2-Server 0.03 by Lee Johnson - http://metacpan.org/release/LEEJO/Mojolicious-Plugin-OAuth2-Server-0.03
14:06 marcusr mo versions / mo fail
14:06 nicomen the dreaded 0.01 - 0.07 releases
14:06 nicomen ;-)
14:07 genio don't you make me grumble again.  I'll do it!
14:07 Lee did i read somewhere that someone was looking at github to cpantesters integration?
14:25 genio ok, I've had some coffee, so there'll be less grumbling now :)
14:27 Ptolemarch joined #mojo
14:32 ignacio_ joined #mojo
14:35 neilhwatson joined #mojo
14:39 ryozi joined #mojo
14:43 cpan_mojo Mojolicious-Plugin-RelativeUrlFor 0.05 by Mirko Westermeier - http://metacpan.org/release/MEMOWE/Mojolicious-Plugin-RelativeUrlFor-0.05
14:45 sri memowe: fail!
14:46 zackiv31 joined #mojo
14:48 ZadYree Hello! I've used https://metacpan.org/pod/Mojolicious::Guides::Cookbook#Making-your-application-installable to pack my mojo app, and it got installed on another computer without any problem. I wonder if it is capable of getting the deps alone or if I should specify them in a file.
14:57 Grinnz ZadYree, cpanfile is a nice way to specify deps, cpanm and some other tools can use it directly
14:58 ZadYree oh I see
14:58 ZadYree nice one!
14:58 purl geezer!
14:59 mst or if you're planning to package up the app for installation, Makefile.PL
15:00 ZadYree mst, is there a best practice compilation for using Makefile.pl?
15:01 mst ZadYree: ExtUtils::MakeMaker has a param called PREREQ_PM that's the main thing you need
15:01 ZadYree wow, nice!
15:01 mst honestly, "start with a cpanfile, remember the alternatives exist" is probably a good approach
15:02 mst so if you find something cpanfile doesn't work for, you can check to see if it doesn't because there was already a way that was designed for that :)
15:02 ZadYree eheh, that's an approach I know quite well :D
15:04 xdg pink_mist, I can't seem to replicate it.  Could you please apply this patch or something equivalent to your installed CPAN.pm and give me the output of another install attempt? https://gist.github.com/dagolden/98dd2db37fdd5706da4c
15:04 xdg mst, ^^
15:05 mst xdg: heh, cute diagnostic patchlet
15:06 xdg yeah, CPAN.pm is a beast to debug
15:06 xdg and andreas doesn't have any of his usual debugging stubs in that section of code
15:07 xdg mst, weirdly, when I tried just intalling POE, I get it looking for IO::Tty twice: https://gist.github.com/dagolden/a6f85f0dfcc762f507f9
15:07 xdg which is a bit suspicious
15:09 marcusr I've been using cpanm for so long, I now dread CPAN. I'm not sure I could make myself use it again.
15:10 Grinnz reneeb, speaking of which, any way you can get a build log of the failure you're getting?
15:10 xdg whoops, not suspicious.  there's a call to avaiable_version followed by a call to available_file, but available_version *also* calls available_file and there's no caching of the response
15:10 xdg marcusr, I hack on CPAN.pm and even I mostly use cpanm.
15:10 Grinnz heh
15:11 marcusr xdg: Can I tweet that? :)
15:12 mst I use a mixture of CPAN and cpanm and have patches in all three
15:12 xdg someday, I hope to make CPAN.pm as pleasant to use as cpanm.  Needs fast index lookup and a way to squeltch verbose output.
15:12 jberger ZadYree: look at someone's Makefile.PL and probably copy most of it
15:12 mst jberger: hence why I think the cpanfile suggestions he got before I mentioned Makefile.PL is a good first thing to do
15:12 jberger 99% of them are the same in their structure
15:13 mst xdg: I always wanted to see if DBM::Deep would make a better alternative to trying to get SQLite integration to work
15:13 jberger mst: are there toolchain ways of using cpanfile for installable modules? other than author tools like dzil and ambt?
15:13 Grinnz jberger, plus half of them are autogenerated :P
15:14 mst jberger: I specifically said *if* he wanted to make it installable, that was when he should switch
15:14 mst backlog. it contains words.
15:14 jberger and yeah, memowe, gotta look at that upload
15:14 xdg mst, it needs the web API lookup from CPAN::Common::Index.  Downloading an updated 02packages is the annoying delay that cpanm avoids.
15:14 jberger mst: farther backlog, he wants that
15:14 mst jberger: ooooh. fail.
15:14 mst sorry :)
15:14 jberger s'ok
15:15 jberger he asked a day or so ago
15:15 marcusr jberger: we create Makefile.PL from cpanfile in Convos, afaik.
15:15 mst xdg: he said 'getting the deps' and implied installing Mojo on another computer
15:15 mst bah
15:15 mst jberger: ^^
15:15 mst today
15:15 mst xdg: heh, using 02packages is one of the reasons I like CPAN.pm
15:15 jberger marcusr: IIRC, convos does it using some script yeah?
15:15 jberger I looked once
15:15 marcusr This channel is logged publically, so I assumed fair game on the tweet, xdg.
15:15 jberger App::ModuleBuildTiny does it
15:16 xdg pink_mist, also when you do the install run, first do "! $CPAN::DEBUG=80" from the cpan shell
15:16 marcusr jberger: yes
15:16 marcusr written by batman
15:16 mst because I can snapshot that to get reproducible installs
15:16 batman marcusr: what did i do?? :)
15:16 xdg that will be painfully long, but will give more data to look at
15:16 marcusr batman: wrote a script :)
15:16 mst ... huh
15:16 * mst adds a mental note for the cdx feature list
15:16 batman marcusr: which?
15:16 purl i guess which is certainly not ideal
15:16 mst just realised cpanfile.snapshot is insufficient
15:17 marcusr batman: generates Makefile.PL from cpanfile.
15:17 batman App::git::ship::perl ftw
15:17 mst I've also seen Module::CPANfile used inside Makefile.PL to create PREREQ_PM
15:18 Grinnz that reminds me... ive been meaning to add [CPANFile] to my dist.inis
15:18 batman https://metacpan.org/source/JHTHORSEN/App-git-ship-0.12/lib/App/git/ship/perl.pm#L534
15:18 marcusr git-ship has been quite pleasant to me so far.
15:19 batman too bad it has so awful documentation :/
15:19 Grinnz mst, theres a dzil plugin to do it that way too, of course
15:20 mst batman: maybe you should send the author a patch
15:20 batman mst: nah. he will probably reject it.
15:20 marcusr yeah, I heard he's douchy like that.
15:21 batman ETOOMUCHTOMAKE
15:21 Grinnz :)
15:23 mst batman: I'm suffering very badly from that at the moment
15:23 batman mst: yeah. looking forward to the machines to take over.
15:28 Grinnz just need to write the code for them to do that!
15:29 lupi joined #mojo
15:30 marcusr that's why I'm working on automation =]
15:30 mst that's the thing that's annoying me, I end up doing at least one thing every day that my current project would've automated away for me if it was finished already ;)
15:31 * marcusr is now looking at rundeck to provide a self service interface to his automation jobs.
15:32 marcusr So that the developers can run their own damn deploy jobs
15:32 Ptolemarch joined #mojo
15:33 gryphon joined #mojo
15:40 lupi Hi. I'm running a Mojolicious::Lite app as a fastcgi script but I don't have all of the useful environment variables (like REMOTE_USER) that other fast cgi scripts do. Anyone know how I can access them?
15:41 dvinciguerra joined #mojo
16:05 jberger lupi: all of those are available via mojo
16:05 jberger but IIRC batman has a module that can give you the old interface too
16:06 sh4 joined #mojo
16:06 batman jberger: do you mean my cgi plugin? cgi != fastcgi
16:06 jberger oh right
16:06 batman lupi: sure you don't want the $c->req->url->userinfo?
16:07 Grinnz_ lupi: all the stuff that was in env variables is now usually either in the transaction or the request message
16:07 Grinnz_ "was" = cgi, "is now" = mojo
16:07 lupi ah, cool, let me try that
16:09 Grinnz_ $c->tx has remote_address, https://metacpan.org/pod/Mojo::Transaction
16:09 pink_mist xdg: I applied that patch, and am running cpan now with ! $CPAN::DEBUG=80 set
16:09 jberger is REMOTE_USER supposed to be the basic auth user component?
16:09 Grinnz_ $c->tx->req->headers has user_agent and other headers, https://metacpan.org/pod/Mojo::Headers
16:09 jberger $c->req->url->userinfo has that?
16:09 lupi yeah, I have apache in front doing basic auth with ldap
16:09 batman jberger: yes. that's why i tried to point out $c->req->url->userinfo
16:10 eseyman left #mojo
16:10 Grinnz_ https://metacpan.org/pod/Mojo::URL#SYNOPSIS
16:10 jberger https://metacpan.org/pod/Mojolicious::Plugin::BasicAuthPlus
16:11 eseyman joined #mojo
16:12 batman lupi: but... how are you able to run mojo as "fast cgi" what is "fast cgi"? could it be just CGI?
16:12 gryphon joined #mojo
16:13 batman if cgi: look at $c->req->env->{REMOTE_USER}
16:13 lupi nothing in $self->req->url->userinfo, but I see the environment variables in $self->req->env
16:13 lupi batman: yes, it's in there :-)
16:13 batman i don't get how mojo is able to run as fcgi...
16:13 batman there's nothing "fast" about "cgi". stop saying that.
16:13 batman it's confusing
16:14 lupi fast cgi is different because it starts a process that connects to a local socket to talk to apache
16:14 lupi so faster than cgi, even though probably not that fast
16:14 Grinnz_ it's "fastCGI"
16:14 Grinnz_ one word :P
16:14 batman isn't that fcgi?
16:14 lupi yes, that
16:14 Grinnz_ it can be referred to as that but fastcgi is the name
16:15 batman ok
16:15 batman didn't know mojo had fcgi support.
16:15 Oleg joined #mojo
16:15 Grinnz_ i didnt think it did
16:15 lupi nor did I until I stumbled on it yesterday in a forum
16:15 Grinnz_ it's not documented, in any case
16:15 lupi thanks for your help, guys :-)
16:15 batman lupi: how did you set this all up?
16:16 batman lupi: sure you're not doing som cached mod_perl thing?
16:16 Grinnz_ i do remember reading old docs that said it supported fastcgi though
16:16 lupi in apache I just have SetHandler fcgid-script
16:16 Grinnz_ so maybe thats still around
16:16 sri we support fastcgi through psgi
16:17 jberger $self->req->url->to_abs->userinfo
16:17 Oleg wonders is  this module still works https://metacpan.org/pod/Mojo::Server::FastCGI
16:17 batman ok.
16:17 batman sri: ^ thanks
16:17 jberger tempire++: https://metacpan.org/source/TEMPIRE/Mojolicious-Plugin-BasicAuth-0.08/lib/Mojolicious/Plugin/BasicAuth.pm#L20
16:17 Grinnz_ Oleg: probably needs updating, its a couple years since the last
16:17 sri it's funny that we now have users that don't remember when fastcgi was all the rage :D
16:17 cfedde How do I enable debugging logging in production mode?
16:18 Grinnz_ sri: "was"? it still is for some people =_=
16:18 batman cfedde: $app->log->level('debug');
16:18 lupi I was using plack, but for very long, complicated reasons I've ended up using fcgi
16:18 Grinnz_ cfedde: i do that by setting a configuration var in my app which sets what batman said on app startup
16:18 Grinnz_ that way it works even to change it for a hot deployment
16:18 batman lupi: why not do the sane: reverse proxy to mojo?
16:19 Grinnz_ with a*
16:19 sri this commit was very controversial at the time ;) https://github.com/kraih/mojo/commit/a1a16bb1ccdadb84d2b4942ff79db15a7db17260
16:19 Grinnz_ sri: aha! i knew i remembered seeing fastcgi support in old versions
16:19 sri i think oetiker was even yelling at me
16:20 sri and now we are on the verge of adopting another binary protocol :/
16:20 Grinnz_ heh
16:21 Grinnz_ lupi: if you are just trying to connect a mojo app to apache, i would strongly suggest reverse proxy as batman said
16:21 lupi batman: the reverse proxy solution won't work for me because I want "/health" without auth, but "/" everything else with auth
16:21 Grinnz_ lupi: why won't it work for that?
16:21 batman lupi: right. that would work if you set it up right :)
16:22 lupi ok, you asked so I'll tell you :-)
16:22 batman but i haven't touched apache for some while, so i don't know how
16:22 lupi having a <Location "/"> directive overrides a <Location "/health"> directive, so that won't work
16:22 lupi next thing to try is regex
16:23 Grinnz_ lupi: but how does using fastcgi solve this?
16:23 lupi <Location ~ ^/[^h]> doesn't work correctly with psgi
16:23 Grinnz_ lupi: you don't need psgi to do a reverse proxy
16:23 lupi because it makes apache try to serve static content for whatever reason
16:23 lupi it works fine with apache 2.4
16:23 lupi I have apache 2.2
16:23 lupi and I don't want to backport apache 2.2 to ubuntu precise
16:23 lupi and I don't want to upgrade to trusty
16:24 Grinnz_ lupi: https://metacpan.org/pod/Mojolicious::Guides::Cookbook#Apache-mod_proxy
16:24 lupi so I have landed on fastcgi
16:24 lupi I know how to make it work, but it doesn't work in my particular setup
16:25 lupi Grinnz_: I'm so confused with my solution, I don't remember why fastcgi solves this. Perhaps it doesn't :-)
16:25 pink_mist xdg, Grinnz_, mst: http://p.0au.de/6dd937e7/
16:26 Grinnz_ lupi: i am sure it could work with mod_proxy. but not wanting to spend time on that is reasonable; the problem is fastcgi is not really supported
16:26 Grinnz_ at least not directly
16:27 lupi Grinnz_: ok, thanks. Maybe upgrading is the way to go then.
16:42 Ptolemarch joined #mojo
16:43 amon joined #mojo
16:57 dparry joined #mojo
17:00 trone Can i replace "bridge" with "under" ? I got the deprecated message today. :-)
17:00 dparry is it possible to have dynamically updating $interval in Mojo::IOLoop->recurring($interval => sub {... or do I have to exit the IO::Loop and recommence?
17:00 trone the question indeed is: is safe replace brutally? :D
17:01 pink_mist dparry: I'd say don't use ->recurring ... use ->delay and then in every callbakc sub { } use ->delay again
17:01 pink_mist with the approprite $timeout
17:01 pink_mist *appropriate
17:02 Grinnz_ trone: can you give an example of how you're using bridge? (i haven't used that method directly)
17:02 Grinnz_ and yeah dparry, recurring sets the interval only when you call it
17:02 Grinnz_ no need to exit the ioloop, what pink_mist said will work
17:03 diegok joined #mojo
17:03 dparry ah, thanks pink_mist / Grinnz_
17:03 Grinnz_ er, not delay
17:03 Grinnz_ ->timer :)
17:03 pink_mist er yeah not delay
17:03 pink_mist what Grinnz_ said :P
17:03 trone Grinnz_: I've auth check in a bridge route, and I use it also as intermediate "root" node to apply special behaviour to its children.
17:04 Grinnz_ trone: i meant in syntax, but yeah i'm using an under route for that
17:04 trone Grinnz_: my $api_v1 = $r->bridge('/')->to(cb => sub { $_[0]->res->headers->header('Access-Control-Allow-Origin' => '*'); });
17:05 Grinnz_ trone: if the other routes are all created from that $api_v1 object then sure, that should work replaced with under()
17:05 dparry so I call $loop->timer($interval); within the sub?
17:05 trone Grinnz_: after it, i've ohter route  defined as $api_v1->get('foo/bar')->  ...
17:06 trone Grinnz_: yep.
17:06 trone Grinnz_: ah, and can I under under an under ? :)
17:06 Grinnz_ trone: sure. just make sure the "under" callbacks or actions return 1 so that it will continue dispatching
17:06 trone (I suppose so)
17:06 trone Grinnz_: righ
17:06 Grinnz_ that is, unless there's an error of course ;)
17:07 pink_mist dparry: no, you predeclare your sub: my $sub; $sub = sub { ...; $loop->timer($interval, $sub) }; ... $loop->timer($interval, $sub); #need to do it once again outside the sub in order to start it
17:11 pink_mist dparry: if you're in a new enough perl, you might be able to do $loop->timer($interval, __SUB__); instead within the sub rather than having to muck about with predeclaring
17:12 Oleg pink_mist: looks like memory leak. $sub refers to itself ;)
17:12 trone Grinnz_: ah, another old bridge use was create "init" route for resource as: my $obj_r = $auth->bridge('/obj/:id')->parse(id => qr/\d+/)->to('obj#init') and after it some specific route that use initializated obj. :)
17:12 pink_mist Oleg: yes, there is a distinct chance of that -- which was why __SUB__ was invented
17:12 pink_mist iirc
17:13 Grinnz_ trone: yeah i'm using under for that as well
17:16 mst THE TROLL UNDER THE BRIDGE
17:16 mst (sorry)
17:17 Grinnz_ maybe avoid memory leaks by doing something like $loop->next_tick(sub { set_timer($interval) }) then have set_timer set the timer with the passed interval (passing whatever else it needs to set it)
17:17 trone mst: the trone under the bridge?
17:18 Grinnz_ hmm that still wouldnt be timing accurate
17:19 Grinnz_ this is where POE events by name come in handy, i think
17:20 dparry the use case is basically dynamic config update. i.e. the interval comes from a config file and I want the app to reconfigure on the fly.
17:20 dparry I can handle this via a Mojo::IOLoop->stop as I have a parent loop that will then restart the loop with the new settings, so I think I'll go that route for now
17:20 Grinnz_ dparry: oh, then just set a recurring timer, store the returned ID in your app, and remove it and set a new recurring timer when you reconfigure
17:21 mst I like managing this stuff using an object that then uses $self->curry::foo or $self->curry::weak::foo to create callbacks
17:21 mst should work with a custom Mojo::Base class just as well as with a custom Moo class
17:23 dparry ah, perfect, thanks Grinnz_ . As always it's asking about the use case and not the guessed solution :)
17:23 Grinnz_ heh
17:28 dustinm joined #mojo
17:28 odin22 joined #mojo
17:31 mst dparry: this is why if I type "/achieve", my irssi prints
17:31 mst step back. explain what you're trying to achieve.
17:32 dparry yep, so true mst :)
17:40 xdg mst, pink_mist, looks like the local lib archpath isn't being set up properly for some reason: https://gist.github.com/dagolden/ccf7bfdf3783bb516443
17:41 xdg I have to prep for a meeting so can't dig in further until later this afternoon, but hopefully that will help diagnose.
17:41 mst xdg: ha!
17:41 mst pink_mist: my suspicion then is that the perl version in @INC may be combining with your local::lib being activated under a different perl
17:42 mst or a mistmatch between the installed version and a bundled one somewhere else
17:42 mst or ...
17:42 jzawodn jberger: yes, I'm good with the footgun
17:45 disputin joined #mojo
17:46 rem_lex|pivo joined #mojo
18:06 oetiker Oleg it does ... although with fcgi you can not do any of the non-blocking stuff due to limitations of the protocol. so it really depends on the type of application you have
18:07 Oleg good to know
18:08 oetiker we still have many apps running with fastcgi
18:09 mst for request/response style apps fastcgi's a great deployment option
18:10 mst I tend to prefer keeping my req/res stuff and my async stuff separate anyway
18:10 mst (i.e. in separate processes)
18:12 Oleg oetiker: btw, how to start mojo app with Mojo::Server::FastCGI? It has no some executable server
18:14 Grinnz_ mst: and we were forced to, since we were using fastcgi :P
18:14 Grinnz_ that's changing now, though
18:14 mst Grinnz_: being able to tune the two separately makes me happy
18:15 Grinnz_ true
18:15 Grinnz_ but for some things, its a bit of overcomplication
18:15 Grinnz_ i'm still keeping the processes that run for hours or days in a separate process :P
18:15 mst your overcomplication is my separation of concerns :)
18:16 lb your separation of concerns is my SEP
18:16 oetiker just put a xxx.fcgi into your htdocs directory
18:17 cfedde intrinsic vs extrinsic complications.
18:17 oetiker cat .htaccess
18:17 oetiker RewriteEngine On
18:17 oetiker RewriteBase /~oetiker/extopus
18:17 oetiker RewriteCond %{REQUEST_FILENAME} !-f
18:17 oetiker RewriteRule (.*) ep.fcgi/$1 [L]
18:17 cfedde use a paste bot
18:18 lb oetiker is new to the internet, be nice to him
18:18 oetiker haha
18:18 sh4|2 joined #mojo
18:19 cfedde hi oetiker. good to see you. thanks for stopping by. hey, next time could you use a paste bot for that?  thanks.
18:20 Oleg and xxx.fcgi is a  normal mojo app? Where I should say "use Mojo::Server::FastCGI"?
18:20 oetiker https://gist.github.com/oetiker/d9d524d193b5cd7c26f9
18:20 lb i think my sarcasm might have been education enough, cfedde ;)
18:21 oetiker lb better ?
18:21 lb hooray
18:21 oetiker oleg you don't
18:21 oetiker just install it
18:21 lb mojo knows
18:22 lb i've deployed tiny mojo-lite apps in cgi-bin
18:22 oetiker oleg it installs a fastcgi command
18:22 Grinnz_ "exec ... fastcgi"
18:22 Oleg Ah, I see "fastcgi" argument will do the trick
18:22 Oleg thanks, oetiker
18:22 cfedde lb: sure. Of course EABEC always gets in the way.
18:23 lb that damn East Anglian Business Environment Club :(
18:34 tgt joined #mojo
18:35 dustinm joined #mojo
18:36 oetiker oleg, you might want to use the little hack I just added to the gist: https://gist.github.com/oetiker/d9d524d193b5cd7c26f9  it fixes mojos understanding of the url it is running under
18:43 ignacio_ joined #mojo
18:51 Oleg oetiker, got it
19:01 dod joined #mojo
19:23 irq joined #mojo
19:29 dotandimet joined #mojo
19:54 dustinm joined #mojo
20:02 GabrielVieira joined #mojo
20:18 sri interesting, removing the github ribbon from the frontpage appears to have no effect at all on visitors to the repo
20:19 sri gonna keep an eye on it for a few days, but the average of 500-600 views per day is very consistent
20:22 * sri wonders who clones the mojo repo all the time... on tuesday we've had 56 clones by only 3 people Oo
20:22 Grinnz_ lol
20:23 sri I'M ON TO YOU!
20:23 * Grinnz_ only has ... two clones?
20:24 sri wtf... january 27... 83 clones by 2 people oO
20:24 Grinnz_ where do you see those stats?
20:24 sri github has stats for your repos
20:24 sri under graphs
20:26 sri the most popular page on the wiki is https://github.com/kraih/mojo/wiki/Example-applications with 147 unique visitors in the last few days
20:26 Grinnz_ i know theres the commit stats and the fork network
20:26 Grinnz_ ahh, traffic
20:34 GabrielVieira joined #mojo
20:39 genio sri++  # perl -Mojo -E '...' just allowed me to quickly complete a task and amaze someone who was just complaining
20:39 sri \o/
20:40 genio in a meeting, on a projector, in only a few seconds :)
20:40 punter joined #mojo
20:40 sri that's exactly what ojo was designed for!
20:45 reneeb joined #mojo
20:53 dotandimet joined #mojo
20:57 jberger sri: just curious, why is there xml_escape and html_unescape but not the others?
20:57 sri jberger: do we need them?
20:58 jberger seems odd to be asymmetric?
20:58 sri html_escape actually existed for a time, but never worked correctly and got removed since it was not actually used in core
21:01 sri every now and then someone wants to have all entities properly encoded, but it's a shitty problem and just not worth it
21:05 sri jberger: you were actually around at the time!
21:05 mst you mean some people actually remember things? :)
21:06 sri http://irclog.perlgeek.de/mojo/2013-01-14#i_6330677
21:07 jberger the dark recesses of my mind conjure some memories
21:07 jberger mostly I just need <>
21:08 Ptolemarch joined #mojo
21:08 trone joined #mojo
21:08 sri you never *need* more than those few entities xml_escape generates, *unless* you use a legacy charset
21:09 sri one of the reasons i'm happy Mojo::DOM doesn't actually deal with charsets
21:10 sri it's always just perl characters, and entities are a non-issue
21:14 jberger argh, my stupid fault anyway
21:14 jberger ->content vs ->text
21:14 * jberger facepalms
21:14 purl facepalms are certainly another important measure
21:14 Grinnz_ indeed.
21:14 sri i recently stumbled over another case of asymmetry in the api
21:15 sri some classes have ->start methods, but no ->stop method
21:15 jberger (today's derp is using a SOAP service that has a JSON document the text in a tag)
21:15 sri $app->start, $ua->start
21:16 jberger could you stop a transaction (in that way?)
21:16 sri vs. $loop->start/stop and $daemon->start/stop
21:17 reneeb joined #mojo
21:18 sri not that it bugs my ocd... start is such a generic term
21:19 odin22 joined #mojo
21:20 jberger I wouldn't worry about that too much
21:24 cpan_mojo Mojolicious-Plugin-OAuth2-Server 0.04 by Lee Johnson - http://metacpan.org/release/LEEJO/Mojolicious-Plugin-OAuth2-Server-0.04
21:40 chansen joined #mojo
21:54 rem_lex joined #mojo
22:19 cpan_mojo Test-Mojo-Trim 0.0901 by CSSON - http://metacpan.org/release/CSSON/Test-Mojo-Trim-0.0901
22:27 kaare joined #mojo
22:34 cpan_mojo Test-Mojo-Trim 0.0902 by CSSON - http://metacpan.org/release/CSSON/Test-Mojo-Trim-0.0902
22:57 GabrielVieira joined #mojo

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