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

IRC log for #mojo, 2016-02-01

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

All times shown according to UTC.

Time Nick Message
00:08 CandyAngel I can't see any reason for it, just the logging stops working after you do :\
00:10 CandyAngel Hm.. it only doesn't output anything while in commands, still works in the main script
00:25 sri jberger: for now i guess we'll stick with "$stream2->stop; $stream1->write(..., sub { $stream2->start });" for congestion management
00:28 csson joined #mojo
00:31 CandyAngel Oh I see.. I'm not passing the $app to Local::Commands->new so it ends up with a different, non-working Mojo::Log in the commands $self->app->log
00:46 good_news_everyon joined #mojo
00:46 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vgePt
00:46 good_news_everyon mojo/master 0f42f77 Sebastian Riedel: more consistent names
00:46 good_news_everyon left #mojo
00:50 jberger sri: ok no problem
00:52 good_news_everyon joined #mojo
00:52 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vgeP6
00:52 good_news_everyon mojo/master dcc0da2 Sebastian Riedel: fix a few typos
00:52 good_news_everyon left #mojo
01:00 jontaylor joined #mojo
02:20 asarch joined #mojo
03:34 noganex joined #mojo
04:15 inokenty-w joined #mojo
04:24 cpan_mojo WWW-OAuth-0.002 by DBOOK https://metacpan.org/release/DBOOK/WWW-OAuth-0.002
04:37 c--__ joined #mojo
05:00 Grinnz_ joined #mojo
05:13 Grinnz joined #mojo
05:52 disputin joined #mojo
07:36 dod joined #mojo
07:40 dod joined #mojo
07:51 McA joined #mojo
08:00 dod joined #mojo
08:16 Vandal joined #mojo
08:19 * marcus falls over and collapses into a puddle.
08:27 AndrewIsh joined #mojo
08:27 trone joined #mojo
09:24 c--_ joined #mojo
09:26 berov joined #mojo
09:56 jontaylor joined #mojo
09:56 disputin joined #mojo
10:14 denny joined #mojo
10:14 denny Hi.  I want to force all param names and values to lower-case before they reach the rest of my webapp.  What's the best way to go about that?
10:14 c--__ joined #mojo
10:15 denny GET and POST
10:57 jkramer joined #mojo
10:57 jkramer Ahoy
10:58 jkramer Is there a way to access the HTTP server (hypnotoad, morbo, ...) from within the app?
10:59 jkramer I'd like to get some information like the number of forks
11:18 sugar__ joined #mojo
11:19 bowtie_ joined #mojo
11:20 bjakubski joined #mojo
11:29 kaare joined #mojo
11:37 abraxxa joined #mojo
11:38 abraxxa is Bernhard Graf around?
11:42 batman abraxxa: i think it's augensalat...?
11:44 gregf joined #mojo
11:46 batman denny: look at https://metacpan.org/pod/Mojo::Message::Request#query_params and https://metacpan.org/pod/Mojo::Message#body_params
11:47 batman these parameters objects aren't read-only, so you can manipulate then however you like in a before_xxx hook
11:47 sri shouldn't validation take care of lowercasing?
11:47 denny Okay, thanks
11:47 sri jkramer: no
11:47 batman sri: this is for swagger
11:47 denny sri: I have a very annoying API consumer.  Probably best not to ask.  ;)
11:48 denny It's their API spec, and they want everything case insensitive.  I can only assume they use Windows or something.
11:48 denny Or just don't trust their developers to follow their spec particularly closely.
11:49 batman denny: i would assume they are bad at letting go of the shift button :(
11:49 denny or pressing it, yeah
11:49 batman maybe they need a more responsive keyboard...
11:49 nic :D
11:49 denny they have some params like sinceDate and so on, and sometimes they used sincedate instead during testing
11:49 jkramer left #mojo
11:49 denny also sortKey=DATE and sortkey=date, etc
11:50 * denny sobs into his keyboard
11:50 batman yeah. that's why you want snake case in your api.
11:50 denny on the bright side, I invoiced on Friday, so that was nice
11:53 abraxxa batman: thanks!
11:53 abraxxa augensalat: ping
11:55 batman abraxxa: could be better to just ask instead of "ping"
11:55 good_news_everyon joined #mojo
11:55 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vgv1T
11:55 good_news_everyon mojo/master 6b8d424 Sebastian Riedel: no need for an arrow
11:55 good_news_everyon left #mojo
11:56 sri wouldn't it be fun if we could do stuff like "$stream->pipe($ws); $ws->pipe($stream);"?
11:57 sri hmm, but the value seems too limited
11:57 batman sri: yeah, but not sure if that's core functionality...
12:00 batman sri: guess that would make my example simpler: https://metacpan.org/source/JHTHORSEN/Mojo-IOLoop-ReadWriteFork-0.16/example/tail.pl :)
12:01 batman i need to make another example... "THIS APPLICATION IS A BAD IDEA" just sounds stupid :/
12:05 bowtie_ joined #mojo
12:10 denny batman: this code you gave me just before your flight:  $self->hook( before_routes => sub { for ( @{ $self->req->params->names } ) { $self->param( lc $_ => lc $self->param( $_ ) ); } } );
12:11 denny I assume it goes in startup()?  I changed $c and $app in your example to $self, which might be why I've got the problem I've got... $self->req gets me an error about MyApp not having a ->req method.
12:12 denny I don't have $c or $app though, and I apparently don't understand where to get t hem from
12:12 denny $self->app is the same as $self in startup() from what I can tell
12:13 denny do I need to be in a controller rather than the main app file before I can use ->req?
12:16 batman denny: yes. hooks are defined in startup()
12:17 batman ah! yes. sub { my $c = shift; .... } # not $self, use $c
12:17 denny aha
12:17 batman $self == $app in startup()
12:18 batman but you don't rename $self to $app in startup, since $self is in "app context", so it's fine calling it $self.
12:18 batman $c on the other hand need to be called $c inside the app class (in hooks, helpers, ...) to make it readable.
12:18 batman and less confusing.
12:18 abraxxa left #mojo
12:21 denny *nod*  thanks  :)
12:48 marty joined #mojo
12:48 marty joined #mojo
12:49 sri need more sticker pictures!
12:50 sri funny thing, i've not seen a raptor one yet, even though there are more of those out there :o
13:09 Lee c9b65981e seems to have broken some of our routes, and i don't know if it's a bug or not: https://gist.github.com/leejo/8fc1712f34120838570c
13:18 Lee updated with the output of routes, the regexp has changed to the extent that i suspect this is a bug
13:18 Lee maybe...
13:20 jontaylor joined #mojo
13:21 irqq joined #mojo
13:33 hummeleBop joined #mojo
13:34 sri Lee: none of that makes any sense
13:34 sri there are inconsistencies
13:35 sri like those routes are in the wrong order, and the old ones have no format regex in the routes -v output
13:35 Lee yes, we have ordering issues that have been revealed by this change
13:35 sri you've edited the data and made it impossibel to use
13:36 Lee which data?
13:36 sri you say "We have two routes, defined in this order:", but you don't
13:36 Lee i'm trying to get this down to a minimal test case
13:37 sri routes -v output contradicts your earlier claims
13:38 Lee in what sense?
13:39 sri the scenario you describe cannot happen
13:40 sri routes don't just change order
13:41 sri so, you're prolly doing some weird stuff you're not showing
13:42 sri better look into that first before asking about a bug
13:45 Lee weird stuff? such as hooks/redirects/etc?
13:52 Lee i've updated the gist with the test + test run. there is no doubt we have ordering issues (i'm writing a test to fix these) but i'm dubious about there being any other weird stuff
13:52 Lee just something to bear in mind
13:53 jontaylor joined #mojo
13:53 sri maybe try adding a test case to the mojolicious core tests
13:53 sri routes have thousands
13:53 Lee ok, will have a look at that too
13:54 sri starting point https://github.com/kraih/mojo/blob/master/t/mojolicious/routes.t
13:55 Lee ta! is there a trivial way to get the end controller + method for a given route string (e.g. /cause/6203/campaigns/17047/ should give me "MojoRouter::Public::Cause" and action "campaign" in this case)
13:56 Lee i'm guessing the stack stuff around line 500(ish)
14:06 neilhwatson joined #mojo
14:07 Lee k, got it
14:44 orev joined #mojo
15:23 good_news_everyon joined #mojo
15:23 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vgfnf
15:23 good_news_everyon mojo/master 9903682 Sebastian Riedel: some operations can also be resumed
15:23 good_news_everyon left #mojo
15:29 sri travis is getting worse
15:30 sri it's like they stopped caring
15:31 vicash hello. how does one launch a minion worker on a different server and how does that worker know to connect back to the main mojo app ?
15:32 sri it doesn't, you clone the app
15:32 sri only thing shared is the database
15:32 vicash is the connection between the minion worker and the app over TCP ?
15:33 sri there is no connection
15:33 vicash or is the database the "transport bus"
15:33 vicash ok got it
15:34 vicash if the minion worker has to execute a C++ program, do I do that using the system() call in the add_task() method ?
15:38 jberger vicash: the coderef you pass to add_task is just perl
15:38 jberger do with it as you would normally
15:39 vicash i am trying to find a way to get an intermediate state of a running job through the Minion::Job api. so if I use system('mycpp') in the add_task() function and the target program starts running, is there a way to periodically call a Timer event where I can connect to the mycpp program on a socket and query it ?
15:39 vicash jberger: thanks.
15:39 jberger vicash: system blocks (usually(
15:39 jberger )) # ocd
15:40 genio heh
15:40 jberger you could use a pipe open and put an io watcher on that
15:41 jberger but even if you do, minion doesn't really have any way to do anything with the data (natively)
15:42 vicash hmm. well my problem is that the C++ app can run for an hour or so. the user uses the Mojo app to start it with some defined inputs and then may want to view the state of the C++ app during its run. The C++ app generates some data in SQLite db which I want to then pull into Mojo app and display live if possible or update every few seconds.
15:42 dod joined #mojo
15:43 sri yea, no native support for progress updates
15:43 vicash this allows the user to cancel the run, or modify it. We used to do this with a desktop C++ application written about 7 years ago and are now migrating it to a web app
15:43 sri some job queues have that, like kue
15:44 sri https://github.com/Automattic/kue#job-progress
15:45 sri been thinking about something like that for minion
15:45 sri it's not very high on the list though
15:46 sri i would prolly implement it as a jsonb field in Minion::Backend::Pg for custom metadata
15:47 vicash ok
15:47 sri something generic, where arbitrary data can be stored st any time
15:47 vicash is there a way to do something hackish for now using whatever modules Mojo has ?
15:47 jberger vicash: like I said you can pipe open your process, add an io watcher, then update some table row on your own
15:48 sri you go the Mojo::Notifier route, and have your own storage backend
15:48 sri umm, Minion::Notifier
15:49 jberger Minion::Notifier only subscribes to finish/fail job events
15:49 vicash jberger, sri: ok i will look it up. the io watcher is using which module ?
15:49 jberger though if Mojo added a progress event I would attach to it in Minion::Notifier too
15:50 jberger vicash: the code I'm about to show is used for a very different purpose, but is somewhat close to what you might try
15:50 jberger https://github.com/jberger/Mojolicious-Plugin-TailLog/blob/master/lib/Mojolicious/Plugin/TailLog.pm#L16-L19
15:51 * vicash looks
15:51 jberger in your task definition, use the pipe open (line 16), attach it to a stream (18) and when the read event happens (19) you can log it to a database (rather then write to a websocket as that does)
15:52 vicash jberger: thanks. the Mojo::IOLoop class is what I need to look up
15:52 jberger vicash: you'll also need to manually start the Mojo::IOLoop since the loop is not running when a worker runs a job
15:53 jberger oh and line 21 is important too
15:53 vicash jberger: i might end up using your plugin to tail log files on the same system !!
15:54 jberger vicash: there's a reason that didn't end up on CPAN
15:54 jberger its not a great plugin
15:54 jberger use with care
15:54 vicash ok. will do. for now I will try to get all the moving pieces working together with Minion and the progress notifications using the open pipe.
15:55 gryphon joined #mojo
15:55 AndrewIsh Hi guys. I've got a simple template substitution: <% foo %> in my template. But when I render, I'm getting the following: "Can't locate object method "foo" via package "<my template markup>"
15:55 ashimema anyone know why Mojo might think my template is a controller
15:55 AndrewIsh Has anyone seen anything like this before?
15:55 ashimema Can't locate object method "foo" via package "<div class="main-body container">...
15:56 ashimema haha.. I'll let andrew ask
15:56 AndrewIsh :)
15:56 * Grinnz_ has a feeling these questions are related somehow...
15:56 AndrewIsh Grinnz_ would be spot on...
15:56 ashimema indeed..
15:57 jberger AndrewIsh: is foo a function, a method, what?
15:57 jberger helper?
15:57 ashimema it's a stash variable
15:57 jberger you mean <%= $foo %>
15:57 sri http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Embedded-Perl
15:58 jberger <% run_some_perl_code_ignoring_return_value() %>
15:58 jberger <%= run_some_perl_code_returning_an_escaped_string() %>
15:59 asarch joined #mojo
15:59 jberger well, yeah, just read the docs :-P
15:59 sri jberger: you forgot the semicolon
15:59 jberger sri: yep
15:59 jberger that's why the docs are better
15:59 vicash jberger: will I need to do a Mojo::IOLoop->start once for each worker or once for each job ?
15:59 jberger vicash: pipe open doesn't block
15:59 jberger Mojo::IOLoop->start blocks
16:00 jberger so if you pipe open, attach listeners but don't block the worker just exits
16:00 ashimema ack
16:00 ashimema how did I miss that!
16:00 ashimema thanks jberger
16:00 AndrewIsh rghhhh!
16:00 AndrewIsh Thanks jberger and sri :)
16:01 AndrewIsh Is it clear we don't use templates very often ;-)
16:01 jberger vicash: so I'd suspect you would want to ->start at or near the end of the task callback
16:01 sri buy more t-shirts! :) </sellout>
16:01 jberger sri++
16:01 vicash jberger: got it
16:01 jberger MY $%^&*( stickers are still "in transit"!!!!
16:01 * jberger needs to call the post office
16:02 * jberger goes postal
16:05 sri demand is so high they get stolen in transit :o
16:07 * sri opens https://github.com/kraih/minion/issues/25
16:07 * ashimema loves that issue
16:08 sri it's unlikely i'll get around to working on those features anytime soon... but who knows, maybe some company steps up and decides to sponsor one
16:08 jberger I like the backend structure of mine, its just the front-end that needs work
16:08 jberger https://github.com/jberger/Minion-Monitor
16:09 sri oct 3 is a long time ago :o
16:15 good_news_everyon joined #mojo
16:15 good_news_everyon [mojo] kraih tagged v6.43 at a94458c: https://git.io/vgfuj
16:15 good_news_everyon left #mojo
16:15 c--_ joined #mojo
16:16 good_news_everyon joined #mojo
16:16 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vgfzW
16:16 good_news_everyon mojo/master 3e09394 Sebastian Riedel: bump version
16:16 good_news_everyon left #mojo
16:16 disputin joined #mojo
16:30 vicash sri: what are the sponsorship costs for that feature ?
16:30 preaction jberger: perhaps now that we're about to work in the same office again, we can get together on that ui thing?
16:30 jberger preaction: perhaps
16:30 preaction in theory i need approximately that for Cradle, so i'm interested from that angle as well
16:31 jberger preaction: I really think its a good case for angular
16:31 jberger and since you already grok that
16:32 preaction current $work just moved away from angular to all backend templates, which is nice. i've got half a mind to build an Angular template plugin to do backend and frontend rendering (backend rendering with frontend enhancement, at least, with less duplicate code)
16:33 preaction (by nice i mean "now i understand everything, but i'm still not sure why")
16:34 sri vicash: hard to say, but i'd guess around $5k
16:35 jberger you know, I was mostly concerned with monitoring, but if it also exposed job insertion and control via an api, (which I'm assuming it would) that could make Minion a viable stand-alone application
16:36 sri yea, i think there would be a REST api
16:36 jberger someone could have a Dancer or Rails etc app and it could use HTTP::Tiny to call to their Minion api instance and insert a job
16:36 ashimema any hints/tips on moving from using minion in development to using it in deployment.. whilst there's a minion crowd about
16:37 sri minion is not actually that mojolicious specific, there's just $minion->app, which we use for logging
16:37 ashimema i.e I've just switched my app from morbo to hypnotoad via a taodfarm init script and am now moving onto starting minion workers in a production manor too
16:37 jberger sri: I should say, of course there would be an api, my monitor already had one (https://github.com/jberger/Minion-Monitor/blob/master/lib/Minion/Monitor.pm)
16:38 jberger I just hadn't thought of running it as the only Mojo part of a larger project
16:38 ashimema as aposed to just using the plugin.. so './script/app minion worker'
16:39 jberger ashimema: for toadfarm stuff, you probably need to ask batman
16:39 ashimema It wasn't really directly related to toadfarm
16:39 sri for the record i think the minion scheduler feature should also be doable with $5k
16:39 ashimema more a 'how do you guys deploy workers in production' question ;)
16:39 ashimema minion scheduler?
16:40 ashimema #24.. I see
16:40 sri https://github.com/kraih/minion/issues
16:41 jberger sri: at my $old_job I would have lobbied for that feature
16:41 ashimema I'm working on a scheduling piece with minion at the minute as it happens :)
16:41 jberger and before they went bankrupt (actually, before the insurance standards shift that cause the bankruptcy) we might have had the money for it too
16:42 sri the price of http/2 support in mojolicious is down to $20k now i think, since the refactoring got a lot easier
16:42 dvinciguerra joined #mojo
16:42 ashimema though at the moment I'm working on 'this task can only continue to run between x and y o'clock'
16:42 sri (just educated guesses though)
16:43 ashimema anyone even got any hints on where to possibly start looking for minion workers in production ideas?
16:43 sri ashimema: people deploy it like any other daemon
16:45 jberger ashimema: since getting the -j option, an init script is really pretty simple
16:45 ashimema K, sounds simple enough then
16:45 * ashimema goes to find what the -j option means ;)
16:46 jberger ashimema: this was my minion init script from $old_job running on FreeBSD (rc.subr)
16:46 jberger https://gist.github.com/jberger/dc540bdb05df4f438231
16:47 preaction ashimema: see also the Daemon::Control module, it's really handy for making these
16:47 ashimema thanks jberger, that's super useful to get me off the starting blocks
16:48 PryMar56 joined #mojo
16:48 ashimema thanks preaction
17:13 orev sri, jberger: you guys ever consider going on the floss weekly podcast?  it's hosted by randal schwartz, so you'd probably have a pretty good perl discussion going on
17:14 sri randal was in this channel for a time :)
17:14 jberger orev: that does sound like fun
17:14 jberger though it would be sri's to do if he wanted
17:14 orev I'm sure, but I don't remember seeing a podcast on it
17:15 jberger Mojo really is his, even if I sometimes carry the torch
17:15 sri naah, jberger should do it ;p
17:16 orev not sure if you listen to floss, but I'm surprised how little perl content is on there
17:16 sri marcus was for us on the perl podcast a few years back
17:17 jberger I really should listen to more open source podcasting
17:17 sri just because i was at a mojoconf doesn't mean i do public appearances now ;p
17:17 jberger I'll admit to being too much into the perl bubble
17:17 orev only perl one I heard was on strawberry perl
17:18 orev floss is nice because it's not just for perl people, each show is a totally different thing, so it's a better way to reach new people
17:19 orev the best way to get on is to contact merlyn directly.  he prefers to schedule directly with the guests than to have a middle man http://www.stonehenge.com/merlyn/
17:29 Kogurr joined #mojo
17:33 * batman got stickers! https://twitter.com/jhthorsen/status/694210279970861060 :)
17:37 sri shiny!
17:37 sri do the raptor teeth look allright on the sticker?
17:37 sri hard to see on the picture
17:39 marcus I got my sticker today as well
17:39 sri \o/
17:39 * sri retweets
17:40 marcus sri: Would be great to have a big one where the cloud could cover the apple logo.
17:40 marcus I put it in the corner now)
17:41 sri can't add more stickers to stickermule atm., every additional one costs like $10 for now
17:42 marcus oh nose
17:42 marcus guess we need to sell more of these first?
17:42 sri a lot ;p
17:43 sri only making a few cent per sticker, with about 100 sold so far
17:43 * marcus retweets batman to increase sales.
17:44 batman sri: yeah :) https://goo.gl/photos/bEaQAxXtg8scpweA8
17:44 sri there is no money in swag
17:44 marcus What about swagger?
17:44 marcus I'm sure stickermule runs of with some profit
17:44 sri batman: closer!
17:45 marcus if we could get it done cheaply in china, with free shipping, you could end up with moar
17:45 sri is there actually a chinese stickermule?
17:46 marcus well, there's alibaba http://www.alibaba.com/product-detail/Custom-high-quality-waterproof-vinyl-sticker_1740757896.html?spm=a2700.7724858.35.1.A4XdLM&amp;s=p
17:46 sri :o
17:48 marcus I wonder if you could combine it with amazon fullfilment apis to get a better margin diy stickermule
17:49 sri the whole process at stickermule is pretty bad, dunno if they are slacking because of lack of competition
17:51 sri batman: lol https://twitter.com/digitalocean/status/694214921790300160
17:53 batman sri: https://goo.gl/photos/chNEHLaEN4zU6NtD9
17:54 sri batman: thanks, that looks pretty decent
17:54 batman you're welcome :)
17:55 sri was a little worried about the teeth
17:59 batman yeah, makes sense.
17:59 batman but it looks great :)
18:03 sri metacpan knit cap looks kinda cool https://i.imgur.com/nUyWJFu.png
18:04 bwf http://www.unixstickers.com/
18:07 sri or an umbrella :D https://i.imgur.com/Oe3ajAJ.png
18:07 lluad joined #mojo
18:12 sri bwf: not much information on how to sell stickers with them
18:13 bwf looks like you have to request and upvote here:  https://trello.com/b/WcWf6kdF/unixstickers-public-roadmap
18:45 mcsnolte joined #mojo
18:54 trone joined #mojo
19:09 dod joined #mojo
19:15 dod joined #mojo
19:17 batman joined #mojo
19:32 jberger squeeeee https://rt.cpan.org/Ticket/Display.html?id=111466
19:47 sri marcus, batman: more competition http://shout-irc.com/
20:00 jberger Oo
20:04 sri first time i hear about https://github.com/cheeriojs/cheerio
20:07 sri been a long time since we got a request or complaint for Mojo::DOM
20:09 zivester joined #mojo
20:19 disputin joined #mojo
20:23 tduponc joined #mojo
20:30 dvinciguerra joined #mojo
20:40 PopeFelix joined #mojo
20:41 PopeFelix Is there a way to specify a custom mode (e.g. "development", "production", "foobar")  for a Mojolicious app at runtime?
20:41 PopeFelix I'm trying to load a custom configuration file for a unit test.
20:41 jberger PopeFelix: BEGIN{ $ENV{MOJO_MODE} = '...
20:41 jberger ' }
20:41 jberger stupid enter key
20:41 PopeFelix jberger, Just what I needed, thanks.
21:01 sugar__ joined #mojo
21:07 disputin joined #mojo
21:24 marty joined #mojo
22:23 chansen_ joined #mojo
22:29 asarch joined #mojo
22:37 zivester joined #mojo
22:38 marty joined #mojo
22:56 bpmedley jberger : Do you still have that code for minion_ui of mine that you modified?
22:57 jberger I think I have it in a fork in my github
22:57 bpmedley Would you make a PR please?
23:04 jberger bpmedley: if its there you can just add my github as a remote to yours and pull
23:05 bpmedley Cool
23:20 orev joined #mojo
23:33 marty joined #mojo
23:58 disputin joined #mojo
23:59 good_news_everyon joined #mojo
23:59 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vgUYN
23:59 good_news_everyon mojo/master ed9e5f8 Sebastian Riedel: improve Mojo::JSON performance slightly
23:59 good_news_everyon left #mojo

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