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

IRC log for #mojo, 2015-08-05

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

All times shown according to UTC.

Time Nick Message
00:01 absolut_todd joined #mojo
00:12 Zoffix joined #mojo
01:15 kaare joined #mojo
01:31 mtj- joined #mojo
01:49 mtj- joined #mojo
01:57 mtj- joined #mojo
02:10 mtj- joined #mojo
02:38 mtj joined #mojo
02:44 noganex_ joined #mojo
02:47 marty does anyone have suggestions on how to setup MOJO::Pg so that every user has their own connection string?
02:48 marty My frontend uses a shared connection but for my admin section I would like to validate users against the postgres login roles  (for auditing purposes)
02:51 Grinnz you would just use a different Mojo::Pg object for each user
02:52 Grinnz the way it queues up database objects, i dont think you could change it on the fly in a single object
02:54 lluad joined #mojo
02:54 marty Right now I have a helper for the Mojo::Pg object.  I guess I would have to move it into the stash for each user so they could access it.
02:55 Grinnz the stash is per request, you'd want to set up a hash or something globally
02:55 preaction also, if you're forking, like with hypnotoad, that's more than one connection to the database per user
02:56 marty Ok.  I think on it and try and get my head around it.  Thanks for the help.
03:05 mtj_ joined #mojo
03:08 mtj joined #mojo
03:25 Dave joined #mojo
03:37 zivester joined #mojo
03:38 melo joined #mojo
03:47 mattastrophe joined #mojo
06:30 dotandimet joined #mojo
06:49 trone joined #mojo
06:58 Adurah joined #mojo
07:34 AndrewIsh joined #mojo
07:35 HtbaaPi joined #mojo
07:41 Vandal joined #mojo
08:20 irqq joined #mojo
08:49 cpan_mojo joined #mojo
08:49 cpan_mojo Mojolicious-Plugin-AssetPack-0.56 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/Mojolicious-Plugin-AssetPack-0.56
09:03 jontaylor joined #mojo
09:08 eseyman joined #mojo
09:23 trone joined #mojo
09:35 batman added purge() and wildcard support ^^ (EXPERIMENTAL)
09:58 circ-user-PjxyD joined #mojo
09:58 circ-user-PjxyD I have a question regarding MOJO IOLoop Recuring
09:59 circ-user-GcrQx joined #mojo
10:03 circ-user-GcrQx I all, I want to put the following code inside a route:my $id; $id = Mojo::IOLoop->recurring(0.2 => sub {   if (some condition || $count++ > $max_retries) {  do staff  $done = 1;   }   if ($id && $done) {    Mojo::IOLoop->remove($id);   } });
10:03 circ-user-GcrQx opps how do I format the message ?
10:06 circ-user-GcrQx in short I want an IOLoop recuring timer to reomve itself once a spcific c
10:06 circ-user-GcrQx condition is met
10:14 circ-user-Kbjsp joined #mojo
10:15 circ-user-UT3Wp joined #mojo
10:16 pink_mist circ-user-UT3Wp: are you implying your current code isn't working? it looks like it should work fine
10:18 mattastrophe joined #mojo
10:19 circ-user-UT3Wp yes my current code works but sometimes I have message like
10:20 circ-user-UT3Wp MOJO::Reactor::Poll: Timer failed: Missing or empty input
10:21 pink_mist I've no idea what that might be, but someone else might, at least if you post your code on a paste site (like a github gist for example) so they can take a look at your actual code
10:22 circ-user-UT3Wp I is starnge there is no simple way to stop a recuiring event Like retruning null value or calling something like $loop->end_this_event
11:00 neilhwatson joined #mojo
11:09 batman circ-user-UT3Wp: i think that would add too many special cases and a big overhead for running each event.
11:11 batman and even if there's no slowdown, i still think the method would be a special case and shouldn't be part of the Mojo::IOLoop api.
11:11 batman (i could be wrong)
11:13 batman circ-user-UT3Wp: back to your code... it's not possible to comment from what you posted, since it's lacking your actual code.
11:14 batman but something inside the callback fails. this code will result in pretty much the same case:
11:15 batman Mojo::IOLoop->recurring(sub { die "Missing or empty input" if rand > 0.5 });
11:41 absolut__ joined #mojo
12:34 circ-user-UT3Wp I put the code in Gist https://gist.github.com/Roeya/9827d3624d8af09ed42f
12:35 circ-user-UT3Wp batman note is helpful, I'll try to eval the code to see if something dies there
12:40 marcusr batnote!
12:49 stuart same bat-time, same bat-channel
13:12 davido___ joined #mojo
13:12 hernan605 joined #mojo
13:16 sh4 joined #mojo
13:19 jkramer joined #mojo
13:19 jkramer Ahoy
13:20 jkramer Can someone please make Mojo::YAML and make it as simple and awesome as Mojo::JSON?
13:24 zivester joined #mojo
13:26 stuart NAIVE silly comment #1: cant you just copy MOJO::JSON and swap out the Json bits for YAML?
13:26 AndroUser2 joined #mojo
13:27 mattastrophe joined #mojo
13:28 roeya joined #mojo
13:35 jkramer stuart: By the same logic I could just take a Boeing 777, swap out all the Boeing-parts for gokart-parts and end up with a gokart, because both are basically vehicles :)
13:41 mishanti1 We actually just switched from Mojo::JSON to Cpanel::JSON::XS because of speed. Structurally I prefer Mojo::JSON though.
13:46 stuart a 747 go-kart yes please.
13:46 stuart or 777-gokart
13:47 Grinnz jkramer, not likely to happen, YAML is a nightmare
13:47 Grinnz but you're welcome to try! ;)
13:49 jkramer :(
13:49 jkramer Or does anyone maybe know a YAML implementation that doesn't have that disgusting Load/Dump interface? :)
13:50 jkramer This kind of ruins my otherwise beautiful code and makes me sick :D
13:55 jkramer Nevermind, I found Text::FrontMatter::YAML which does what I actually wanted and hides the ugly YAML part somewhere deep inside the module :)
13:56 jb360 joined #mojo
14:09 lluad joined #mojo
14:24 circ-user-UT3Wp Something odd - I set inactivity timeout to 120 (120sec) however after about 15 seconds I get inactivity as in the default settings
14:24 eitz joined #mojo
14:27 jberger circ-user-UT3Wp: how did you set it?
14:27 hov joined #mojo
14:28 hov hi, is it possible to get the form fields that failed validation with Mojolicious::Validator::Validation in the same order they appear in the html template?
14:31 roy joined #mojo
14:36 roy joined #mojo
14:40 circ-user-UT3Wp app->inactivity_timeout(120);
14:43 jberger circ-user-UT3Wp: right
14:43 jberger so that's your problem
14:43 jberger inactivity_timeout is a property of the stream and thus the transaction
14:44 circ-user-UT3Wp yes real problem a ~15% my processing takes more then 15seconds
14:44 jberger calling helpers on the app will create a dummy controller and dummy transaction to act on, but if you are modifying a transaction property then it won't help
14:45 jberger circ-user-UT3Wp: http://mojolicio.us/perldoc/Mojolicious#after_build_tx
14:45 circ-user-UT3Wp thanks checking it out...
14:45 jberger app->hool(after_build_tx => sub { shift->inactivity_timeout(120) }); # just off the top of my head this would probably do what you need
14:46 jberger hook
14:47 jberger of course that will set it for all the actions, it you only need it for ~15% of cases perhaps you should just do it in the controller actions directly
14:47 jberger (the ones that need it)
14:48 circ-user-UT3Wp Thanks, however Although I understand each word you wrote I have some issues with getting it.... sorry new to mojo
14:49 jberger the inactivity_timeout is essentially a property of the transaction, not of the app
14:49 Grinnz_ inactivity_timeout is a property of the transaction, which is specific to each request and doesn't exist before then
14:49 jberger so setting it on the app isn't going to help you
14:50 circ-user-UT3Wp OK so wjy not just use the $c->app->intactivity_timeout(120) at the beginning of the hadler ?
14:50 circ-user-UT3Wp When I tried it I saw that calling $c->app->intactivity_timeout() returns undef
14:52 circ-user-UT3Wp I actually use IOLoop->recuring to wait till some other program (which I cannot change and it does exit at the end) finish it work
14:52 njlg joined #mojo
14:53 circ-user-UT3Wp I want to be able to wait longer in the case it takes longer to process
14:58 circ-user-UT3Wp Sorry but lost in the maze of classes I get Mojo::Transaction::HTTP and it as no inactivity_timeout so is its base Mojo :: Transaction
14:59 circ-user-UT3Wp iactivity_timeout is a Mojo::Server::Daemon property
15:01 jberger circ-user-UT3Wp: use $c->inactivity_timeout(120)
15:01 jberger if you do $c->app->... you are doing the same thing as app->...
15:02 circ-user-UT3Wp I getting there it requres DefaultHlpers  plugin as the documentation says....
15:02 jberger http://mojolicio.us/perldoc/Mojolicious/Plugin/DefaultHelpers#inactivity_timeout
15:02 circ-user-UT3Wp Thanks reading it as you wrote....
15:02 jberger right, those are loaded automatically
15:03 jberger all the bundled plugins are loaded automatically
15:03 circ-user-UT3Wp Ha did not know
15:03 jberger (I think all, at least most)
15:05 jberger circ-user-UT3Wp: btw, "I actually use IOLoop->recuring to wait till some other program (which I cannot change and it does exit at the end) finish it work"
15:06 jberger have you considered using something like Mojo::IOLoop::ForkCall so that you don't have to poll for completion?
15:06 circ-user-UT3Wp Success ! thaks
15:06 jberger nice
15:07 jberger (with the one caveat that it still isn't behaving very nicely on windows, hurnhg)
15:08 circ-user-UT3Wp I am on windows ... I upload a file give it to process (which poll a directory) it process it, than create a result file
15:08 circ-user-UT3Wp That I read
15:09 circ-user-UT3Wp When ever I see Fork on windows I get blind....:)
15:09 Ptolemarch joined #mojo
15:11 jberger circ-user-UT3Wp: the sad thing is that it SHOULD work on windows, I put a lot of effort into that, and it doesn't due to a perl bug
15:12 jberger on windows it is essentially an interface to threading rather than forking
15:12 circ-user-UT3Wp so I check it, just read your remark in the documentation regarding windows
15:13 circ-user-UT3Wp under the warnings section....
15:13 jberger yeah, this is the actual one though: https://github.com/jberger/Mojo-IOLoop-ForkCall/issues/5
15:15 circ-user-UT3Wp I'm seeing passes on recent Perls recent == 5.18,4 ? or 5.20 and up ?
15:15 njlg joined #mojo
15:15 jberger you are welcome to give it a try
15:15 jberger if it works, then it works
15:16 jberger (not the installation, I always fear that my test did not properly exercise the bug)
15:17 jberger what I mean is, if you successfully can run your app once modified to use ForkCall, then it won't be a problem
15:17 jberger the problem is that it calls the c level abort() which will hard terminate the program
15:17 jberger so its pretty obvious when you trip the bug
15:18 circ-user-UT3Wp OK - currently I on clock to deliver working "somthing" will test after I get first version up and runing in the next hours
15:19 jberger in the end, using ForkCall or polling for the file is up to you
15:20 jberger it won't hurt my feelings or anything
15:20 jberger try it if you think it might help
15:20 howitdo joined #mojo
15:21 circ-user-UT3Wp Thanks for helpping with the timeout (I'll see my kids & wife today as you saved me hours...)
15:41 jberger :)
15:49 circ-user-UT3Wp_ joined #mojo
15:53 circ-user-woPxN joined #mojo
15:54 stephen joined #mojo
16:04 jontaylor joined #mojo
16:05 gryphon joined #mojo
16:14 PryMar56 joined #mojo
16:15 njlg joined #mojo
16:19 njlg joined #mojo
16:30 cpan_mojo Mojo-SQLite-0.009 by DBOOK https://metacpan.org/release/DBOOK/Mojo-SQLite-0.009
16:35 Grinnz_ cpan_mojo is back! :D
16:37 jberger \o/
16:37 jberger batman++
16:38 batman :)
16:44 trone joined #mojo
16:53 Grinnz_ https://metacpan.org/requires/module/Mojo::Base?sort=[[2,1]]&size=200 might need to send bug reports to these dists telling them to switch their depedency to Mojolicious, as Mojo::Base doesn't have a version
16:53 Grinnz_ similar for every other module in mojo, but that one is probably the worst offender :P
16:55 Grinnz_ (the correct solution is to add versions to every module in mojo, but without an authoring tool of some kind that's not really feasible)
17:04 batman not sure if that's the "correct solution"...
17:04 batman i could be wrong
17:05 jberger Grinnz_: there is such a tool, but its annoying when there are so many modules, it lowers the signal to noise in diffs
17:06 Grinnz_ batman: it is if people want to be able to depend on any module other than Mojolicious with a minimum version
17:06 Grinnz_ it is the only way that will work in the toolchain
17:06 Grinnz_ jberger: there's also the idea of adding it to the code in the dist, and not in the git repo itself, but i don't like that way...
17:07 batman Grinnz_: i see. i'm not using use Module 1.0; i'm rather documenting my deps in the makefile
17:07 batman i consider that to be the "right way" for the toolchain
17:08 Grinnz_ batman: either one will not work
17:08 batman sure, just depend on the right module in the makefile :)
17:08 Grinnz_ right, it needs to depend on Mojolicious version X
17:08 batman jberger: i also don't see "git diff" as an argument not to do something.
17:09 batman i used to. but now i don't. it doesn't matter in the end anyway (imho)
17:10 * batman will go outside and see fantastic 4 :)
17:10 batman outdoor cinema
17:10 jberger Grinnz_: https://metacpan.org/pod/Perl::Version
17:10 jberger ^^ comes with a script that can reversion all the files in a directory
17:12 dod joined #mojo
17:13 Grinnz_ the dzil plugin uses https://metacpan.org/pod/Version::Next but that doesn't have a script
17:16 amon joined #mojo
17:27 roy left #mojo
17:27 kaare joined #mojo
17:34 kaare_ joined #mojo
17:43 * Grinnz_ ponders App::RewriteVersion
17:44 Grinnz_ as sort of a command line https://metacpan.org/pod/Dist::Zilla::Plugin::RewriteVersion with a "bump" feature
17:44 mst Grinnz_: sec
17:45 mst Grinnz_: already have one of those
17:45 Grinnz_ other than Perl::Version?
17:45 mst http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/Distar.git;a=blob;f=helpers/bump-version;h=6b60641bdb75a964910ee235ee740795d95c8900;hb=a69e85aab1581b3acfe74224afa816431ed63e22
17:45 Grinnz_ ah
17:45 mst then Distar gives me 'make bump, make bumpminor, make bumpmajor'
17:45 Grinnz_ thats not exactly standalone on cpan either :P
17:51 mst Grinnz_: it's standalone and dependency-free
17:52 mst if you really want to run 'cpan' rather than 'wget', I'm sure #web-simple could be convinced to brainstorm a name with you
18:19 ZoffixWork joined #mojo
18:23 irqq joined #mojo
18:25 dod joined #mojo
18:36 Ptolemarch joined #mojo
18:37 dotandimet joined #mojo
18:42 dotandimet joined #mojo
18:43 dotandimet1 joined #mojo
18:59 dotandimet joined #mojo
19:17 dotandimet joined #mojo
19:29 dod joined #mojo
19:35 njlg joined #mojo
19:40 Dave So if I have a web client upload a file and it's a zip file and I now have to use Archive::Zip to get at the data...if Mojo::Upload decided to offload to a file, how would I know?
19:42 pink_mist the same way you already knew?
19:42 pink_mist (I don't think I understand what you're asking)
19:43 pink_mist what, specifically, are you wondering how you would know?
19:43 Grinnz_ Dave: from Mojo::Upload you will get a Mojo::Asset, which you can either slurp (works the same for memory or file), or check if is_file and then retrieve the handle if it is
19:43 Dave I didn't see a method "is_file"
19:43 Dave on Mojo::Upload
19:43 Grinnz_ Mojo::Asset
19:44 Grinnz_ the upload object just wraps the asset and the filename, etc
19:44 Dave ahh I see
19:46 Dave I didn't see the Mojo::Asset method there...thanks for clearing that up :)
19:47 Dave so...how does one control where Mojo decides to write the file?
19:48 Grinnz_ i don't think you do, but you can use move_to
19:49 Dave the thing is, if the upload object goes out of scope, does it remove the file?
19:49 Grinnz_ not if you still have the asset
19:49 Dave so it's the asset going out of scope that removes the file
19:50 * Dave has visions of tons of uploaded files sitting somewhere
19:50 Grinnz_ well, probably not until the request dispatch ends
19:50 Grinnz_ it's definitely a temp file though :P
19:52 Dave wow it does auto clean up after going out of scope
19:53 mst right
19:53 mst perl has timely destruction
19:53 mst so you can do stuff like that
19:53 Dave "timely destruction"?
19:53 Dave as opposed to untimely?
19:55 melo joined #mojo
19:55 mst as opposed to 'your finalizer will be called when the GC feels like it, probably'
19:55 Dave ah yes, that makes sense
19:56 Dave and he gets the tmpdir it's written to from an environment variable if I want :D
19:56 Dave two of them if I read this right
19:56 Dave TMPDIR and MOJO_TMPDIR
19:58 Grinnz_ TMPDIR is a generic one, it's also respected by File::Spec and File::Temp
20:00 Dave I almost never use standard temp file locations
20:01 Dave you never know what security issues lie in wait for you
20:12 meshl joined #mojo
20:17 njlg joined #mojo
20:23 irqq joined #mojo
20:37 mattastrophe joined #mojo
20:43 disputin joined #mojo
20:53 irqq joined #mojo
21:03 nic joined #mojo
21:14 nic joined #mojo
21:14 nic joined #mojo
21:15 nic another approach is to let each module have its own version
21:16 nic it only gets bumped when the module is edited
21:18 nic so in Mojolicious 6.31 it might have Mojo::Base 3.11
21:18 Grinnz_ nic: while possible, that leads to madness
21:19 Grinnz_ people seem to have a (perhaps inaccurate) impression that all the modules in a dist are the same version
21:20 Grinnz_ probably because the dist tarball itself tends to have a version which at least matches the main module
21:22 Grinnz_ but when you say "use Foo X" or "cpan Foo"
21:22 Grinnz_ or "requires Foo => X"
21:22 Grinnz_ it's looking at $VERSION for that particular module
21:23 nic joined #mojo
21:25 nic the only disadvantage I see is it complicates the simple foolproof bump procedure sri follows
21:25 nic I miss sri
21:25 nic I hope he's enjoying his break
21:25 Grinnz_ distwide versioning would certainly require a versioning tool
21:26 nic I don't like distwide
21:27 nic the version bumps even when the module I care about hasn't changed
21:28 nic I guess I mean, I agree with your original proposal to educate the downstream numpties
21:30 nic if you depend on a version of something that has no version, is the constraint ignored?
21:32 Grinnz_ I believe it will just make sure the module is installed
21:32 nic if the constraint translated to a constraint on the distro, the problem vanishes
21:32 Grinnz_ dependencies are on modules, that won't change
21:33 Grinnz_ (modules can change dists)
21:33 nic indeed
21:34 nic and I'm not sure runtime perl has a concept of distro
21:34 Grinnz_ ok i just tried it; trying to depend on a version (other than 0) of a module with no version means cpanm will fail to resolve the dependency
21:35 Grinnz_ so i'm guessing everything that's depending on Mojo::Base is actually just depending on version 0
21:35 Grinnz_ nic: it doesn't
21:35 nic what about cpan?
21:35 Grinnz_ i'm doing a local test; no idea how to try that with cpan :)
21:36 Grinnz_ (using a cpanfile, no less)
21:45 Craftsmanship joined #mojo
21:56 Craftsmanship is Mojolicious::Plugin::Authentication legit?
21:58 Craftsmanship It looks like it doesn't really seem invite having oauth shoved into it, but I was wondering if ->over is the best way to hang things off a "pls log in" type action
21:59 Grinnz_ Craftsmanship: there is https://metacpan.org/pod/Mojolicious::Plugin::OAuth2
22:00 Craftsmanship I have some bullshit wired up with Net::Twitter
22:00 Craftsmanship I got as far as getting some keys back and forth, but now i need to make the applicaiton obey, and so i'm looking for that part too
22:01 Craftsmanship I'll give that a look too though
22:01 Grinnz_ i don't know anything about the Authentication plugin, but it at least looks recently updated
22:22 nic joined #mojo
22:27 nic ::Authentication has things like OAuth in mind
22:29 hernan605 joined #mojo
23:41 PryMar56 joined #mojo

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