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

IRC log for #mojo, 2016-03-16

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

All times shown according to UTC.

Time Nick Message
00:05 sri yes, there is
00:06 sri with a postprocess callback
00:10 jberger sri++ batman++
00:17 good_news_everyon joined #mojo
00:17 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vaum4
00:17 good_news_everyon mojo/master aea16c6 Sebastian Riedel: no need for additional stat calls
00:17 good_news_everyon left #mojo
00:17 sri it looks like it should be slower, but it isn't ;p
00:18 sri we can do that since we sort the files anyway
00:25 pink_mist wait, is using $_ really correct?
00:25 sri yes, with no_chdir it's the same as $File::Find::name
00:26 sri which actually sucks... but... yea
00:26 pink_mist oh
00:33 sri batman: so yea, there is no more extra stat calls, so filtering the output of files() should feel better now :)
00:36 pink_mist now I wonder if it's possible to abuse _ for that :P probably not :P
00:37 sri nope
00:37 sri tried that first :)
00:39 McA2 joined #mojo
00:47 mitya joined #mojo
00:47 mitya joined #mojo
00:52 mitya left #mojo
00:57 mitya joined #mojo
00:58 mitya joined #mojo
00:58 ramortegui joined #mojo
01:05 ivi joined #mojo
01:08 asarch joined #mojo
01:10 ivi joined #mojo
01:14 lluad Is t/mojo/daemon.t failing if MOJO_LISTEN is set in the environment a bug or a "well, don't do that, then"? I'm assuming the latter, but thought I'd ask.
01:15 ivi joined #mojo
01:19 marty joined #mojo
01:20 marty joined #mojo
01:20 Grinnz iirc, a lot of tests can fail if you set random MOJO_ vars in your env
01:20 ivi joined #mojo
01:20 Grinnz ideally you'd just set those when starting the commands that they apply to
01:21 Grinnz (iow: a global MOJO_LISTEN in your env might make it difficult to run more than one app to begin with)
01:33 lluad Yeah, it's just on my dev box; production box has things set up a little more sanely.
01:38 sri http://mojolicious.org/perldoc/Mojolicious/Guides/FAQ#Do-I-need-to-clean-my-environment-before-testing-Mojolicious
01:38 lluad Aha. It is a FAQ. :)
02:01 ramortegui joined #mojo
02:05 ramortegui_ joined #mojo
02:08 Gedge joined #mojo
02:13 mcsnolte joined #mojo
02:23 disputin joined #mojo
02:33 good_news_everyon joined #mojo
02:33 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vau04
02:33 good_news_everyon mojo/master 6bfc03a Sebastian Riedel: fix bug where Morbo would ignore the --verbose option
02:33 good_news_everyon left #mojo
02:33 sri i guess these kinds of bugs go unnoticed if people downgrade for another morbo bug ;p
02:41 good_news_everyon joined #mojo
02:41 good_news_everyon [mojo] kraih tagged v6.56 at 8327bf3: https://git.io/vau0x
02:41 good_news_everyon left #mojo
02:43 good_news_everyon joined #mojo
02:46 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vauEJ
02:46 good_news_everyon mojo/master dac01cd Sebastian Riedel: bump version
02:46 good_news_everyon left #mojo
02:52 good_news_everyon joined #mojo
02:52 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vauEj
02:52 good_news_everyon mojo/master 1806ccb Sebastian Riedel: just check the values
02:52 good_news_everyon left #mojo
02:54 * sri vanishes in a cloud of smoke
03:21 jberger sri++
03:36 noganex joined #mojo
04:53 Grinnz * GumbyPAN CPAN Upload: Mojolicious-Plugin-CustomLog-0.02 by WJX https://metacpan.org/release/WJX/Mojolicious-Plugin-CustomLog-0.02
04:53 Grinnz Not seeing the point of this, seems to be reimplementing Mojo::Log as a Mojo plugin
04:57 irqq joined #mojo
05:08 inokenty-w joined #mojo
06:11 batman https://github.com/kraih/mojo/commit/aea16c61fd730a14053539332707ff3f770e7277 <-- hope there won't be any stupid bug like $dir contains trailing / and $_ doesn't
06:11 batman ...because that's a nifty hack :)
06:45 dod joined #mojo
06:50 ichi joined #mojo
06:50 dod joined #mojo
07:26 dod joined #mojo
07:38 dod1 joined #mojo
07:49 osfabibisi joined #mojo
07:53 Vandal joined #mojo
07:59 dod joined #mojo
08:05 dod joined #mojo
08:22 trone joined #mojo
08:48 arthas joined #mojo
09:16 dhg joined #mojo
09:24 melo joined #mojo
09:35 irqq joined #mojo
10:08 pink_mist batman: the documentation for File::Find says it won't
10:30 batman pink_mist: good :)
10:42 dod1 joined #mojo
10:43 mitya joined #mojo
10:48 dod joined #mojo
10:50 punter joined #mojo
11:07 marty_ joined #mojo
11:25 kaare joined #mojo
11:26 disputin joined #mojo
11:45 yakudzo joined #mojo
12:42 neilhwatson joined #mojo
13:17 asarch joined #mojo
13:27 kes joined #mojo
13:32 kes Hi. If I have compilation error in the controller I get error about that some stash variable is not defined at template instead of that compilation error. After replacing in the template $var to 'stash->{ var }' then I can view compilation error that is showed by mojo/debug.html.ep"
13:33 kes I there a way to fix that so I may view compilation error without rewriting templates?
13:35 dod joined #mojo
13:35 kes it seems some checks of controller compilation error should be done before template compilation
13:45 marty_ joined #mojo
13:48 al237 joined #mojo
13:51 jb360 joined #mojo
13:53 al237 Thanks for the quick fix of the vim .swp files bug
13:53 al237 I raised the exact same issue with a popular javascript framework and it got lost in the other hundreds of issues, without even an acknowledgement
13:55 jberger al237: glad to help! Happy Perling!
13:56 jberger kes: that is literally a perl compilation exception
13:57 al237 left #mojo
13:58 kes but mojolicious goes to compile template despite on that. And shows errors in template whereas errors are in controller
13:59 jberger ? the error was in compiling the template
14:00 jberger Do you mean that the user error is in not stashing the required variable?
14:00 kes if compilation error occur in controller mojolicious shows unexistant error in template
14:01 kes yes, that variable is not in stash because of compilation error of controller
14:02 jberger I think i fundamentally disagree, you have a strict violation in your template
14:02 jberger You can avoid it by setting a default stash value
14:02 jberger Or by manually extracting the variable from the stash
14:03 kes yes, I do that. Imagine syntax error in controller for that template.
14:03 jberger But the problem is fundamentally that you require a variable that you didn't declare
14:04 kes But better to show 'You have syntax error...at controller' instead of 'YOu have not declared variable ... at template'
14:05 pink_mist I disagree
14:05 kes to find out what is the syntax error in controller I should rewrite templates
14:05 kes I do not know any ways to see what were wrong in controller
14:05 pink_mist mojolicious can't know that you didn't write your controller properly. all it knows is what perl knows, namely that your template tried accessing a var that didn't exist.
14:06 absolut_todd joined #mojo
14:06 jberger kes: just for a moment, for the sake of argument, try not to think of how you believe it should work and think about what is actually happening
14:07 jberger the template is preprocessed via the Mojo::Template substitution engine and then it is string eval-ed into being a function
14:07 jberger the error is caught during that eval
14:07 jberger Mojo has no idea what it is
14:08 jberger (which is actually a strict vars failure)
14:08 kes May I stop template rendering if there are error for controllers?
14:08 jberger to be able to throw a more meaningful exception there, Mojo would have to get into parsing perl exceptions
14:08 jberger and that's something that we really don't want to get into
14:10 jberger it also assumes that the variable you are missing is one that you meant to stash
14:11 jberger what if I just had a temporary variable in the template and forgot to use 'my'
14:11 jberger it would be the same exception and now you get the crazy message that you forgot to stash '$tmp' at Controller::method line <<line that renders the template>>
14:12 jberger also, don't forget automatic rendering, at which point where do you report the error from?
14:12 mitya joined #mojo
14:12 jberger does that make sense?
14:12 martin joined #mojo
14:13 kes I may wrong, but I suppose the template is compiled after $self->render() call. So if in the controller I get syntax error why template is still compiled?
14:13 jberger but you never need to call render
14:13 jberger automatic rendering happens after the controller if you didn't render anything
14:13 kes > after the controller
14:13 kes but controller has syntax error
14:14 jberger and that still doesn't address the other issue (forgotten declaration of a temporary variable)
14:14 jberger kes: no it doesn't then controller method (action) has finished
14:14 jberger s/then/the
14:18 salva joined #mojo
14:20 kes jberger: thank you for explanation.
14:20 jberger np
14:21 jberger even that aside, for me the biggest thing I that I wouldn't want to get into parsing the perl exception
14:26 salva0 joined #mojo
14:27 mcsnolte joined #mojo
14:31 deserted joined #mojo
14:38 salva joined #mojo
15:04 gryphon joined #mojo
15:05 mdom Short sanity check: I want to refetch an url with minion every 60 seconds. So i enqueue it, the task runs and as last statement in the task i enqueue the url again?
15:07 jberger mdom: that is a valid workflow yes
15:08 mdom jberger: Good, thanks! :)
15:10 jabberwok In Tutorial.pod, would it be useful to explain (under Hello World) that in "app->start" ... app is a subroutine automatically generated (during the import of Mojolicious::Lite) that returns the singleton application object?  Because it's not magic, it's just deep Perl. Or is that too deep?
15:12 jberger jabberwok: that is touched on quickly http://mojolicious.org/perldoc/Mojolicious/Guides/Tutorial#Hello-World
15:13 jberger of course the Tutorial used to be the Mojolicious::Lite documentation itself
15:13 jberger so maybe it could get a little tweak in that direction
15:21 sri the word "functions" could be a link to the FUNCTIONS section of Mojolicious::Lite i suppose
15:23 sri or you could add another sentence linking to get and app
15:25 jabberwok ahh, very good.  Docs have improved in the late versions. There is quite a bit of "fan-out" lurking beneath the surface of all these Object things, isn't there; the challenge is distilling the relevant bits.
15:27 jabberwok perhaps just "...a few functions ++, like C<get> and C<app> in the example below,++ imported when you use..."
15:32 jberger or maybe it should just say something like "... enabled and the Mojolicious::Lite DSL keywords are imported when ..."
15:32 jberger where I'm 50/50 on including the word DSL
15:33 jabberwok someone will complain "But I'm on cable, not DSL" =sigh=
15:33 * jberger slaps jabberwok with a fish
15:33 Grinnz_ fios!
15:33 Grinnz_ 4G!
15:34 jabberwok gosh, that fish must be 20 years old now
15:34 jberger specifically its the monty python fish slapping dance fish, so quite a bit old than that I'm afraid
15:35 jabberwok oh no not a Python \reference
15:36 jabberwok a short section treating ::Lite as a DSL might actually clear things up
15:39 sri maybe close this as incomprehensible https://github.com/kraih/mojo/issues/936
15:41 jberger I'm ok with that
15:43 jberger I think the poster just doesn't understand the difference between under and other nested route types
15:45 Grinnz_ I was mostly confused by the use of $r-> in ::Lite
15:45 Grinnz_ I think "startup routine" was also mentioned so I think it actually has nothing to do with Lite
16:16 jabberwok is it me, or does this line from Mojolicious::Guides::Cookbook under 'Adding commands' produce a syntax error? >> say for @{$self->app->secrets} if $args[0] eq 'secrets'; <<
16:21 marty joined #mojo
16:29 salva joined #mojo
16:33 salva joined #mojo
17:16 jberger are you using Mojo::Base or else enabling the say feature
17:16 jberger nothing else there looks like a syntax error
17:17 jberger what error do you get?
17:17 pink_mist can you really chain postfix operators?
17:17 * pink_mist thought you couldn't
17:17 jberger oh, hmmmmm
17:17 sri yea, looks like a typo
17:18 sri you'd have to use map to make it a oneliner
17:19 pink_mist or grep; say for grep { $args[0] eq 'secrets' } @{...}
17:19 pink_mist :P
17:20 sri i guess if/elsif would look better in context
17:21 sri if ($args[0] eq 'secrets') { say for @{$self->app->secrets} }
17:21 sri should also fit on one line
17:40 Grinnz or do { say for ... } if ...
17:41 Grinnz but do is cheating :P
17:43 good_news_everyon joined #mojo
17:43 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/va2JY
17:43 good_news_everyon mojo/master 04f8e7e Sebastian Riedel: fix typo in cookbook
17:43 good_news_everyon left #mojo
17:58 PryMar56 joined #mojo
18:24 johnP joined #mojo
18:26 johnP Hello guys, how do I change the passphrase? I've just started learning mojolicious, but I don't find the documentation too clear.
18:27 sri http://mojolicious.org/perldoc/Mojolicious/Guides/FAQ#What-does-Your-secret-passphrase-needs-to-be-changed-mean
18:31 johnP well yeah but if I use $app it throws an error, while if I use &app it works.. is that normal?
18:33 Grinnz in a Mojolicious::Lite app, it's app->secrets https://metacpan.org/pod/Mojolicious::Guides::Tutorial#Sessions
18:33 Grinnz don't use & to call subroutines
18:34 HtbaaPi joined #mojo
18:35 johnP Oh I see so $app->secrets is for normal mojo and app->secrets is for the lite version ?
18:35 Grinnz in a full app, $app is a parameter to the startup method
18:39 johnP all the examples I found online using Mojolicious::Lite the parameter is just app. What do you mean by full app?
18:40 sri http://mojolicious.org/perldoc/Mojolicious/Guides/Growing#Differences
18:41 johnP thanks sri this link is very useful I had not seen it.
18:42 sri there's an overview here http://mojolicious.org/perldoc
18:50 marty_ joined #mojo
19:07 ichi joined #mojo
19:09 dhg joined #mojo
19:31 patrickz joined #mojo
20:06 irqq joined #mojo
20:06 punter joined #mojo
20:19 marty joined #mojo
20:27 melo joined #mojo
20:34 jabberwok also in that "Adding commands to Mojolicious" section -- in what location would I put a file -- spy.pm ? -- for the shell command >> $ mojo spy secrets << to actually be picked up by the "mojo" script?
20:40 simcop2387 joined #mojo
20:41 simcop2387 So I'm probably doing something stupid.  I'm trying to use Mojo::IOLoop::ProcBackground to run something in the background during a request and then send out a result later (using render_later, etc.) i'm running into the "can't call 'res' on an undefined value" error when the connection drops (browser refresh).  Solutions seem to say use Mojo::IOLoop::Delay, but I'm not sure how I could manage to
20:41 simcop2387 make that work with ::ProcBackground
20:43 sri http://mojolicious.org/perldoc/Mojolicious/Controller#tx
20:45 simcop2387 the tx isn't disappearing like other things on the web have said it should (saying it's a weakened ref), nor is is_finished being set.  I'm not sure what else I should be looking at
20:46 jberger jabberwok: lib/Mojolicious/Commands/spy.pm
20:47 jberger ummm wait
20:47 jberger lib/Mojolicious/Command/spy.pm
20:48 jberger and that's assuming that you are making the package Mojolicious::Command::spy
20:48 jberger you could also add it to some other package as long as you add that namespace to the app's commands instance like so http://mojolicious.org/perldoc/Mojolicious#commands
20:50 jberger simcop2387: if the $tx isn't disappearing how could you be calling res on an undefined value
20:50 jberger ?
20:50 jberger you're welcome to post a minimal example (keyword minimal :-P)
20:52 simcop2387 jberger: i had been checking $c->tx instead of storing it at the start and checking $tx->is_finished.  (pink_mist in freenode/#perl helped)
20:52 jberger simcop2387: oh
20:52 jberger for the record, this is why crossposting in multiple channels is discouraged
20:58 simcop2387 i generally don't but he came around after i had waited there a while
21:21 melo1 joined #mojo
21:32 melo joined #mojo
21:38 bobkare joined #mojo
21:44 melo1 joined #mojo
22:37 heytrav joined #mojo
22:43 jabberwok so for the state "you can just add new ones [commands] and they will be picked up automatically by the command line interface" [Mojolicious::Guides::Cookbook] you would have to write a cpan-installable module or else
22:43 jabberwok put something into e.g., /home/bill/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/Mojolicious/Command ... probably not a good idea to be putting files into your local perl's diretory manually?
22:43 jabberwok *for the *statement
22:44 jabberwok Am just trying to make the Cookbook examples actually work as a tutorial.
22:45 preaction no, as long as it's either named Mojolicious::Command::something and is on PERL5LIB, it'll be picked up. you can add new class names to search for using $app->command->... something
22:46 preaction Perl will search all of @INC for the module. multiple @INC can have Mojolicious/Command/* and they'll all be searched through
22:47 Grinnz_ also, normally you'd just put it in your app's namespace then add a namespace to $app->commands like jberger said
22:47 preaction $app->commands->namespaces is where you can add custom namespaces if you want
22:47 Grinnz_ the only reason to put it in the Mojolicious::Command:: namespace is if you're making a global mojo command to release on cpan or so
22:47 Grinnz_ i.e. not specific to your app
23:05 mitya joined #mojo
23:35 patrickz left #mojo
23:49 bpmedley simcop2387 : Did you get your ProcBackground issue fixed?
23:57 pink_mist heh did

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