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

IRC log for #mojo, 2014-03-20

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

All times shown according to UTC.

Time Nick Message
00:26 d4rkie joined #mojo
00:33 dvinciguerra joined #mojo
00:56 jack joined #mojo
01:56 jberger_ joined #mojo
02:02 jhg joined #mojo
02:06 jberger_ joined #mojo
02:21 laouji joined #mojo
02:23 howitdo left #mojo
02:25 rem_lex|pivo joined #mojo
02:48 klapperl_ joined #mojo
03:10 Eke- joined #mojo
04:44 hesperaux__ joined #mojo
05:07 hesperaux joined #mojo
05:48 damaya joined #mojo
06:02 damaya Question: is there a better, more acceptable way to do this: http://pastebin.com/HTEtA7wb
06:02 damaya Or is how I am doing it just fine? By the way, in Favorites.pm I have a subroutine for each task (view, create..).
06:09 sujithm joined #mojo
06:29 hesco joined #mojo
06:36 sujithm_ joined #mojo
06:39 sujithm joined #mojo
06:41 sujithm_ joined #mojo
06:44 sujithm joined #mojo
06:46 sujithm_ joined #mojo
06:54 denis_boyun joined #mojo
07:09 dpetrov_ joined #mojo
07:11 Vandal joined #mojo
07:14 Eke- joined #mojo
07:17 hummeleBop joined #mojo
07:45 dod joined #mojo
07:58 denisboyun joined #mojo
07:59 eseyman joined #mojo
08:00 nic joined #mojo
08:16 rem_lex| joined #mojo
08:19 dod joined #mojo
08:22 Bravo13 joined #mojo
08:24 Negor|2 joined #mojo
08:30 spoot joined #mojo
08:31 trone joined #mojo
08:35 basiliscos joined #mojo
08:38 eseyman joined #mojo
08:49 rawler joined #mojo
09:18 fhelmber_ joined #mojo
09:22 sujithm joined #mojo
09:23 sujithm joined #mojo
09:27 sujithm_ joined #mojo
09:30 ver joined #mojo
09:31 spoot joined #mojo
09:42 edestler joined #mojo
09:42 Dandre Hello,
09:43 Dandre I have to write a test for a process that must wait for a 30s timeout. I don't know how to do this
09:45 Dandre in fact there is some queue in my model and I can retreive data put into it after a 30s delay. Do you have any hint to write a test for this. Must I write some test logic to shorten this timeout only for test purpose? and how?
09:52 spoot joined #mojo
09:53 korjavin joined #mojo
09:57 korjavin Hello all. I need help. I am trying to use mojo:template in my console application, and want to use partial templates, but can't do include helper to work. Get the error : Undefined subroutine &Mojo::Template::SandBox::include called at ...
09:59 korjavin I tried to add use Mojolicious::Plugin::DefaultHelpers to my template, but looks like it is not enough
09:59 dvinciguerra joined #mojo
10:02 edestler joined #mojo
10:02 moritz korjavin: using isn't enough
10:03 korjavin I tried alot for registering, but still have not success. May be any snippets?
10:04 moritz I'd create a Mojolicious object, and use $m->plugin('DefaultHelpers')
10:04 moritz or look at how the tests set up plugins for Mojo::Template
10:08 korjavin Can you please look at http://pastebin.com/wXLTaQDZ
10:09 korjavin Looks like i already have include helpers (warnings about replacing)?, but something still wrong
10:12 moritz korjavin: I don't know if I can help you if you produce a small, runnable example that exhibits your problem, but I know that without it, I certainly can't
10:12 korjavin Okey, sure. 1 min.
10:16 korjavin There is my gist https://gist.github.com/korjavin/9660836 with striped code.  I hope its clear what I want. (Mostly I dont know what to add into document template for "include" start working).
10:18 moritz korjavin: but that doesn't contain the code from http://pastebin.com/wXLTaQDZ anymore
10:19 moritz korjavin: so you don't actually instantiate a Mojolicious object, which in turn would import the DefaultHelpers
10:22 korjavin Thank you. I just delete this code, cos with it its doesnt run. But now I add it back again. Can you please look at this gist again?
10:24 moritz korjavin: I think you got that backwards
10:24 moritz korjavin: create a Mojolicious object in the sript, and use its ->renderer to render the template
10:26 korjavin Ok, got it. 5 min.
10:27 dotan korjavin: Mojo::Template is pretty low-level, it just transforms the EPL syntax to executable perl code. If you want any helpers - and I think even "include" counts as a helper - you need to prepend the code for it to your template (Mojo::Template has a "prepend" method)
10:29 dotan Looking at the EPRenderer code http://mojolicio.us/perldoc/Mojolicious/Plugin/EPRenderer.txt - it does a bunch of voodoo to add the helpers into that namespace you saw in the error message - Mojo::Template::SandBox.
10:33 Jonneh joined #mojo
10:36 dotan ...which is why it's better to do what moritz says.
10:38 korjavin Yes, yes. Thank you all. Now its much closer.
10:38 korjavin I add renderer into my script logic, and now its half work
10:39 korjavin Now, I have problem with tempates path (its reseted by some way). I update the gist https://gist.github.com/korjavin/9660836 please look at it. I have wierd error Template "offer.html.ep" not found.
10:41 sujithm joined #mojo
10:41 sujithm joined #mojo
10:50 korjavin Strange. When I set format to xml, its works only for document not for include offer. I suppose include have to use another render object.
11:02 maxhq joined #mojo
11:13 cosimo joined #mojo
11:21 mattastrophe joined #mojo
11:24 spoot joined #mojo
11:24 jberger korjavin: I don't understand why you are creating new instances of all these class
11:25 jberger you could accomplish your task as a very simple Mojolicious::Lite app
11:26 jberger you really never should need to manually instantiate a controller or a renderer
11:26 d4rkie joined #mojo
11:34 d4rkie joined #mojo
11:48 neilhwatson joined #mojo
11:51 sujithm_ joined #mojo
11:51 edestler left #mojo
11:52 edestler joined #mojo
11:53 sujithm__ joined #mojo
11:58 mire_ joined #mojo
12:02 d4rkie joined #mojo
12:09 korjavin I have not any mojo:app. I just want to use template in my console app.
12:14 odc korjavin, i made a similar script recently. I used Mojolicious::Lite and then created a helper to render a template (with the partial option)
12:14 korjavin odc can you please show me it? I understand the idea, but don't know how to start
12:16 odc ok wait
13:06 dod joined #mojo
13:12 denis_boyun joined #mojo
13:21 spoot joined #mojo
13:31 odc korjavin, http://pastie.org/8953389
13:34 korjavin thank you!
13:35 odc heh. sorry, lunch was longer than expected :)
13:37 spoot joined #mojo
13:38 korjavin ;)
13:53 stephan48 i think someone created a plugin to fetch strings from mojo templates/modules for i18n... do i mix something up or could someone point me to it?
13:54 asarch joined #mojo
13:55 btyler joined #mojo
14:00 korjavin If I understood you right, I saw one on github, author sharifullin
14:05 Dandre Hello,
14:05 spoot joined #mojo
14:06 dabudabu sup,
14:07 odc stephan48, https://metacpan.org/pod/MojoX::I18N::Lexemes ?
14:07 stephan48 ah thank you
14:08 Dandre I have in my application an hypnotoad section. I load config plugin with defaults settings for hypnotoad too. The issue is that all hypnotoad section of my config file replace the default I have set in my application even for settings that are not in my config file.
14:10 dod joined #mojo
14:13 odc Dandre, that's normal. You're replacing one hash by another. What you want is to fusion both hashes. You're gonna have to do manually if a for loop
14:16 Dandre ok
14:35 radixo joined #mojo
14:36 radixo hello guys.. I have a route that take sometime to execute, and i have noted that mojo calls the controller action more then once.. why? how can i setup this?
14:46 marty radixo:  if you have a small test that recreates the problem you can pastie it so we can help.  also, if you are using a browser to test, open up the debug console and see if it is making two calls to the same url.
14:49 batman_ sri: about Sessions->default_expiration: "until the browser window is closed, this can have security implications though." # why will setting default_expiration(0) have security implications?
14:49 batman_ which security issues occur then?
14:50 korjavin What mean spurt method in Mojo:Util, is it warranty that nobody can read file while it not writed?
14:51 dotan radixo: I know this happened to me too, don't remember how I got around it - rewrote the action completely, I think.
14:52 dotan radixo: if you are using delays, problem might be caused by an error or exception in your code that is silently swallowed (callbacks are run in eval blocks, probably so they won't take down the entire app). Perhaps there's a timeout.
14:55 gryphon joined #mojo
14:56 odc korjavin, spurt is just a quick way to write a string to a file -> spurt(filename, text)
14:56 radixo dotan: how can i set morbo inactivity_timeout?
14:56 radixo i want to testing this way
14:56 dotan radixo: env var: MOJO_INACTIVITY_TIMEOUT=0
14:57 batman_ korjavin: i don't think you can answer that question without knowing which filesystem you use.
14:57 korjavin ext4
14:57 batman_ if you have a modern version of linux, then the fire you write is probably not the same file that you read, if done at the same time.
14:58 batman_ then you should not be able to read and write to the same file.
14:58 korjavin Okey, thank you. I need something like filesystem transaction. How to prevent read while write not finished?
14:59 batman_ korjavin: wait a sec...
14:59 purl is batman_ one of those answer bots?
14:59 korjavin Just write tmp and move then?
14:59 radixo dotan: I think it is an other thing.. it was so fast now..
14:59 batman_ korjavin: why do you care?
14:59 radixo in my log.
14:59 dotan qq
15:00 korjavin If another process read my file before I finish, this file will be invalid.
15:00 radixo dotan: how do I know where is the error?
15:00 batman_ korjavin: oh. i think i'm wrong... ignore me or let me know if i'm right :)
15:01 odc korjavin, you can also use flock()
15:01 batman_ korjavin: yes, i'm wrong.
15:01 batman_ odc: that does not work on nfs, and you require the other end to also use flock
15:01 dotan radixo: fill your code with prints to STDERR (will show in the morbo terminal), use eval liberally on anything non-trivial that isn't non-blocking, check all errors...
15:02 korjavin odc, thank you
15:02 batman_ korjavin: this will not read/write the same chunk: Mojo::Asset::File->new->add_chunk("data")->move_to("/some/file");
15:02 batman_ so if you read "/some/file" and then run the code above, you will still read the "old" file on ext4.
15:02 odc yeah, i guess mv is better then
15:03 korjavin Aha, thank you. I was thinking about mv, but expect some magic
15:03 batman_ the inode is not "garbage collected" until you close the old file.
15:03 batman_ it's what makes redis work :)
15:04 dod joined #mojo
15:04 batman_ you might want to set the tmp directory if you're writing big files and they are not on the same partition.
15:05 dod joined #mojo
15:05 dotan radixo: also, write tests instead of trying to debug in morbo - then run them with inactivity timeout set to 0 and you can debug into your code.
15:09 Dandre Why Config Plugin doesn't use Hash::Merge::Simple written by sri?
15:10 dotan Dandre: because that would be an external dependency?
15:11 Dandre ah ok
15:15 davido_ joined #mojo
15:17 jrbeilke joined #mojo
15:27 sh4 joined #mojo
15:37 meshl joined #mojo
15:38 spoot joined #mojo
15:38 dotan Hmm. Hash::Merge::Simple - "This was stoled from Catalyst::Utils"
15:42 Dandre that's a reason for not using it?
15:43 spoot joined #mojo
15:43 odc the source is pretty small, it could easily be added to Mojo::Util
15:51 priodev joined #mojo
15:53 spoot joined #mojo
15:53 spoot joined #mojo
16:01 Dandre In my controller I have an action that renders something. I need to do some processing after the result has been rendered in this action. The issue is that when using render, the output is effectively rendered after action returned and so after my processing.
16:05 dotan Dandre: you want to render to a variable, do your processing, and then call render with the rendered template in the variable?
16:07 Dandre no. I want to render and then after rendered do some processing
16:07 sujithm joined #mojo
16:08 tempire ooo
16:08 Dandre when I say render I mean sent to the remote device
16:08 tempire a streaming json decoder
16:08 tempire fancy
16:13 Dandre to make it clearer, I have this sequence in my controller's action:
16:13 Dandre render; log; sleep 5; return
16:14 Dandre I want this behaviour:
16:14 Dandre render; log; sleep;
16:14 Dandre I get:
16:14 Dandre log; sleep; render
16:22 dotan odc: I think sri will only add stuff to Mojo::Util if it is of utility to developing mojolicious, not of utility to mojolicious developers. Hash::Merge::Simple is something pretty specialized and of limited general use - if someone needs it, they can install it, and worse case it can be installed using the copy-paste installer...
16:23 dotan Dandre: how are you sequencing the operations?
16:24 io joined #mojo
16:25 io Good day!! How to see all redirects chain when I do $ua->get($url) ??
16:25 Dandre something pretty specialized and of limited general use
16:25 Dandre this could help Config Plugin to work as expected
16:25 odc dotan, i agree, though i could be a cool feature for mojolicious to be able to auto-merge a default configuration with a configuration file
16:25 odc it*
16:26 Dandre odc: I aggree ;-)
16:27 Dandre dotan: my process is :
16:27 Dandre do some stuff with input data;
16:27 Dandre respond with some result;
16:27 Dandre then send some push requests if appropriate
16:27 dotan odc: write a plugin?
16:29 odc a plugin for this? mm i'd rather see this as part of Mojo::Config
16:30 odc i can't write one now if that's what your asking ;)
16:37 dod joined #mojo
16:38 korjavin left #mojo
16:44 mattastrophe joined #mojo
16:45 mire_ joined #mojo
16:49 dotan Dandre: I asked how you sequence these things together - what sends the push results after the response?
16:49 Dandre dotan: this is my action method in my controller
16:51 Dandre and this action is called from route definition
16:51 Dandre $route->to("mycontroller#action");
16:52 ua_ joined #mojo
16:55 dotan Dandre: are you using delay? render_later?
16:55 Dandre no
17:02 radixo dotan: I found the error, it was my fault
17:02 radixo I was calling the action again.. a lot of work makes me crazy
17:02 radixo and slow
17:03 dvinciguerra joined #mojo
17:10 punter joined #mojo
17:20 vaewyn joined #mojo
17:22 dod joined #mojo
17:26 vaewyn left #mojo
17:45 denis_boyun joined #mojo
17:57 ua_ joined #mojo
17:58 ua_1 joined #mojo
18:23 dotan Dandre, odc: https://github.com/dotandimet/Mojolicious-Plugin-ConfigHashMerge
18:30 cpan_mojo Mojolicious-Plugin-ConfigHashMerge 0.01 by DOTAN - http://metacpan.org/release/DOTAN/Mojolicious-Plugin-ConfigHashMerge-0.01
19:32 cosimo joined #mojo
19:42 meshl joined #mojo
19:46 dnbe joined #mojo
19:47 dnbe today's easy question: can the form_for taghelper take an argument to include CSS attributes?
19:48 dnbe like, for example password_field 'pass', id => 'foo' adds id=foo to the markup?
19:48 dnbe If so, any hints on the correct syntax?
19:49 batman dnbe: %= form_for 'some_action', method => 'post', class => 'foo bar', id => 'baz', begin
19:49 dnbe oh cool, that easy
19:50 dnbe batman: I think the fat commas in the standard way of specifying things:
19:50 dnbe form_for '/newuser' => (method => 'POST') => begin
19:50 dnbe confused me a bit
19:50 batman ok.
19:51 dnbe though now that I look at it, it looks obvious, thanks!
19:53 batman yeah, the simplest things are usually like that :)
20:33 spoot joined #mojo
20:42 dotandimet joined #mojo
20:43 cpan_mojo Mojolicious-Plugin-FeedReader 0.01 by DOTAN - http://metacpan.org/release/DOTAN/Mojolicious-Plugin-FeedReader-0.01
20:58 cpan_mojo Mojolicious-Plugin-FeedReader 0.02 by DOTAN - http://metacpan.org/release/DOTAN/Mojolicious-Plugin-FeedReader-0.02
21:03 marty ALL GLORY TO THE HYPNOTOAD!
21:07 gryphon joined #mojo
21:09 mudler http://www.geekjournal.it/wp-content/uploads/ipnorospo.gif
21:10 cpan_mojo Mojolicious-Plugin-Responsinator 0.01 by Jan Henning Thorsen - http://metacpan.org/release/JHTHORSEN/Mojolicious-Plugin-Responsinator-0.01
21:21 batman ^ demo: http://home.thorsen.pm/?_size=iphone
21:26 Adura joined #mojo
21:34 mudler batman++ #nice plugin
21:34 ua_ joined #mojo
21:36 meshl joined #mojo
21:46 meshl joined #mojo
21:52 disputin joined #mojo
21:54 russum1 joined #mojo
21:56 russum2 joined #mojo
22:04 russum joined #mojo
22:07 cosimo joined #mojo
22:15 mire_ joined #mojo
22:25 meshl joined #mojo
22:31 dvinciguerra joined #mojo
22:49 meshl joined #mojo
22:57 denisboyun joined #mojo
23:24 ioguix joined #mojo
23:37 marty_ joined #mojo
23:47 alnewkirk joined #mojo
23:51 jberger dotan, the core config plugin does already merge defaults!
23:57 meshl joined #mojo
23:59 marty joined #mojo

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