Camelia, the Perl 6 bug

IRC log for #mojo, 2013-02-25

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

All times shown according to UTC.

Time Nick Message
00:04 jeen joined #mojo
00:05 tholen42 joined #mojo
00:15 dhg joined #mojo
00:17 dhg joined #mojo
00:17 bobkare joined #mojo
00:20 asarch joined #mojo
00:24 Grrrr joined #mojo
00:31 jeen joined #mojo
00:33 shmuel joined #mojo
00:39 Grrrr joined #mojo
00:50 nicomen joined #mojo
01:06 ka2u joined #mojo
01:33 egopro joined #mojo
01:40 KindOne joined #mojo
01:44 ka2u_ joined #mojo
01:54 d4rkie joined #mojo
02:34 Averna joined #mojo
03:41 sh4 joined #mojo
03:51 hesperaux In a full mojo app, I have a module called Auth.pm in which I do site authentication. I have moved route and helper code from my mojolicious::lite version into this file.
03:52 hesperaux my route code is working, but my helper code is not, because I can no longer call those functions as helpers. they are now just subs inside Auth.pm
03:53 hesperaux how do I send what used to be my helper functions the controller object so i can access global helpers, such as database handles and the like?
03:53 hesperaux I've tried calling the subroutine in Auth.pm and sending $self in as the first argument, but that isn't working as expected (not sure why)
03:57 jberger when you register the plugin you can add the helpers to the app
03:57 btyler joined #mojo
03:58 hesperaux jberger, i have not registered this module as a plugin. I don't know how to do that either.
03:58 hesperaux not sure what the right term is, but it's just a submodule of my main app
03:58 jberger look at any of the plugins in the core, they are good examples
04:00 jberger when you do $app->plugin('MyPlugin') it loads that module and then invokes the register method
04:01 jberger so make your register method setup the helpers and the routes
04:01 hesperaux hmm, do you think that's the way to do it then?
04:01 jberger usually
04:01 hesperaux i'm new to "non-lite" apps, so i'm trying to figure out the best way to convert from lite
04:02 jberger adding helpers is usually done via plugins
04:02 jberger or just setup in the startup method like you would have in your lite app
04:02 hesperaux what's the conceptual difference between a helper and a sub?
04:03 jberger a helper is available as a method to the app and all controllers, plus a function all your templates
04:04 jberger if you only need a method on a particular controller, then just make it as a sub (method) in your controller class
04:04 jberger which is possibly what you want for authentication
04:04 hesperaux indeed
04:04 hesperaux so then in that sub, how would I get access to the controller?
04:05 hesperaux is there a special way to call my sub's from within that controller class?
04:05 jberger presumably it would be the invocant
04:05 hesperaux that's what I figured, too
04:05 jberger inside the controller's action
04:05 hesperaux so I deliberate passed in $self from the function being executed (auth#routeLogin)
04:06 hesperaux meaning: /login -> auth#routeLogin->processLogin($self, $username, $password); <--something like that
04:06 hesperaux processLogin does not seem to like the $self variable though
04:06 jberger wait
04:06 jberger when you route to auth#routeLogin
04:07 jberger you call the Auth::routeLogin method correct?
04:07 hesperaux right
04:07 hesperaux and within that method, i call a subroutine that resides in Auth.pm
04:07 jberger and it gets the a controller object as its first argument
04:07 jberger my $c = shift
04:07 hesperaux correct
04:08 jberger so make another method in Auth.pm, say sub authenticate {...}
04:08 jberger and in routeLogin call $c->authenticate
04:08 hesperaux xD
04:08 hesperaux ohhh
04:08 jberger like any other perl oo
04:08 * jberger lightbulb
04:08 hesperaux so the controller it gets is not MyApp, it's the controller in question (Auth)
04:08 jberger yep
04:08 hesperaux that's why i was screwing it up
04:09 hesperaux that makes sense now
04:09 hesperaux i like that much better than what I was thinking :)
04:09 jberger and controllers have an app helper
04:09 jberger from which you can get the app instance
04:09 jberger my $app = $c->app;
04:09 hesperaux i did not know that either. highly useful!
04:09 hesperaux <3 jberger
04:09 * jberger blushes
04:09 hesperaux lol
04:09 jberger yeah moving to full apps takes a little getting used to
04:10 jberger but once things start falling into place, you come to really like that
04:10 jberger I do
04:10 jberger s/that/them/
04:10 hesperaux I can believe that
04:15 hesperaux jberger, if i have a Utils.pm that has a couple of common functions, like dumpParams() and consoleLog(), what is the best way to register them in the app?
04:16 jberger if they are just functions, just `use` them in the controller file
04:16 jberger if you want them as helpers, make a plugin and add the helpers in the register method
04:16 jberger register is basically like the startup method for plugins
04:16 hesperaux would use MyApp::Utils; suffice?
04:17 jberger sure, especially if they are just functions
04:17 hesperaux after doing that, how do I call the subroutines from some arbitrary controller?
04:17 jberger and of course you can export/import from them as usual (Exporter or whatever)
04:17 hesperaux directly, or explicitly as in MyApp::Utils::function()
04:17 jberger they're just functions, use them as you would in Perl
04:18 hesperaux ok
04:18 jberger Util's can use the Exporter style
04:19 jberger or you can use the fully qualified
04:19 hesperaux what if they're not "just" functions, like if they need access to the app controller?
04:19 jberger then they should be helpers
04:19 hesperaux ok
04:20 jberger either add them in the startup method in MyApp.pm
04:20 hesperaux i've got a database plugin for DBI. i'll take a look at how they do it. it's pretty small
04:20 jberger or in the register method as a plugin
04:21 jberger https://github.com/jberger/Mojolicious-Plugin-PP​I/blob/master/lib/Mojolicious/Plugin/PPI.pm#L47
04:21 hesperaux ah. thanks ;)
04:21 jberger hmmm, that's more complex than I remember
04:21 jberger maybe I have a more simple one somewhere
04:22 hesperaux has()? hmm
04:22 jberger yeah, everything(ish) can have attributes
04:23 jberger see Mojo::Base
04:23 jberger here, this one has more code, but its also more straightforward: https://github.com/jberger/Mojolic​ious-Plugin-Humane/blob/master/lib​/Mojolicious/Plugin/Humane.pm#L47
04:26 hesperaux thanks
04:26 jberger np
04:39 preflex_ joined #mojo
04:39 dotandimet joined #mojo
04:42 hesperaux when I call $self->plugin('name'); What is the name?
04:54 jberger typically it would be Mojolicious::Plugin::name
04:54 hesperaux doesn't seem to be working
04:54 jberger though the app can change/add to the plugin namespaces
04:54 hesperaux does it have to be Mojolicious::?
04:54 ka2u joined #mojo
04:55 jberger hmmm, maybe it camelizes
04:55 jberger try naming it Name.pm
04:55 hesperaux I put the plugin into web_root/MyApp/Plugin/Auth.pm and called it MyApp::Plugin::Auth. When I try to run $app->plugin('Auth') it fails
04:55 hesperaux it already is Auth.pm/Auth/etc
04:55 jberger is web_root in @INC
04:55 jberger ?
04:55 jberger oh, wait
04:56 jberger you need to add MyApp::Plugin to the plugin namespaces
04:56 jberger in the app's startup method
04:57 jberger https://metacpan.org/module/Mojolicious#plugins
04:57 hesperaux :)
04:57 jberger in fact, that exact example is in the doc
04:57 hesperaux tasty documentation
04:57 hesperaux i didn't find this earlier
05:06 dotandimet joined #mojo
05:07 hesperaux jberger, thanks again :)
05:07 jberger glad to help
05:07 jberger after working on full apps for a few days/weeks, take an hour or two and reread all the guide doc
05:08 hesperaux which one?
05:08 jberger starting with Mojolicious::Lite and then all the guides
05:08 hesperaux k
05:08 jberger http://mojolicio.us/perldoc
05:08 jberger it will start making lots more sense ;-)
05:09 hesperaux sounds good
05:09 hesperaux i will probably take that advice cuz i'm doing some stuff at work with this
05:10 hesperaux doing a webapp at home to practice
05:10 jberger good luck!
05:10 hesperaux thanks
05:10 hesperaux too bad they block IRC hehe
05:12 Annihitek joined #mojo
05:12 rihegher joined #mojo
05:34 basiliscos joined #mojo
06:19 jamesw joined #mojo
06:23 Molaf joined #mojo
06:28 Britzel_ joined #mojo
06:33 ynonperek joined #mojo
06:50 yakudza joined #mojo
06:58 rihegher left #mojo
07:07 Mike-PerlRecruiter_ joined #mojo
07:08 Vandal joined #mojo
07:12 jzawodn joined #mojo
07:39 dotandimet joined #mojo
07:43 egopro joined #mojo
08:02 dpetrov_ joined #mojo
08:05 fhelmber_ joined #mojo
08:15 suy joined #mojo
08:15 egopro joined #mojo
08:48 egopro joined #mojo
08:58 Britzel_ joined #mojo
08:59 egopro joined #mojo
09:05 maxhq joined #mojo
09:05 daxim joined #mojo
09:07 cosimo joined #mojo
09:35 dhg joined #mojo
09:39 dod joined #mojo
09:41 Vandal joined #mojo
09:43 egopro joined #mojo
09:44 ObseLeTe joined #mojo
09:51 egopro joined #mojo
10:10 ObseLeTe joined #mojo
10:12 egopro joined #mojo
10:20 egopro joined #mojo
10:26 jeen joined #mojo
10:29 ObseLeTe joined #mojo
10:48 JiYu joined #mojo
10:56 ryozi joined #mojo
10:56 egopro joined #mojo
11:03 basiliscos joined #mojo
11:04 basiliscos joined #mojo
11:06 basiliscos1 joined #mojo
11:27 ver joined #mojo
11:48 basiliscos joined #mojo
11:49 tm joined #mojo
11:50 tm morning everyone
11:50 jeen joined #mojo
11:51 tm is anybody using the OAuth2 in reverse-proxy deployment? When I call auth the redirect_uri is http://localhost:<port>/auth instead of fqdn
11:52 tm adding redirect_uri parameter to plugin configuration options doesn't help
12:23 GabrielVieira joined #mojo
12:45 ladnaV joined #mojo
12:50 SmokeMachine joined #mojo
12:55 ladnaV joined #mojo
13:00 alexko joined #mojo
13:07 vervain joined #mojo
13:14 SmokeMachine joined #mojo
13:18 Vandal joined #mojo
13:30 mauke joined #mojo
13:31 mauke hi, I'm reading http://blogs.perl.org/users/stas/2013/01/​web-scraping-with-modern-perl-part-1.html and it uses Mojo::IOLoop->recurring(0 => sub { ... }) to queue up http requests
13:31 mauke isn't that a busy loop in the worst case?
13:34 sri depends on the event loop used, but in the worst case yes
13:35 mauke wait, why does it depend on the even loop?
13:35 sri it's not how i would have written it
13:35 mauke I'm imagining a slow server that just absorbs five connections and sits there
13:35 mauke no events are generated, so the event loop should just sit there and dispatch 0 second timeouts
13:36 sri EV for example can't handle 0, so it gets delayed by a few ms
13:36 sri it's not good code, events should be requeued after one has finished
13:37 mauke ok, that would have been my next question
13:39 d4rkie joined #mojo
13:39 mauke I see that the code loads Mojo::UserAgent, then accesses Mojo::IOLoop directly
13:39 mauke is this guaranteed to work?
13:40 sri it works, but not guaranteed, you won't find code like that in the official documentation
13:40 mauke is $ua->ioloop a better idea?
13:41 sri much worse
13:41 sri it shouldn't work
13:41 mauke huh?
13:41 sri that loop is only used for blocking operations
13:41 mauke ah
13:42 sri Mojo::IOLoop->singleton is the one for non-blocking
13:44 mauke my $link = Mojo::URL->new($e->{href});  next if 'Mojo::URL' ne ref $link;  # does this check do anything?
13:44 sri when i said, not guaranteed, i mean you have to load Mojo::IOLoop, maybe that was not clear enough
13:45 mauke no, I got that
13:46 sri i could prolly point out dozens of flaws in that blog post
13:50 Britzel joined #mojo
13:56 sh4 joined #mojo
13:56 gryphon joined #mojo
14:10 mauke how can I absolutify links in an HTML document?
14:11 mauke $link->to_abs($tx->req->url) is wrong because it ignores <base>
14:14 bluescreen joined #mojo
14:22 dhg joined #mojo
14:26 mauke ok, I can find nothing about this in the perldocs, the wiki, or on google
14:27 mauke I'm going to assume mojo doesn't do relative urls and die if I hit them
14:29 mauke crap. all of these links are relative
14:35 btyler joined #mojo
14:46 fotodigital joined #mojo
14:51 inokenty joined #mojo
14:51 moltar joined #mojo
14:59 Adurah joined #mojo
15:15 jberger_ joined #mojo
15:16 jberger_ mauke, you might want to look at the docs for Mojo::URL
15:16 mauke I did
15:16 tl joined #mojo
15:16 jberger_ is $link a Mojo::URL object?
15:16 mauke yes
15:18 jberger_ you know that to_abs doesn't change $link to instead returns a new Mojo::URL?
15:19 mauke yes
15:19 jberger_ then, can you make an example script that demonstrates the problem
15:19 tl42 joined #mojo
15:21 mauke ...
15:27 spleenjack joined #mojo
15:31 mauke jberger_: http://paste.scsys.co.uk/232273
15:32 * jberger_ looks
15:36 jberger_ you never call to_abs in that example btw
15:37 jberger_ http://pastie.org/6334443
15:37 wu-lee joined #mojo
15:41 jberger_ http://pastie.org/6334443
15:41 jberger_ oops
15:41 jberger_ ignore that repeat
15:41 mauke jberger_: yep, and that's incorrect
15:41 mauke your code outputs http://www.debugtheweb.com/test/cat.gif http://www.debugtheweb.com/test/dog.gif
15:41 mauke those documents don't exist
15:42 mauke the correct urls are http://www.debugtheweb.com/test/images/cat.gif http://www.debugtheweb.com/test/images/dog.gif
15:44 jberger_ the relative urls are ../imagename.fmt
15:45 mauke yes
15:45 jberger_ how is it supposed to know /image ?
15:45 mauke from <base>
15:45 jberger_ what is <base> ?
15:45 mauke what the heck
15:45 jberger_ http://www.debugtheweb.com/test/base/
15:45 jberger_ I don't see /image/
15:46 mauke click on View Source
15:46 mauke also, https://developer.mozilla.or​g/en/docs/HTML/Element/base
15:46 sri there is a base tag
15:46 * sri has no clue what mauke expects
15:46 mauke jberger_: as I said before, <mauke> $link->to_abs($tx->req->url) is wrong because it ignores <base>
15:46 mauke sri: expects for what?
15:47 sri mauke: *you* are the one ignoring the base tag
15:47 mauke yes
15:47 sri *you* make the logic
15:47 jberger_ then you should extract the base tag and use it
15:47 mauke sri: I don't want to do it manually
15:47 mauke at least not if I can avoid it
15:47 mauke this is such a common thing
15:48 sri i think you're mixing up mechanize and mojolicious
15:48 sri they are not the same
15:48 mauke no, HTTP::Message and Mojo
15:48 mauke sri: http://paste.scsys.co.uk/232277
15:48 mauke this is what I'm doing right now
15:48 mauke it's awful
15:49 jberger_ mauke, also I'm helping you out of the goodness of my heart when I could be doing other things, a little courtesy wouldn't hurt
15:50 mauke I'm not convinced stuff like "you might want to look at the docs for Mojo::URL" is help
15:50 * sri agrees with jberger, be nice
15:51 mauke where was I not nice?
15:51 jberger_ "what the heck"
15:51 jberger_ nm
15:51 mauke that was my surprise at you not knowing about <base>
15:51 mauke (after I explicitly mentioned it and linked you to a page that uses it)
15:52 jberger_ it wasn't that I didn't know base, I didn't look at the doc source
15:52 jberger_ since you didn't use I, I didn't know to look for it
15:52 jberger_ as sri says, this is JUST a dom parser
15:52 jberger_ it doesn't know anything about how a <base> tag would relate to anything else
15:53 jberger_ other parts in the Mojo toolchain might, at some higher level
15:53 sri nope, they don't
15:53 * jberger_ defers to sri
15:53 sri we make a clear cut at the dom layer, we don't interpret the result
15:54 mauke do you mean you don't interpret any tags specially?
15:54 sri yes, no base, no forms, no nothing
15:55 labrown joined #mojo
15:56 mauke so what am I supposed to do when I want to write a crawler? use that compute_base sub?
15:56 jberger_ mauke: http://pastie.org/6334584
15:56 sri you're welcome to wrote a mechanize thingy on top of mojolicious
15:56 sri s/o/i/
15:57 mauke I don't want mechanize
15:57 mauke I don't even like mechanize
15:57 sri anyway, i'm off running a few kilometers now
15:58 jberger_ sri: what's a kilometer :-P
15:58 jberger_ USE MILES LIKE ALL GOOD AMEERRICANS
15:58 * jberger_ is a scientist
15:58 * jberger_ wishes the US would go to metric
15:59 mattastrophe joined #mojo
15:59 mauke feature request: implement HTTP::Response->base for Mojo::Message::Response
15:59 mauke is this sensible?
16:04 jberger_ mauke, we'll have to wait for sri to come back, I have no basis for an opinion on that
16:06 mauke jberger_: btw, your version doesn't just ignore the Content-Base/Content-Location headers, it also fails with relative urls in <base href="...">
16:07 jberger_ mauke, sure, the easy fix is to make the base handler check for that
16:07 jberger_ and the DOM parser knows nothing about headers
16:07 jberger_ nor should it
16:07 mauke yes, see my version
16:07 mauke it should handle all of that
16:08 jberger_ its job is to interpret an XML document
16:08 jberger_ no semantics are implied beyond that
16:08 mauke I'm fine with that
16:09 jberger_ as sri was alluding to, a subclass or wrapper class that handled these things might be handy to have on CPAN
16:10 mauke subclass of what, though? Mojo::UserAgent?
16:13 mattastrophe joined #mojo
16:14 jberger_ indeed, that is the question
16:15 jberger_ it might start as a subclass of DOM that had methods to handle an abstract base that modifies URLs that are extracted
16:16 jberger_ then a subclass of UserAgent could create these subclassed DOM objects, where the headers are injected into that attribute
16:16 jberger_ and on Mojo::DOM::MySubclass::new it would have to traverse itself, looking for those base tags
16:17 jberger_ perhaps now you can see why these are separated :-)
16:17 jberger_ (I know you understand, I'm saying that for the rhetoric of it, but perhaps that doesn't come across on IRC)
16:31 jberger_ k, back to $work, will check in again later
16:31 jberger_ left #mojo
16:40 * sri doesn't like mixing layers, Mojo::Message is transport (HTTP), not content (HTML/XML)
16:40 sri like i said, higher level logic belongs into a mechanize thingy, above Mojo::UserAgent
16:52 yakudza joined #mojo
17:00 maxhq joined #mojo
17:05 xaka joined #mojo
17:06 _xaka_ joined #mojo
17:13 bluescreen_ joined #mojo
17:21 sri marcus: oh my, webOS is getting sold to LG
17:23 spleenjack joined #mojo
17:25 * sri likes the symbolism of pumpkin perl, show the willingness of the perl5 community to adapt to be able to move on, while perl6 keeps getting lost in ideals
17:27 bluescreen_ joined #mojo
17:28 sri perl6 should have done it, perl5 just does it
17:30 marty I have not been following perl6 for a while. Is any closer than it was, say, two years ago?
17:30 sri not really
17:31 sri but kinda, parrot is mostly dead and they are moving nqp to the jvm
17:32 sri which resulted in new activity in the parrot project, now a few people are gutting parrot to remove all the idealistic features rakudo doesn't need
17:33 marty So many good ideas, so little results.
17:33 jzawodn Second Language Syndrome
17:33 sri yea
17:34 sri nqp on the jvm looks promising though
17:35 marty The jvm is pretty ubiquitous now so that's probably not a bad target.
17:35 sri it's a pretty good first target
17:36 marty I hope it does get done however.  I think if it does become a reality it has a good chance of having some really kewl features.
17:37 sri imo it was pretty obvious that parrot was holding back rakudo, just look at how quickly niezca progressed on the CLR
17:39 baton8 joined #mojo
17:39 marty ya, parrot was quite the drama.  I remember reading a blog by someone who quite early on and I thougth, oooooo, that's bad
17:39 marty s/quite/quit/
17:41 good_news_everyone joined #mojo
17:41 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/GnZaCg
17:41 good_news_everyone mojo/master 9a70130 Sebastian Riedel: fixed typo
17:41 good_news_everyone left #mojo
17:48 basiliscos joined #mojo
18:05 dod joined #mojo
18:16 spleenjack joined #mojo
18:17 lucs Pardon my laziness (maybe I should just TIAS), but if a placeholder is restricted to matching /\d+/, will that match "foo23"
18:17 lucs ? (I'm guessing "no", an implicit \A and \z will be handled by Mojolicious).
18:17 dhg joined #mojo
18:18 sri ./myapp routes -v
18:18 sri then you can see the final regex
18:18 lucs Aha, cool, thanks.
18:26 SmokeMachine joined #mojo
18:50 mattastrophe joined #mojo
18:54 asarch joined #mojo
18:55 spleenjack joined #mojo
18:58 dod joined #mojo
19:01 dhg joined #mojo
19:07 Mike-PerlRecruiter_ joined #mojo
19:08 dhg joined #mojo
19:13 jnbek joined #mojo
19:49 marcus o/
19:50 dhg joined #mojo
19:52 phillipadsmith Yep.
19:52 phillipadsmith Whooops… wrong window
19:53 dhg joined #mojo
20:11 dhg joined #mojo
20:13 dwierenga joined #mojo
20:22 buu joined #mojo
20:23 mattastrophe joined #mojo
20:25 ghandi joined #mojo
20:26 dhg joined #mojo
20:26 basiliscos joined #mojo
20:26 ghandi What's the sane way to convert an Mojo::Asset::Memory into an M:A:File? I need a real Filehandle and the users often upload tiny files.
20:26 mire__ joined #mojo
20:28 BeDa joined #mojo
20:29 kongelaks i just set MOJO_MAX_MEMORY_SIZE to 1... i do however wish that i could explicitly upgrade a M:A:Memory to a M:A:File
20:30 sri what exactly is hard about upgrading it now?
20:30 kongelaks mm, i just don't know how to do it
20:30 kongelaks there is no "upgrade" method, is there?
20:31 sri my $file = Mojo::Asset::File->new->add_chunk($memory->slurp)
20:31 ghandi The only way i found is to create a new M:A:File Object and add_chunk(M:A:Memory->slurp()) which feels a little dirty :D
20:31 sri is that complicated?
20:32 ghandi I thought there might was a more "sexy" way of doing it. At least that's what i was used from Mojolicious. ;)
20:32 sri it's not really a smart thing to do
20:33 sri you have it in memory, it's fast, now you add *a lot* of overhead to make it slow
20:33 sri it's already in memory, you gain basically nothing
20:33 kongelaks i think it depends on what you're doing
20:33 sri what is your use case?
20:35 kongelaks i'm using the UserAgent as an HTTP base for a stupid thing called RETS (real estate transaction standard). i can query RETS servers for xml and for files. sometimes the xml is very large and i want it to go straight to a file and sometimes it's small and i want it in memory. i want every file to go straight to disk
20:36 sri that's not a use case
20:36 lukep joined #mojo
20:36 sri there's $asset->move_to(...) that just works for both
20:38 sri when i say use case, i mean something that actually requires converting between memory and file assets
20:38 dhg joined #mojo
20:38 nelio joined #mojo
20:39 kongelaks download a small image then upload it to s3 using an s3 lib that takes the file path as an argument
20:42 sri so stupid libraries that only accept files on disk, not a very convincing argument
20:44 kongelaks maybe you should write an s3 lib that takes a Mojo::Asset then ;)
20:44 sri kongelaks: maybe you should file a bug report against that s3 lib?
20:45 mattp joined #mojo
20:47 kongelaks i think i'll just stick to setting MOJO_MAX_MEMORY_SIZE to 1. speed isn't an issue
20:49 sri if there was a good reason i wouldn't mind adding my $file = $memory->to_file;, but bad 3rd party libraries is not a good use case
20:52 kongelaks move_to is essentially to_file
20:52 kongelaks i just don't want to create my own tmp file name
20:54 rem_lex|pivo joined #mojo
20:54 sri the use case for move_to is to turn a temporary resource into a permanent one (file uploads)
20:55 sri i can actually see to_file being harmful, if people don't understand the cost
20:57 sri seriously, if you write small files to disk just to upload them to s3 you have the worst of all worlds
20:57 sri it's just wrong
20:58 sri setting max_memory_size(1) is better than $memory->to_file, since it at least saves you the memory cost
21:01 kongelaks haha, "worst of all worlds" seems a bit overly dramatic. can you recommend a good s3 library? i don't have the time/concern/motivation to write and test my own flawless s3 lib
21:01 basiliscos joined #mojo
21:02 kongelaks i think the to_file method would just be a convenience feature for people like me and ghandi who for some reason have to deal with little binary files
21:03 sri $s3->upload($memory->to_file->path); that means you have the whole file in RAM, all processes grow, then you have the latency overhead from writing that file to disk, then s3 opens a second file descriptor on the file, reads it chunkwise, then you unlink the file again, and never give the memory back to the operating system
21:03 sri it's pretty much a worst case regarding memory cost and latency
21:04 sri and fd limits of course
21:05 sri maybe it doesn't matter at your scale, but it's just bad design
21:05 mire__ joined #mojo
21:05 kongelaks hmm... i suppose a better solution for me would be to localize the env variable based on request type
21:06 kongelaks yes, $s3->upload($memory->to_file->path) is slow and wasteful, but i'm only doing it about 50% of the time
21:06 sri the point is, based on that wasteful use case you're proposing an addition to the mojolicious api
21:06 kongelaks all of my xml files are currently going to disk because of MOJO_MAX_MEMORY_SIZE
21:07 sri that's why i said the use case it not good enough
21:15 kongelaks i just don't think it is uncommon for people to need file handles
21:15 lammel2 joined #mojo
21:16 lammel2 left #mojo
21:27 mattastrophe joined #mojo
21:42 lammel2 joined #mojo
21:45 buu joined #mojo
22:10 buu joined #mojo
22:10 dhg joined #mojo
22:13 Bender joined #mojo
22:29 * tempire tinkers
22:40 TitanOfOld joined #mojo
22:44 * marty is beating up on the 'inlcude' helper pretty badly and it works perfectly every time.  sri++   soooo much fun
22:44 kongelaks joined #mojo
22:45 sri \o/
22:47 KindOne joined #mojo
23:11 hrupp joined #mojo
23:14 mattastrophe joined #mojo
23:35 jeen joined #mojo
23:36 ka2u joined #mojo
23:47 Averna joined #mojo
23:48 GabrielVieira2 joined #mojo

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