Camelia, the Perl 6 bug

IRC log for #mojo, 2012-07-23

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

All times shown according to UTC.

Time Nick Message
00:34 dvinciguerra joined #mojo
00:45 tempire sweet!  Mojolicious::Command::deploy::heroku shows up in the first page for "deploy heroku"
00:45 tempire now if I could just get the pretty page to do the same
00:49 marty sri++ on MongoDB hacking.  \o/
01:02 laouji joined #mojo
01:21 bird joined #mojo
01:47 sri \o\
01:47 sri /o/
01:56 crab sri: morning exercise?
01:57 * sri nods
01:59 crab i'm still wondering if i should convert my utils scripts to mojo commands.
02:03 d4rkie joined #mojo
02:26 GitHub160 joined #mojo
02:26 GitHub160 [mojo] kraih pushed 1 new commit to master: http://git.io/ABG94Q
02:26 GitHub160 [mojo/master] fixed small charset bug in get command - Sebastian Riedel
02:26 GitHub160 left #mojo
02:36 Psyche^ joined #mojo
02:41 asarch joined #mojo
02:50 laouji joined #mojo
03:01 noganex_ joined #mojo
03:56 tempire crab: what do your utils scripts do?
04:02 crab tempire: schema management. utils/{setup-schema,upgrad​e-schema,downgrade-schema}
04:02 crab there are a few other things too, but those are the ones i was really wondering about. maybe some maintenance tasks to run from cron too.
04:03 crab since they're already written, though, i guess i won't bother to convert them. there's really no advantage
04:03 tempire is there hard coded information about the database within those scripts that's also in your web app?
04:03 tempire or app config
04:04 tempire I have some similar utils, and your comment made me realize I could reuse the db connection info from the app
04:04 crab tempire: it's not hardcoded, these scripts do "$app = MyApp->new; $cfg = $app->config; ..."
04:04 crab and yes, they do use my $app->db too.
04:06 crab hm. no, i'm lying. yes, i do have scripts that do all that (but they're not the ones i was thinking of). the schema management stuff i WAS thinking of... they turn out to actually be shell scripts! (hum. i think i must have written them in perl in some other project. memories too strong to be entirely imaginary.)
04:18 sri hmm
04:18 sri perl -Ilib -Mojo -E 'say g("mojolicio.us")->dom("h1​")->pluck(replace_content => "")->first->root'
04:18 sri why doesn't that work?
04:19 sri we have very similar unit tests that all pass
04:20 sri if anyone here is in the mood for some bug hunting :)
04:24 sri oh
04:24 sri perl -Ilib -Mojo -E 'say g("mojolicio.us")->dom->find(​"h1")->pluck(replace_content => "")->first->root'
04:24 sri this one works
04:24 sri so the dom() call screws up somewhere
04:25 sri ahhh
04:25 sri it's the weaken
04:25 sri :S
04:26 sri that sucks
04:28 sri but i don't think there is anything we could do about it
05:13 Britzel joined #mojo
05:15 zhutingting joined #mojo
05:15 zhutingting http://search.cpan.org/~sri/Mojolicious-3​.12/lib/Mojolicious/Plugin/PODRenderer.pm
05:16 zhutingting hi this module has some bug
05:16 zhutingting if you render this page http://cpansearch.perl.org/src/SRI/Mojoliciou​s-3.12/lib/Mojolicious/Plugin/PODRenderer.pm
05:17 zhutingting you will find the bug, some ep syntax is over render
05:20 * sri doesn't understand a word
05:21 zhutingting :-D
05:21 zhutingting pod_to_html<h2>lalala</h2><h2>lalala</h2>Render POD to HTML.
05:22 zhutingting http://search.cpan.org/~sri/Mojolicious-3​.12/lib/Mojolicious/Plugin/PODRenderer.pm
05:22 zhutingting pod_to_html that part are randered like pod_to_html<h2>lalala</h2><h2>lalala</h2>Render POD to HTML.
05:22 zhutingting %= pod_to_html '=head2 lalala'   <%= pod_to_html begin %>=head2 lalala<% end %>
05:23 sri still don't get it
05:23 zhutingting in this, =head2 lalala is code, not pod
05:23 zhutingting but this module render "=head2 lalal" as pod
05:23 zhutingting got it?
05:24 sri nope
05:24 zhutingting :'(
05:25 zhutingting watch that module in cpan http://search.cpan.org/~sri/Mojolicious-3​.12/lib/Mojolicious/Plugin/PODRenderer.pm find the pod_to_html part
05:25 zhutingting the code in that part is over render as pod
05:25 sri i don't find anything for "render as pod"
05:26 zhutingting i do the best as i can to explain it. sorry for my poor english
05:27 sri no worries
05:27 sri link to the line in question on github
05:29 sr joined #mojo
05:29 spleenjack joined #mojo
05:31 mike_ i can't seem to figure out how to serve up a different template layout based on the requests hostname.  Any ideas how I could do so?
05:31 zhutingting http://www.douban.com/note/226976398/
05:31 zhutingting hi sri~ see my link
05:32 zhutingting got it?
05:34 zhutingting :-* wish you can understand me
05:34 zhutingting i need got some food to eat, bye
05:35 sri afraid not
05:35 sri but maybe someone else here understands
05:36 * crab looks
05:38 crab embedded markup being interpreted when it shouldn't? something. not sure.
05:44 zhutingting yeah got it
05:44 zhutingting thank you sri~ i send an email to you~ a little bug~
05:45 sri zhutingting: that does not help at all i'm afraid
05:46 sri sending me the same explanation in 10 different ways does not make me understand it
05:52 zhutingting hi sri~ see it again http://www.douban.com/note/226976398/
05:52 zhutingting i add a picture
05:53 sri ok, i'm pretty sure i looked at everything, perhaps you are just misunderstanding something and there is no bug
05:54 zhutingting how to do what i mean?
05:54 zhutingting render a pod like what cpan show
05:54 zhutingting ?
06:01 GitHub158 joined #mojo
06:01 GitHub158 [mojo] kraih pushed 1 new commit to master: http://git.io/0CLpSA
06:01 GitHub158 [mojo/master] better examples for many Mojolicious methods - Sebastian Riedel
06:01 GitHub158 left #mojo
06:10 ovnimancer joined #mojo
06:15 zhutingting i tried Pod::Simple::HTML, working well
06:31 Foxcool joined #mojo
06:34 dbr joined #mojo
06:59 Leandr joined #mojo
07:05 AmeliePoulain joined #mojo
07:07 Vandal joined #mojo
07:08 AmeliePoulain joined #mojo
07:08 AmeliePoulain joined #mojo
07:12 cosmincx joined #mojo
07:18 sri hmm
07:18 sri Mojo::Message->dom could cache the Mojo::DOM object
07:19 sri would fix the weaken problem, but is kinda ugly
07:21 sri perl -Mojo -E 'say g("mojolicio.us")->dom("h1")->first->root'
07:21 sri it's pretty broken
07:21 sri marcus, tempire, crab: thoughts?
07:36 taryk joined #mojo
07:43 sri hmm, i guess there are no downsides besides memory usage
07:48 mire joined #mojo
07:51 cosimo_ joined #mojo
07:56 daxim joined #mojo
08:03 pau4o joined #mojo
08:06 zhutingting joined #mojo
08:11 GitHub178 joined #mojo
08:11 GitHub178 [mojo] kraih pushed 1 new commit to master: http://git.io/ZOC5VA
08:11 GitHub178 [mojo/master] fixed selector bug in dom method of Mojo::Message - Sebastian Riedel
08:11 GitHub178 left #mojo
08:12 sri still don't like the solution much, but it seems to be the only choice
08:13 batman_ joined #mojo
08:20 zhutingting hi sri~ remember me? I got what the Plugin-PODRenderer bug really is. <%= pod_to_html begin %> nesting a <%= pod_to_html begin %>. The inner <%= pod_to_html begin %> should not to be render in html
08:20 zhutingting so it is not a really bug. Thank you very much~
08:27 sri i still don't understand, but glad you figured it out :)
08:29 sri marcus: wasn't the ->dom($selector) feature your idea? figure out a solution! ;p
08:50 * sri also considers adding ->remove to Mojo::DOM as a shortcut for ->replace('')
08:50 sri perl -Mojo -E 'say g("mojolicio.us")->dom("h1, h2, h3, script, style")->pluck("remove")->first->root'
08:51 sri for oneliners like that
08:52 sri perl -Mojo -E 'say g("mojolicio.us")->dom("h1, h2, h3, script, style")->pluck(replace => "")->first->root'
08:52 sri that's the current version
08:52 fhelmber_ joined #mojo
09:02 sri oh well, if nobody says a word it's not happening ;p
09:11 GitHub7 joined #mojo
09:11 GitHub7 [mojo] kraih pushed 1 new commit to master: http://git.io/qsZevg
09:11 GitHub7 [mojo/master] added remove method to Mojo::DOM - Sebastian Riedel
09:11 GitHub7 left #mojo
09:11 sri or maybe it is
09:14 jamesw joined #mojo
09:16 sri perl -Mojo -E 'say g("mojolicio.us")->dom("script, style")->pluck("remove")->first->ro​ot->find("*")->pluck("type")->uniq'
09:16 sri fun
09:52 zhutingting left #mojo
10:05 batman_ joined #mojo
10:25 GitHub78 joined #mojo
10:25 GitHub78 [mojo] kraih pushed 1 new commit to master: http://git.io/mLUKbQ
10:25 GitHub78 [mojo/master] better find examples - Sebastian Riedel
10:25 GitHub78 left #mojo
10:54 memememomo joined #mojo
11:10 sri perl -Mojo -E 'say g("mojolicio.us")->dom("body")->pluck("remove")​->first->root->find("*")->pluck("type")->uniq'
11:16 Grauwolf joined #mojo
11:16 Grauwolf hi!
11:16 sandeepdb joined #mojo
11:17 Grauwolf doesn't ladder sub { work anymore in newer mojolicious versions?
11:18 sri ladders are gone for a long long time
11:18 Grauwolf is there a successor to it?
11:23 sri under
11:27 Grauwolf thanks
11:42 ryozi joined #mojo
11:43 * sri is still unsure if Mojo::DOM->remove is worth it...
11:45 sri but then i see an awful regex like this one for filtering out tags and think that's a task that should be as simple and obvious as possible ious/browse_thread/thread/b6333d847cf75155
11:46 sri $dom->find('script, style, iframe')->pluck('remove');
11:48 * sri shrugs
11:49 sri http://groups.google.com/group/mojolicio​us/browse_thread/thread/b6333d847cf75155
12:25 crab seems good.
12:35 zt joined #mojo
12:45 noganex_ joined #mojo
13:25 sri crab: ->remove or the ->dom fix?
13:27 jnap joined #mojo
13:31 jnap joined #mojo
13:31 vel joined #mojo
13:32 sri ->remove does have some history btw https://github.com/kraih/mojo/issues/334
13:33 vel joined #mojo
13:33 sri i'm considering it again because a few people have during the last few months missed ->replace('')... so there might be a need for a little more dwim
13:34 vel joined #mojo
13:34 sri just not sure if it outweighs the negatives
13:49 gryphon joined #mojo
14:04 sri https://github.com/kraih/mojo/issues/361 # maybe someone here wants to add something?
14:08 ZadYree Ah, little question. In my code, I'm using Mojolicious with classic routes. I'm having an issue when trying to fetch urls like /.foo
14:09 ZadYree even if I got this: $r->route('/(*)')->name('40​4')->to('Static#notfound');
14:09 ZadYree any clue?
14:09 CromeDome joined #mojo
14:09 ZadYree The issue is a high latent response
14:13 zt left #mojo
14:22 jnap joined #mojo
14:28 AmeliePoulain joined #mojo
14:29 xaka joined #mojo
14:42 whee joined #mojo
15:21 Britzel joined #mojo
15:26 GabrielVieira joined #mojo
15:40 tempire I like having remove, but I thought it was decided against long ago for some reason
15:40 tempire though I can't remember what the reason was
15:42 marcus sri thought it was redundant.
15:42 sri see link above
15:42 sri it was about consistency of the api and maintenance cost
15:45 sri people missing $dom->replace('') and using regular expressions instead changed cost/gain ratio a little for me
15:45 tempire regarding dom: "It's kinda ugly" & "there are no downsides besides memory usage"
15:45 tempire I figured that was precursor to you rejecting it
15:46 sri well, memory usage sucks a little
15:46 sri no way to get rid of the DOM instance once it has been generated
15:49 sri but i guess that memory cost could be limited to ->dom(...), then it wouldn't affect ->dom->find(...)
15:50 tempire the hidden inconsistency in that makes me uneasy
15:51 sri or we get rid of ->dom(...)
15:52 sri options are 1) memory cost for both 2) memory cost for ->dom(...) 3) get rid of ->dom(...)
15:57 mercutioviz joined #mojo
16:01 mire joined #mojo
16:11 GitHub103 joined #mojo
16:11 GitHub103 [mojo] kraih pushed 1 new commit to master: http://git.io/S46Y_g
16:11 GitHub103 [mojo/master] improved RFC 3986 compliance of Mojo::Parameters - Sebastian Riedel
16:11 GitHub103 left #mojo
16:13 sri marcus, tempire, crab: make a choice!
16:13 sri 1 is currently implemented, but i'm fine with all three
16:13 * tempire dislikes all available options
16:14 sri tempire: don't think there are other options
16:18 tempire well 3 isn't really an option
16:18 tempire I bet that's used all over the place
16:18 sri there may be a 4th option, but nobody will ever understand the code
16:19 sri refcount hacks and aborting object destruction...
16:19 tempire I assert that there's a 4th option.  but I don't understand the details of why the problem is.
16:20 tempire where's the offending but necessary weaken?  _parent?
16:20 sri ->dom(...) generates a Mojo::DOM object and performs a ->find on it, which generates a Mojo::Collection with a few elements from the original Mojo::DOM object
16:21 sri once that happens nobody holds a reference to the original Mojo::DOM object anymore
16:21 sri and the parent references in the Mojo::Collection turn to undef
16:21 sri since they are weak
16:22 sri Mojo::DOM::HTML weakens the parent
16:22 sri it's in the tree
16:25 sri actually, i refuse option 4, it's just too crazy :)
16:33 ZadYree joined #mojo
16:43 pau4o left #mojo
16:44 sri hmmmmm
16:44 sri i actually have option 4 implemented :o
16:47 bobkare just a crazy idea: The problem is that you need to weaken because parent points to child and child to parent, right? Would it be possible to weaken the parent pointer initially but un-weakening it when a reference to a child is given out?
16:48 sri then you have a circular reference
16:52 GabrielVieira joined #mojo
16:53 sri http://hastebin.com/raw/fafolobuqi # here's a first try, in case someone feels like making it sane
16:54 sri i have no idea if it leaks though
16:55 sri test case is in t/mojo/response.t
16:55 sri if you comment out the DESTROY you'll see it fail
16:56 sri actually i'm pretty sure it leaks, since the ref count to the parent can increase again when ->root or ->parent is called
16:57 * sri is getting a headache
16:57 sri fuck ref counting
17:03 inokenty joined #mojo
17:08 whee sri++
17:11 sri what did i do?
17:11 sri leak confirmed btw :(
17:29 d4rkie joined #mojo
17:37 titan joined #mojo
17:39 titan Hi there! I'm parsing an Atom feed and one of the elements is <author><flickr:nsid></flickr:nsid></author>. I've gotten as far as printing out the DOM for $e->author, but haven't been able to get the text from flickr:nsid.
17:39 titan I've tried a few different things, but I haven't yet succeeded. Any tips?
17:41 titan Ha, all I needed to do was ask to disocver the answer: $e->author->at('flickr\:nsid')->text
18:04 whee sri: I just need to keep track of you
18:04 * sri hides
18:07 whee don't make me mark and sweep; you won't like where I stick the flag
18:07 * tempire <3's retweets
18:08 * sri <3's good blog posts
18:09 rem_lex|pivo joined #mojo
18:29 vel joined #mojo
18:35 sri yea, can't get option 4 to work without a leak somewhere... so it's 1, 2 or 3 again
18:46 vel joined #mojo
18:47 xaka1 joined #mojo
18:52 titan Mojolicious makes me money.
18:59 mike_ is there any way to serve up a different set of templates based on hostname?
19:23 tempire mike_: you can examine  $self->req->url->base->host and do whatever you please
19:29 mike_ thanks!
19:29 mike_ now, is there a way to overload the render call so I only write that once?
19:29 tempire you don't want to overload
19:29 tempire use a bridge or helpers
19:29 tempire or both
19:33 xaka joined #mojo
19:34 mike_ i couldnt wrap my head around bridges
19:34 tempire do you understand "under"?
19:36 mike_ nope
19:36 mike_ i'm a n00n
19:37 mike_ noob too
19:37 * tempire accepts the noons
19:37 Kulag joined #mojo
19:37 tempire mike_: have you seen the mojocasts?
19:38 mike_ i watched one or two over a year ago
19:38 tempire take 30 minutes to go through them, it will save you gobs of time
19:38 mike_ roger
19:38 tempire GOBS!
19:57 tempire mike_: this will address bridge/under short term: http://mojocasts.com/e3#Under%20directive
19:57 Mad_Dud- hi guys. could you help me with arrayref to hashref conversion to use TagHelpers and select_field. I have fetchall_arrayref() from dbi as input.
19:57 Mad_Dud- .. and the first element is supposed to be element taken as optgroup
20:29 tempire I wonder if it's worth it to post the deploy-in-one-step post to hackernews
20:30 * tempire phears punishment from the y combinator gods
20:33 Mad_Dud tempire: could you help me with preparing hashref for taghelpers select_field, please?
20:34 tempire need more specific question in order to help
20:34 njlg joined #mojo
20:34 xaka joined #mojo
20:35 Mad_Dud sure (i thought that you can see a backlog.
20:35 Mad_Dud i have an output from fetchall_arrayref. [0] is name of country and 1..4 are other parameters
20:36 Mad_Dud i would like to have this: %= select_field country => [{Europe => [[Germany => 'de'], 'en']}]
20:36 tempire have you already attempted it with code?
20:36 Mad_Dud yes,
20:36 Mad_Dud i can post pastebin with my atempts if you like
20:36 Mad_Dud attempts*
20:37 spaceships joined #mojo
20:38 Mad_Dud i got this from other friend, but it does not seem to work even when i tried to modify it [code] while (my @arr = fetchrow_arrayref..,) { map { $group{$_[0]}++ } @arr; } [/code]
20:55 tempire if you're beginning with perl, it's best to start with for loops rather than map when manipulating hash/array refs
20:56 tempire unless you have a specific background in functional style
21:02 Mad_Dud you are right.
21:04 gryphon joined #mojo
21:43 dvinciguerra joined #mojo
21:45 GabrielVieira joined #mojo
21:46 lukep joined #mojo
21:51 lukep joined #mojo
22:11 GabrielVieira joined #mojo
23:09 gryphon joined #mojo
23:40 tempire It's clear to me that perigrin is a mojolicious user: http://twitter.com/perigrin​/status/227543815936958465
23:47 tempire hmm.  post never even appeared on the front page, but still got several hundred hits coming from hackernews.

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