Camelia, the Perl 6 bug

IRC log for #mojo, 2010-11-21

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

All times shown according to UTC.

Time Nick Message
00:24 arpadszasz left #mojo
00:30 JonChisciotte left #mojo
01:19 tholen_ joined #mojo
01:23 tholen left #mojo
01:23 tholen_ is now known as tholen
02:39 tempire und3f: you should put the synopsis from the MojoX::Ping pod in a README, so usage is clear when viewing the github repo
04:04 tl joined #mojo
04:06 tholen42 left #mojo
04:27 su-bzero joined #mojo
04:32 su-bzero_ left #mojo
04:35 ashleydev_logbot left #mojo
04:36 ashleydev left #mojo
04:40 achromic left #mojo
04:48 Kulag left #mojo
04:52 crab i wonder what i'm doing wrong.
04:52 Kulag joined #mojo
04:54 achromic joined #mojo
05:01 crab oh, it's not that the sub doesn't return the right text. it's that $self->content($name => $self->content($name).$block->()) doesn't change the return value of $self->content($name)
05:02 crab where is this "content" sub? i can't seem to find any sub named content. must investigate.
05:22 crab hmm. $self->stash('mojo.content')->{$name}
05:26 Kulag left #mojo
05:27 Kulag joined #mojo
05:35 crab ok, if i do $self->stash('mojo.content')->{$name} .= $block->(), it works.
05:36 Kulag left #mojo
05:36 Kulag joined #mojo
05:40 tholen left #mojo
05:47 Kulag left #mojo
05:48 crab huh.
05:50 Kulag joined #mojo
05:57 crab sri: whenever you're around next, i'll explain what i want to do and you can tell me if it makes more sense than the other day
05:58 crab in the meantime, i'll try to implement it
06:19 ashleydev_logbot joined #mojo
06:45 y0j left #mojo
06:49 sri crab: oh right i forgot that ->content doesn't change the value once it is set, for template inheritance
07:01 sri crab: mojo.content is internal though, you should use your own stash key for the new helper
07:03 y0j joined #mojo
07:05 Kulag left #mojo
07:06 GitHub116 joined #mojo
07:06 GitHub116 mojo: master Sebastian Riedel * 75b8fcd (1 files in 1 dirs): pod cleanup - http://bit.ly/duFi87
07:06 GitHub116 left #mojo
07:09 Kulag joined #mojo
07:13 Kulag left #mojo
07:13 Kulag joined #mojo
07:47 perlrocks left #mojo
08:04 JonChisciotte joined #mojo
08:19 crab sri: if i use my own stash key, how do i give it to mojo during final template assembly?
08:20 sri crab: what?
08:20 crab sri: suppose my "append_to" helper keeps appending stuff to $stash->{'ams.blah'}
08:21 crab sri: when/where do i something so that the content is plugged in to the "content styles" section of my template?
08:21 crab content blah"
08:22 sri you don't
08:22 sri you would use your helper all the way
08:23 crab i must be missing something.
08:24 sri do not mess with the content helper at all
08:26 crab ok, then what should i do? suppose i make up an "appendable blah" helper to mark the point in the template where all the "append_to blah" content should go. what next?
08:26 crab oh. is the template rendered in a single pass? so that if the text of something isn't known when it's encountered in the template, i'm screwed?
08:26 crab no, that can't be true.
08:28 * sri doesn't follow
08:28 arpadszasz joined #mojo
08:29 crab sri: i'll tell you in a few minutes, i'm being angrily called to lunch ;-)
08:38 sri mmmm...lunch
08:43 crab ok, back.
08:44 crab ok, so my layouts/default.html.ep contains <% content 'styles' %>, and in some templates/blah/blee.html.ep, i have <% content styles => begin %> ... <% end %>
08:45 crab i want the same thing, except that in the layout i say (e.g.) <% appendable_block 'styles' %> and in templates/blah/foo.html.ep i say <% append_to styles => begin %> ... <% end %>, but also include bar.html.ep, which says <% append_to styles => begin %> something else <% end %>
08:46 crab and i want to end up with <style type=text/css>...something from foo...something from bar...</style> in the final rendering
08:49 giwi joined #mojo
08:51 und3f[A] is now known as und3f
08:52 und3f morning
09:14 crab so how do i accomplish that, if i can?
09:17 daviddelikat1 joined #mojo
09:17 JonChisciotte left #mojo
09:19 daviddelikat left #mojo
09:36 sri crab: ignore the content helper
09:36 sri crab: just make your own alternative
09:39 crab sri: right, i'm ignoring the content helper now. i mentioned it only to explain what i have now.
09:40 crab and i understand how to implement append_to (it's trivial, just append $block->() to a private stash key)
09:40 sri yea, whats the question?
09:41 sri it seems like you got everything you need
09:41 crab how does the text go from my private stash key to my rendered web page?
09:41 sri use your helper as a getter too
09:42 crab ah!
09:42 crab but of course. thank you.
09:42 sri <%= content_stack 'styles' %> or so
09:42 crab i don't need to call render_inner myself anywhere, right?
09:42 sri you could use a name that works for both get and set or use two helpers
09:42 sri no you don't
09:43 sri there is no magic
09:43 sri you might want to wrap the result in a Mojo::ByteStream to avoid escaping though
09:44 sri but thats normal Mojo::Template stuff
09:54 und3f sri, btw, shouldn't i move my modules to mojolicious namespace instead of mojox?
09:56 sri und3f: do they depend on Mojolicious or just Mojo?
09:56 und3f sri, just Mojo
09:56 sri then MojoX seems appropriate
09:57 sri actually MojoliciousX might be my suggestion for stuff that depends on Mojolicious
09:58 sri the Mojolicious::* and Mojo::* namespaces are mine!
09:59 sri there's a reason we have specific sub namespaces for commands and plugins ;p
09:59 und3f sri, it is not yours! it is for all people in da world
09:59 und3f FREE THE MOJO!
10:00 sri ARREST THIS MAN!
10:00 und3f Join the revolution :)
10:00 und3f I am an outlaw now :(
10:00 und3f Outlaw for outlaws :)
10:00 sri DEAD OR ALIVE! 10 KARMA POINTS REWARD!
10:01 und3f i'll run to Canada and you will not catch me
10:01 und3f no, to Mexico
10:03 sri mmmm...mexican food...
10:15 snearch joined #mojo
10:20 arpadszasz left #mojo
10:26 koban joined #mojo
10:53 memememomo_ is now known as memememomo
10:54 memememomo is now known as memememomo_
11:08 crab <% require 'http://foo.bar/baz/quux' => 'css' %> or <% require css => 'http://foo.bar/baz/quux' %>?
11:08 crab the latter looks nicer, but the former can be made optional with a $url =~ /\.css$/ check
11:09 crab i could do that to the latter too, i guess. it's only slightly more complicated.
11:19 koban left #mojo
11:19 sri crab: what does it do?
11:26 crab sri: queues up a <script ...> or <link rel=stylesheet ...> tag for inclusion in the template via <% dependencies %>
11:26 sri you do know we have javascript and stylesheet tag helpers built in?
11:27 crab yes. but they render where they're defined and i want to keep them in one place.
11:29 crab (in <head>)
11:30 sri you don't think this looks better? <% for_head begin %><%= javascript 'script.js' %><% end %>
11:32 crab i didn't know about for_head.
11:32 crab oh, you're calling the thing i did for_head. i see.
11:32 sri it does not exist :)
11:32 sri yea
11:32 sri there are prolly better names, was just the first thought
11:33 crab sri: that would be a perfectly acceptable solution, though i think <% requires 'script.js' %> is easier to read.
11:34 crab if i had consciously thought of using the javascript helper, i probably would have.
11:40 sri i like the block solution because it allows more, like meta tags and actual javascript/css
11:54 crab yeah. i also have append_css and append_js helpers.
11:54 crab except i just now decided to call them just css and js
11:56 sri http://cpanratings.perl.org/dist/Mojolicious # thanks everyone for voting, could still use more though! :)
12:08 arpadszasz joined #mojo
12:11 tholen joined #mojo
12:11 giwi left #mojo
12:11 tholen_ joined #mojo
12:12 giwi joined #mojo
12:13 giwi left #mojo
12:17 tholen left #mojo
12:17 tholen_ is now known as tholen
12:23 und3f sri, you don't support not connected sockets in Mojo::IOLoop
12:26 und3f at least not to drop them
12:40 crab in sub register, how can i get at the stash?
12:40 crab oh, typo.
12:46 sri und3f: what?
12:50 und3f sri, can add support of connectionless sockets to Mojo::IOLoop
12:50 und3f ?
12:50 sri more context!
12:50 und3f what context?
12:51 sri you are impossible to understand again
12:51 und3f sri, if i connect RAW socket to specified address it doesn't receives destination unreachable and other error messages
12:52 sri ok, so?
12:52 sri what exactly needs to be done?
12:53 und3f sri, add state to socket "connectionless" and depend on that state don't check connection in _write and also add support of destination for $loop->write function
12:54 crab oh.
12:54 crab i can't use <% foo => begin %> without triggering a couple of "useless use of ..." warnings
12:54 crab as opposed to <%= foo ... %>
12:55 sri crab: think about that again... would you write foo => 'bar' in normal perl code?
12:55 sri if foo was a sub
12:56 sri und3f: destination?
12:57 und3f sri, for connectionless sockets we need to pass send_to (4d argument of send function)
12:58 sri ok, i think thats beyond the scope of Mojo::IOLoop
12:59 und3f seems ping is beyond the scope of mojo
12:59 sri yea
13:03 sri raw sockets are a huge can of worms with questionable value for a framework focused on http
13:05 und3f i'll rewrite it on IO::Poll
13:05 und3f or something else
13:05 sri you could just use poe or anyevent and use the on_tick trick
13:06 crab am i doing something wrong, or is <%= css => begin =%> ... <% end %> expected to put "css" in my template where it is rendered?
13:06 und3f sri, if i'll do that i need to rename it also
13:06 sri whats wrong with renaming?
13:06 crab my css handler is currently sub{}, so it's not what i am returning.
13:07 sri crab: think about that code again, it is broken perl ;p
13:07 und3f sri, nothing
13:08 crab oh! <% css begin %> works exactly as i expect.
13:09 crab sorry. i thought it was being parsed differently.
13:09 sri no magic if we can avoid it ;)
13:15 perlrocks joined #mojo
13:18 perlrocks Twitter: "The #mojolicious event loop is for internal use only, use real ones like #poe instead for your apps! ;) http://bit.ly/93GIv0 #perl" --kraih http://twitter.com/kraih/status/6335704149786624
13:19 sri i think thats a point i should make
13:21 sri if i was aiming for a general purpose event loop it would look much different
13:24 ysyrota joined #mojo
13:24 perlrocks Twitter: "If there is anything we could do to make Mojo::IOLoop work better with common #perl event loops please let me know. #mojolicious" --kraih http://twitter.com/kraih/status/6337204406194177
13:26 crab ok, now it all works brilliantly.
13:26 crab now i just need to work out my parameterised include :-)
13:27 crab then i can include nice self-contained widget templates
13:27 GitHub171 joined #mojo
13:27 GitHub171 mojo: master Sebastian Riedel * 18174aa (2 files in 2 dirs): micro optimization - http://bit.ly/cYCFMV
13:27 GitHub171 left #mojo
13:31 crab sri: so suppose i have a "delete button" widget, which i <% include 'delete_button' %> in the right place in my page.
13:31 crab sri: but in one case i want it to say "Delete" and in another case i want it to say "Destroy"
13:31 crab sri: this is what i wanted to do yesterday. how would you have done it?
13:32 crab assume that the widget has more complicated markup than just a button, of course. plus associated css/js, which now works.
13:32 sri <%= include 'delete_button', foo => 'Delete' %>?
13:32 sri you can pass stash keys
13:33 sri <%= $foo %>
13:33 crab excellent. then <%= include 'delete_button', foo => begin %> ... <% end %> will do perfectly.
13:33 crab and i can check if stash->{foo} is a coderef and run it, if so
13:33 crab thanks.
13:34 sri should work, has side effects though
13:34 crab what side effects?
13:34 sri errors won't be that nice
13:34 crab hmm.
13:34 sri you might have trouble locating them
13:34 crab anything i can do about that?
13:35 sri thats why i made the content helper run code refs right away and cache the result
13:35 sri naah, it's a general problem
13:35 sri you are passing around code refs generated in evals
13:35 crab oh, ok.
13:36 crab yeah.
13:37 crab well, i could avoid using include. i could write a helper that runs the coderef (if there's a coderef), sets the stash key, and then does what include does internally.
13:37 sri those nice error screens showing the template line that failed only work one layer
13:38 sri thats the main side effect
13:38 sri yes, you should do that
13:39 sri rendering stuff delayed without a good reason is only asking for trouble
13:39 crab i shall call it inclued!
13:40 sri like the stash state will surely have changed...and and and
13:40 sri heh
13:43 MojoGuest937 joined #mojo
13:43 MojoGuest937 From: http://xantus.tumblr.com/page/2 (8 hits)
13:44 MojoGuest937 left #mojo
13:45 crab sri: the block will always be the last argument, right?
13:45 sri right
13:45 crab i can't say ... <% end, foo => 3 %>? ok, good
13:47 sri actually that might be possible
13:47 sri :)
13:50 sri we have an <% end for 1..3; %> test case
13:52 crab fortunately it is a syntax error :-)
13:53 crab it woiks!
13:53 crab (the code, not that horror)
14:10 jdixon joined #mojo
14:10 jdixon morning
14:11 jdixon does mojo support PUT requests?
14:12 jdixon I would think so, but I'm getting a strange error when I try PUT instead of POST.
14:12 jdixon String found where operator expected at ./index.pl line 89, near "put '/users/:profile'" (Do you need to predeclare put?)
14:12 tholen left #mojo
14:12 jdixon if I replace put with post, it works fine.
14:23 und3f sri, checkout https://github.com/und3f/mojox-pi​ng/blob/master/lib/MojoX/Ping.pm
14:24 und3f sri, but it loads cpu if nothing except MojoX::PIng works on IOLoop
14:28 und3f sri, also we need to setup multiple callbacks to on_tick
14:30 und3f sri, and also delete callback from on_tick
14:32 sri und3f: it's just a callback, it has everything you need
14:33 jdixon sri: I tweeted you last night about PUT
14:33 und3f sri, that about your tweet
14:33 sri und3f: i'm having trouble understanding you again :S
14:34 sri jdixon: more context
14:34 sri jdixon: mojolicious has many layers
14:34 jdixon I get an error when I try to PUT instead of POST.
14:34 sri with what?
14:34 jdixon String found where operator expected at ./index.pl line 89, near "put '/users/:profile'"
14:34 jdixon (Do you need to predeclare put?)
14:34 sri client?
14:34 sri (Mojo::Client?)
14:35 und3f sri, now to use multiple modules that uses different event loops is hard - every module will setup it's callback to $loop and nothing will work
14:35 jdixon sri: sorry, are you asking me?
14:36 sri und3f: ok, that might be true
14:36 sri jdixon: yes
14:36 jdixon Mojolicious::Lite
14:36 und3f sri, if i'll run multiple MojoX::Ping at same time just one of them will work
14:36 sri ah
14:36 und3f sri, also it will break existing functionality if someone else set on_tick_cb
14:36 sri und3f: will improve that
14:37 sri jdixon: there is no put function in Mojolicious::Lite
14:37 sri jdixon: atm you would use any instead
14:38 sri like any ['put'] => '/foo'...
14:38 jdixon oh ok, thanks
14:38 * jdixon tries
14:38 sri i'm open for improvements there though
14:39 sri like adding put/del
14:39 und3f i am for sure need to create Mojo::IOLoop::Nice :)
14:39 jdixon yes, I'd like to see both
14:39 jdixon trying to be idempotent  :)
14:41 jdixon sri: looks like that works, thanks
14:41 sri adding put/del right now :)
14:41 jdixon nice
14:42 jdixon btw, I really appreciate your work on Mojo.  it's the first web framework of any sort that I've preferred over doing it myself.  :)
14:42 sri :)
14:46 MojoGuest740 joined #mojo
14:46 MojoGuest740 From: http://www.google.fi/url?sa=t&amp;source=web​&amp;cd=2&amp;ved=0CCEQFjAB&amp;url=http%3A%​2F%2Fdev.xantus.org%2F&amp;rct=j&amp;q=webso​ckets%20demo&amp;ei=BDDpTNqkKI7oOdOkyIcK&amp​;usg=AFQjCNGw6nZv0wO42uzUnHhWcD0vcKNULg&amp;​sig2=_rImcxo_FsKipm7VidzCTQ&amp;cad=rja (1 hits)
14:47 MojoGuest740 lol
14:47 MojoGuest740 left #mojo
14:47 MojoGuest18 joined #mojo
14:47 MojoGuest18 From: http://www.google.fi/url?sa=t&amp;source=web​&amp;cd=2&amp;ved=0CCEQFjAB&amp;url=http%3A%​2F%2Fdev.xantus.org%2F&amp;rct=j&amp;q=webso​ckets%20demo&amp;ei=BDDpTNqkKI7oOdOkyIcK&amp​;usg=AFQjCNGw6nZv0wO42uzUnHhWcD0vcKNULg&amp;​sig2=_rImcxo_FsKipm7VidzCTQ&amp;cad=rja (2 hits)
14:47 MojoGuest18 /kick plu
14:47 MojoGuest18 left #mojo
14:48 GitHub94 joined #mojo
14:48 GitHub94 mojo: master Sebastian Riedel * 998570d (4 files in 3 dirs): added put and del functions to Mojolicious::Lite - http://bit.ly/bc1nPN
14:48 GitHub94 left #mojo
14:48 sri jdixon: there ya go :)
14:48 jdixon woot
14:49 MojoGuest100 joined #mojo
14:49 MojoGuest100 From: http://www.google.fi/url?sa=t&amp;source=web​&amp;cd=2&amp;ved=0CCEQFjAB&amp;url=http%3A%​2F%2Fdev.xantus.org%2F&amp;rct=j&amp;q=webso​ckets%20demo&amp;ei=BDDpTNqkKI7oOdOkyIcK&amp​;usg=AFQjCNGw6nZv0wO42uzUnHhWcD0vcKNULg&amp;​sig2=_rImcxo_FsKipm7VidzCTQ&amp;cad=rja (3 hits)
14:49 MojoGuest100 left #mojo
14:49 sri und3f: i'll handle on_tick and on_idle just like timers i think (returning id and using drop to delete
14:49 und3f sri, that will be nice
15:07 Drossel joined #mojo
15:07 Kulag left #mojo
15:11 Drossel left #mojo
15:11 Kulag joined #mojo
15:23 GitHub82 joined #mojo
15:23 GitHub82 mojo: master Sebastian Riedel * 21d67b1 (3 files in 3 dirs): added on_idle and on_tick event handlers to Mojo::IOLoop - http://bit.ly/cIt7Nt
15:23 GitHub82 left #mojo
15:23 sri und3f: there ya go
15:26 und3f sri, on_tick wasn't experimental
15:26 sri i don't see a deprecation path, do you?
15:27 und3f me too
15:27 sri i expect most code to still work though
15:27 sri like the wiki example does not change at all
15:29 perlrocks Twitter: "Mojo::IOLoop::on_tick removed in latest #Mojolicious revision http://bit.ly/d9YYjs don't forget to update your apps" --und3f http://twitter.com/und3f/status/6368512301858816
15:29 sri huh, it was not
15:29 und3f Not?
15:29 sri that tweet is wrong
15:29 und3f oh...
15:29 und3f i have delete button :)
15:30 sri now i see why you were worried about it not being experimental xD
15:31 sri naah, usage just changed a little bit
15:33 GitHub139 joined #mojo
15:33 GitHub139 mojo: master Sebastian Riedel * 6ff58aa (1 files in 1 dirs): cleanup - http://bit.ly/brtLfp
15:33 GitHub139 left #mojo
15:37 ashleydev joined #mojo
15:40 GitHub38 joined #mojo
15:40 GitHub38 mojo: master Sebastian Riedel * 6a16e98 (1 files in 1 dirs): cleanup - http://bit.ly/bhWB9X
15:40 GitHub38 left #mojo
15:53 spleenjack joined #mojo
15:58 spleenjack left #mojo
16:04 crab can i prove that a given template isn't in use at all?
16:05 crab to a reasonable degree. i'm not thinking of code that is trying to trick me, but methods which use a particular template implicitly
16:37 GitHub30 joined #mojo
16:37 GitHub30 mojo: master Sebastian Riedel * cc1e346 (1 files in 1 dirs): removed bad example - http://bit.ly/93FKro
16:37 GitHub30 left #mojo
16:45 jdixon left #mojo
16:50 dotan joined #mojo
16:59 dotan left #mojo
17:20 kvorg joined #mojo
18:23 tholen joined #mojo
20:24 tab joined #mojo
20:37 tab left #mojo
20:43 tempire left #mojo
21:08 ltriant joined #mojo
21:28 snearch left #mojo
21:31 arpadszasz left #mojo
21:32 tholen left #mojo
21:32 perlite_ joined #mojo
21:35 perlite left #mojo
21:36 perlite_ is now known as perlite
21:47 ysyrota left #mojo
22:02 spleenjack joined #mojo
22:18 y0j left #mojo
23:09 memowe_ left #mojo
23:09 memowe joined #mojo
23:56 und3f is now known as und3f[A]

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