Camelia, the Perl 6 bug

IRC log for #mojo, 2012-12-30

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

All times shown according to UTC.

Time Nick Message
00:05 gbacon joined #mojo
00:13 Molaf_ joined #mojo
00:52 sinkovsky joined #mojo
01:10 mattastrophe joined #mojo
01:11 basic6 joined #mojo
01:12 Mike-PerlRecruiter_ joined #mojo
01:49 buu sri: Cool.
02:04 sinkovsky joined #mojo
03:05 sinkovsky joined #mojo
03:28 noganex_ joined #mojo
04:18 sinkovsky joined #mojo
04:24 chenryn joined #mojo
05:04 chinaxing joined #mojo
05:06 chinaxing is anyone online ?
05:08 xaka nope
05:16 kitt_vl joined #mojo
05:17 chinaxing python webframework django has can create form from model automatically, mojo has this function ?
05:19 chinaxing otherwise , i have to write form validation rules
05:20 chinaxing if it can be produce automatically from model, that's convenient
05:20 xaka chinaxing: mojo doesn't have model so you need to write your own and form builder as well
05:20 chinaxing oh,can give me a sample ?
05:21 chinaxing I haven' saw one in mojo's document and github
05:22 xaka right, because there is none. you have to write your own
05:23 chinaxing i mean i want to see what some one has written for himself.
05:24 chinaxing do you have written  one ?
05:24 chinaxing :-))
05:25 xaka nope, sorry
05:30 sinkovsky joined #mojo
05:43 jberger chinaxing: mojo is model agnostic
05:44 jberger as was mentioned in your github report
05:44 jberger one of perl
05:44 jberger sry
05:44 jberger one of perl's great strengths is CPAN
05:44 jberger Mojolicious is meant to be a framework
05:44 jberger others have done great things in the area of models and validation
05:45 jberger please use one of those along with Mojolicious to make a complete solution
06:12 iskyee joined #mojo
06:42 iskyee joined #mojo
06:43 sinkovsky joined #mojo
07:02 hesperaux joined #mojo
07:22 Vandal joined #mojo
07:22 wircus joined #mojo
07:25 wircus o/
07:28 wircus_ joined #mojo
07:28 batman____ joined #mojo
07:29 wircus joined #mojo
07:30 wircus hmm
07:30 wircus_ hmm
07:56 sinkovsky joined #mojo
07:57 wircus mmmmills
07:58 tempire \o
08:12 memowe_ joined #mojo
08:15 _xaka_ joined #mojo
08:18 rafl_ joined #mojo
08:19 mikegrb_ joined #mojo
08:19 _t[R]oll joined #mojo
08:19 jmmills_ joined #mojo
08:22 nicomen_ joined #mojo
08:22 migo_ joined #mojo
08:22 noganex joined #mojo
08:22 alnewkir1 joined #mojo
08:22 Nom-_ joined #mojo
08:22 marcus_ joined #mojo
08:22 edenc joined #mojo
08:23 diegok joined #mojo
08:23 phips joined #mojo
08:23 janus` joined #mojo
08:23 bobkare_ joined #mojo
08:23 mike__ joined #mojo
08:23 ashleyde1 joined #mojo
08:23 LordVorp joined #mojo
08:26 mfontani_ joined #mojo
08:27 wendar joined #mojo
08:27 heytrav_ joined #mojo
08:27 jmaister_ joined #mojo
08:27 whee joined #mojo
08:27 rakshasa joined #mojo
08:27 rhaen_ joined #mojo
08:27 amirite_ joined #mojo
08:29 connor_goodwolf joined #mojo
08:32 marty o/
08:32 sawtooth_ joined #mojo
08:33 jiyuperl joined #mojo
08:33 nic joined #mojo
08:33 connor_goodwolf joined #mojo
08:35 kitt_vl joined #mojo
09:02 sri \o
09:09 sinkovsky joined #mojo
09:37 tempire -_\\
09:40 tempire I need a module name.
09:41 tempire oh maybe not
09:44 tempire yep, a module name.
09:44 tempire for a layer on top of Mojo::UserAgent that stores a persistent host, headers, and params.
10:14 iskyee joined #mojo
10:15 kitt_vl joined #mojo
10:16 PanzerBjorn joined #mojo
10:16 PanzerBjorn Is there any way to pass a handle from the main module to a controller privately instead of using stash?
10:20 PanzerBjorn I'd like to pass a DBI handle from the main module to a controller that's called from $r->route(...) in such a way that it's not in the stash (and available to be used/viewed in EP).
10:21 marcus tempire: Mojo::UserAgent::API ?
10:21 sinkovsky joined #mojo
10:22 tempire that's not so bad
10:22 tempire though I wonder if it would confuse people
10:22 tempire Mojo::UserAgent::Persistent doesn't have a good ring to it
10:22 sri maybe use a completely different namespace
10:22 sri cutesy name
10:23 tempire Pueblo
10:24 tempire PanzerBjorn: the stash *is* the way to do what you're asking.
10:25 tempire though passing a dbi handle is questionable.
10:25 PanzerBjorn So should I just remove it from the stash before rendering then?
10:25 PanzerBjorn Well, I want to re-use the connection without having to create a new connection in each controller that's called.
10:26 PanzerBjorn My DB will fall-over if I have each page load making 8 DB connections.
10:26 PanzerBjorn (At least that's what school led me to believe...)
10:26 tempire do you mean you don't want to create a new db connection on every request?
10:27 PanzerBjorn No I just mean that as a request routes through various controllers (because I'm partial-moduling a lot) I don't want each one to make it's own DBI handle/connection.
10:27 tempire use a helper
10:27 PanzerBjorn Sorry, partial-rendering.
10:27 sri http://mojolicio.us/perldoc/Mo​jolicious/Guides/Growing#Model
10:28 PanzerBjorn I understand helpers, I have a bunch of them in my current app. Are they in a special global space or something?
10:29 PanzerBjorn How could I store a DBI handle in an anonymous method like that?
10:29 tempire https://github.com/tempire/MojoE​xample/blob/master/mojolite#L16
10:30 tempire and then note its use on line 34
10:31 PanzerBjorn Pardon me if I'm misinterpreting, but that looks like it pulls a new DBI handle each time the helper is referenced?
10:31 tempire no
10:31 sri i think my link is better for beginners
10:32 * tempire defers
10:32 tempire ok ok ok
10:32 tempire I think I definitely found it this time
10:32 * marcus dereferences
10:32 * sri destroys
10:32 tempire the mojolicious theme song
10:32 tempire https://www.youtube.com/watch?v=3oem-M2tQU4
10:33 marcus wtf, fucking steam is showing me prices in rubles. :-/
10:33 marcus I hate software trying to be smart.
10:34 mire_ joined #mojo
10:36 sri it's funny how many perl 5.10 features we use in documentation now
10:37 sri state variables, say, defined or... they all make perl so much more pleasant
10:38 tempire nordaaker has a major project that always uses the latest version of mojolicious and works on 5.14+.  If they can do that, everyone can use at least 5.10.
10:38 * tempire proclaims it
10:40 sri lets make mojolicious use 5.14 features :)
10:40 marcus I agree, 5.16 has been out for a while.
10:40 marcus but haters gonna hate, I guess.
10:41 PanzerBjorn Oh, okay, what threw me off was unfamiliarity with the new state variables. Cool. Problem solved. My servers are all on 5.14 so this works. Thanks!
10:41 tempire jamadam has been doing a pretty good job of keeping up to date
10:41 tempire as long as he keeps it up, we're safe from the naysayers
10:41 sri mojolicious is 5.10+ only, so all examples work everywhere mojolicious does
10:42 sri yea
10:42 sri jamadam++
10:42 tempire jamadam++
10:45 marcus hmm, s///r seems pretty handy, I should start using that.
10:46 chinaxing left #mojo
10:46 marcus reentrant regexen is just crazy tho :-)
10:47 * tempire isn't familiar with that term
10:47 marcus sri: the mojo codebase would look much hotter with the array reference stuff :-)
10:47 sri -.-
10:48 marcus tempire: "It is now safe to use regular expressions within (?{...}) and (??{...}) code blocks inside regular expressions."
10:49 sri the one thing i really want is subroutine signatures :/
10:57 PanzerBjorn Wow, that is freaking cool man. Thanks for the helps again guys.
10:58 PanzerBjorn I should probably look into some good docs on mentally equipping myself with knowledge about the changes from 5.8 to 5.14
11:06 marcus PanzerBjorn: http://perldoc.perl.org/perl5140delta.html and the other deltas
11:06 PanzerBjorn Nice, thank you. =)
11:07 PanzerBjorn Also this works like a champ:   $self->helper( dbo => sub { state $dbo = PDM::DBObj->new });  # thank you oop
11:16 marcus <3 state
11:20 lukep joined #mojo
11:34 lammel2 joined #mojo
11:50 ObseLeTe joined #mojo
12:04 dvinciguerra joined #mojo
12:06 good_news_everyone joined #mojo
12:06 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/Zen-Vw
12:06 good_news_everyone mojo/master 04d56b9 Sebastian Riedel: fixed small memory leak in Mojo::DOM
12:06 good_news_everyone left #mojo
12:11 sri replace_content was leaking
12:39 rem_lex joined #mojo
13:12 Mike-PerlRecruiter_ joined #mojo
14:06 duncanthrax joined #mojo
14:10 jberger <3 state
14:11 jberger PanzerBjorn: http://www.slideshare.net/rjb​s/whats-new-in-perl-v510-v516
14:27 iskyee joined #mojo
14:50 dod joined #mojo
15:10 chenryn joined #mojo
15:14 Miked joined #mojo
15:15 dod joined #mojo
15:16 Britzel joined #mojo
15:37 gryphon joined #mojo
15:40 ask joined #mojo
15:44 Foxcool_ joined #mojo
16:04 dod joined #mojo
16:26 dod joined #mojo
16:44 rem_lex|pivo joined #mojo
16:57 dod joined #mojo
17:01 basic6 Here's a design question: I'm building a little a little web application with frontend and backend. Those are 2 separate Mojolicious apps (which will be running on the same server though). Both of them use the same database and there's a module that handles the db access and translates between db and application logic (lib/Foo.pm, not lib/MyApp/Foo.pm). So I'd have a copy of this module in both frontend and backend (duplicate code, the logic is alw
17:03 cstamas basic6: sometimes press enter
17:03 cstamas your question is truncated
17:04 basic6 oh you dont see it, here it is again...
17:04 basic6 I'm building a little a little web application with frontend and backend.
17:04 basic6 Those are 2 separate Mojolicious apps (which will be running on the same server though).
17:04 basic6 Both of them use the same database and there's a module that handles the db access and translates between db and application logic (lib/Foo.pm, not lib/MyApp/Foo.pm).
17:04 basic6 So I'd have a copy of this module in both frontend and backend (duplicate code, the logic is always the same).
17:04 basic6 Is there a Mojolicious solution (like put everything in one application and start a different app depending on the configuration (config.yaml) ?
17:05 Ulti or just have shared library paths
17:06 Ulti like have all the data model stuff as a completely standalone package that you could use in any perl script
17:07 basic6 Ok ... I could put the app logic module in ~Frontend/lib/Logic.pm and in the backend append the frontends lib path to its lib path ... or really use a shared lib path and put only the data model in there ...
17:08 basic6 sounds good
17:08 basic6 I think this would be better than mixing Frontend and Backend in one application.
17:08 Britzel I have all my DB model stuff in my PERL5LIB directory. Because I need it also for many support utilities.
17:08 Ulti at least for my own stuff I have a whole suite of stuff for dealing with the database standalone as I write other scripts for the database that have nothing to do with the website
17:12 basic6 ok i'll do that thanks
17:23 chenryn left #mojo
17:28 Adura joined #mojo
18:01 rem_lex joined #mojo
18:23 sh4 joined #mojo
19:24 dvinciguerra joined #mojo
19:40 dvinciguerra joined #mojo
19:58 Rhaen hep
20:08 Rhaen hm, everytime when I am trying to use something different than Mojo::UserAgent, I am falling back to Mojo::UserAgent after a few lines of code.
20:18 sh4|2 joined #mojo
20:18 marcus Rhaen: it's a trap!
20:19 Rhaen marcus: it certainly is. I am not sure what to do about this.
20:20 tempire I can't imagine any reason to use anything else.
20:20 tempire other than stubbornness
20:20 Rhaen I am still in love with CPAN, but I love the ease that comes with mojo
20:20 Rhaen one single api/framework - consistent method naming
20:20 marcus tempire: I think if you need extreme performance you might consider libcurl.
20:20 marcus but other than that...
20:20 tempire EXTREME!
20:20 Rhaen well, I'll pull tons of dependencies with the S3 stuff which I am using.
20:21 Rhaen marcus: is it webscale?
20:21 marcus Rhaen: it's C!
20:21 * Rhaen thinks: If it's not webscale I won't use it.
20:21 Rhaen marcus: I know :)
20:21 marcus it's hosted by haxx.se, how can it not be webscale?
20:21 Rhaen oh, that's a fair point!
20:22 Rhaen tempire: It's all your fault!
20:22 Rhaen tempire: what do you use as blogging engine for your heroku stuff?
20:22 Rhaen tempire: some custom mojo engine?
20:23 tempire meaning tempi.re?
20:23 Rhaen yep
20:24 tempire all articles are pulled from github issues.
20:24 Rhaen no.
20:25 Rhaen really?
20:25 tempire github.com/tempire/articles/issues
20:25 tempire built in ui
20:25 tempire with tags and everything
20:25 Rhaen yes.
20:25 tempire cached with state
20:25 Rhaen and you query the github api using mojo, right?
20:25 tempire yes
20:26 Rhaen hm. nice.
20:26 Rhaen that's a nice way.
20:26 Rhaen but I can use your blog then by opening issues, correct?
20:27 sri he surely can filter by author
20:28 tempire hax0rs!
20:28 Rhaen sri, do you really think he is using such sophisticated techniques?
20:28 tempire only one way to find out, I guess
20:29 Rhaen I am not a hax0r
20:30 dvinciguerra joined #mojo
20:31 tempire there's plenty of information in the issues json to limit that sort of thing.
20:32 Rhaen hm, that's the reason why you brought in the json pointers. I got it
20:37 tempire it would be better to do it in a normal repo.
20:38 tempire but the tags made it a no brainer to use issues
20:38 marcus cute
20:40 Rhaen tags are "labels" in github jargon, right?
20:42 tempire yes
20:44 Rhaen hm, sorry to bother again, what do you mean by "cached with state"?
20:44 Rhaen do you use the free redis/memcache instance for that?
20:47 cstamas hi
20:47 cstamas I have a simple client/server
20:47 cstamas both is mojolicious
20:48 cstamas I do a post and the client waits for a few seconds
20:48 cstamas because of keepalive
20:48 cstamas how can I avoid that?
20:52 tempire Rhaen: pulls the data.  stores it in a variable using state instead of my
20:52 tempire state is not instantiated again for the remaining life of the daemon.
20:52 Rhaen ah, k, so you avoid the reinitializing every time.
20:52 tempire small-scale caching on the cheap
20:52 Rhaen k - sure.
20:54 tempire cstamas: use connection-close header
20:54 tempire shortcut: http://mojolicio.us/perldo​c/Mojo/Headers#connection
20:57 cstamas tempire: this is some kind of global thing or somehow I have to inject/set it in M::UserAgent ?
20:57 tempire it's a header that gets sent with each request.
20:58 cstamas okay, thx
20:58 tempire try it with MOJO_USERAGENT_DEBUG=1, and you'll see it.
20:59 cstamas uh, it got some binary content and garbled my console
20:59 tempire just look at the headers
21:00 tempire you're probably retrieving binary or gzipped content
21:00 cstamas I use ngrep for this
21:02 cstamas it seems I still have the keepalive
21:02 cstamas I try the debug again redirecting the output to a file
21:08 cstamas the keepalive is still here it seems
21:12 dod joined #mojo
21:14 cstamas here it is http://pastebin.com/raw.php?i=V7dm6QvW
21:15 cstamas tempire: if you could take a look
21:15 cstamas thx
21:16 lammel2 joined #mojo
21:22 asarch joined #mojo
21:25 tempire cstamas: your headers object is unrelated to the request
21:25 tempire $ua->connection('close')->post_form(...)
21:26 tempire or $ua->post_form(url => {stuff to send} => {Connection => 'close'})
21:26 tempire third hashref is any headers you want
21:28 cstamas tempire: okay
21:29 cstamas thanks that was it
21:32 b2b joined #mojo
22:05 mattastrophe joined #mojo
22:12 rem_lex|pivo joined #mojo
23:18 mattastrophe joined #mojo
23:32 gryphon joined #mojo
23:39 sinkovsky joined #mojo
23:47 rem_lex| joined #mojo
23:54 ask is there a way to have a startup() function in a Lite app?  Or is the whole program in effect supposed to be "startup" ?

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