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

IRC log for #mojo, 2015-01-08

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

All times shown according to UTC.

Time Nick Message
00:07 juikuen joined #mojo
00:29 HtbaaPi joined #mojo
01:08 hotsnow joined #mojo
01:22 hshong joined #mojo
01:24 rem_lex|pivo joined #mojo
01:41 aggrolite joined #mojo
02:12 Insane joined #mojo
02:40 klapperl joined #mojo
03:25 good_news_everyon joined #mojo
03:25 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/2Rynyg
03:25 good_news_everyon mojo/master 677f1c6 Sebastian Riedel: improved Mojo::Reactor::EV performance slightly
03:25 good_news_everyon left #mojo
03:26 sri i'm sure there's still quite a bit of optimization potential
03:26 sri profiling the low level bits would be a nice task for someone who wanted to get to know the event loop in detail
03:30 jberger I'm reading about the new Test::Simple and I'm going to try my hand at porting Test::Mojo to use the new functionality
03:30 jberger obviously it couldn't be merged yet
03:31 sri what's getting better?
03:31 jberger building testing tools
03:31 jberger no more $Test::Builder::Level
03:32 jberger contexts, streams, events
03:32 sri hmm, i guess we wouldn't be able to merge it for years
03:32 jberger I'm sure its going to be dual-lifed
03:32 sri the old way will keep working right?
03:32 jberger yes
03:33 jberger hes been smoking all of CPAN regularly, so if you haven't heard from him, we are fine
03:33 jberger but still, I'm curious to see what it would look like
03:34 sri we don't actually use much Test::Builder features
03:34 noganex_ joined #mojo
03:35 jberger I know, which is why I don't think this will be hard
03:35 sri btw. i actually like $Test::Builder::Level because it's consistent with $Carp::CarpLevel
03:36 jberger speaking of which, I think we might want to look at adding some @Carp::NOT in a few classes
03:37 jberger I had to do this: https://github.com/jberger/Mojo-IOLoop-ForkCall/blob/c7cea5ce72e377231151f350dba31cc3741bc1ef/lib/Mojolicious/Plugin/ForkCall.pm#L7
03:37 sri huh?
03:38 jberger so that this would work as expected: https://github.com/jberger/Mojo-IOLoop-ForkCall/blob/3136b99259d5bd52578bcf85b41a9cef48b5c160/t/helper.t#L39
03:38 jberger (sorry, had to find the reference)
03:38 jberger I believe that if Mojolicious::Plugin were to do that, it would fix it everywhere
03:40 sri does that work for custom controllers too? MyApp::Controller::Foo?
03:40 jberger basically it says that Carp should never report errors as having come from Mojolicious or Mojolicious::Controller, which is what helpers do if they carp
03:40 sri i'm sceptical there
03:40 jberger I believe that it is all controlled by inheritance, but I'm not 100% sure about any of it TBH
03:40 jberger I have been meaning to try that out too at some point
03:41 sri sounds like it would have a lot of downsides
03:42 sri modifying globals sucks
03:43 jberger it would have to be considered carefully
03:43 sri (actually i have no idea how that part of Carp works... so...)
03:43 jberger but if things behave as I think they do, it would be nice because of how helpers get autoloaded via app and controllers
03:43 sri yea, you'd have to explain it to me in detail first ;p
03:44 sri ELI5!
03:44 jberger ?/
03:44 jberger ah
03:44 sri http://www.reddit.com/r/explainlikeimfive/
03:45 sri purl: eli5 is <reply>explain like i'm five!
03:45 purl OK, sri.
03:46 jberger sri: basically what I know is from the description here: https://metacpan.org/pod/Carp#DESCRIPTION
03:46 jberger carp doesn't just report from a given level, it has a decision engine which helps it decide which stack levels to skip
03:47 jberger the current frame is of course always skipped (that is the basic understanding of carp)
03:48 jberger then you can designate callers that are "safe" by adding them to the package's @CARP_NOT
03:49 jberger then point 3 says that trust is transitive and inherited
03:50 Eke- joined #mojo
03:50 jberger so as I understand it if we were to set @Mojolicious::Plugin::CARP_NOT = qw/Mojolicious Mojolicious::Controller/, then when I write a plugin (which inherits from Mojolicious::Plugin) and it declares a helper, then it can safely carp and Carp will skip Mojolicious and Mojolicious::Controller stack frames
03:51 jberger thus emitting the error from the actual caller and not from Mojolicious::AUTOLOAD or Mojolicious::Controller::AUTOLOAD
03:52 jberger my only proof of that is that if you change https://github.com/jberger/Mojo-IOLoop-ForkCall/blob/3136b99259d5bd52578bcf85b41a9cef48b5c160/lib/Mojolicious/Plugin/ForkCall.pm#L7
03:52 jberger from our @CARP_NOT = qw/Mojolicious Mojolicious::Controller/; to @Mojolicious::Plugin::CARP_NOT = ...; the test still passes
03:55 jberger remove the line entirely and you see that the test fails, because the carp error is emitted from Mojolicious/Controller.pm line 36 rather than the correct line in the test script
03:57 skittles_ joined #mojo
03:58 skittles_ hey can someone point in the right direction of how to inject a cookie so that it works in url queue?
03:59 jberger url queue?
03:59 jberger my gist?
04:00 jberger man, I really am going to have to either delete that or make it nice and release it
04:00 jberger skittles_: for the record, that is only meant as an example crawler and there are numerous reasons why that is true
04:02 skittles_ jberger: I am using it as a base merely for data aggregation. so a one off script. How could I go about having it inject a request cookie as it loads page, or is that even possible?
04:03 jberger skittles_: I've never tried
04:03 skittles_ Oh... well I will see what I can come up with.
04:03 jberger I would start by figuring out where Mojo::UserAgent keeps its cookies
04:04 good_news_everyon joined #mojo
04:04 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/URDL8A
04:04 good_news_everyon mojo/master ab8be9b Sebastian Riedel: added example for custom cookies
04:04 good_news_everyon left #mojo
04:04 * jberger giggles about tossing cookies
04:04 jberger sri: ok well there it is :-)
04:05 jberger skittles_: ^^
04:07 skittles_ Thanks!
05:16 irq joined #mojo
05:29 jberger sri: this is the patch: http://pastie.org/9819476
05:29 jberger not very interesting I guess
05:37 jberger the context is a interesting design
05:38 jberger it is a weak singleton
05:39 jberger so by simply holding a strong reference to it anything father up the call stack will get the same one
05:39 jberger (unless you ever a subtest)
05:39 jberger enter
05:39 jberger in which case those weak singletons are on a stack
05:40 jberger anyway that was some fun investigation
05:40 jberger now nn
05:56 rem_lex|pivo joined #mojo
05:59 tempire batman: what happened to mojo::facebook?
06:03 dotandimet joined #mojo
06:08 Grinnz joined #mojo
06:15 Grinnz_ joined #mojo
06:54 basiliscos joined #mojo
07:02 marcus mojo::sitonmyfacebook
07:07 Eke- joined #mojo
07:07 dod joined #mojo
07:09 batman tempire: do you still use it?
07:09 tempire yes
07:09 batman i thought everything in it was deprecated by facebook :(
07:09 tempire It works for me
07:10 batman tempire: you're co-auth on github now. go crazy :)
07:10 mmp joined #mojo
07:11 batman https://github.com/jhthorsen/mojo-facebook
07:11 batman i have to go to work now
07:11 batman back in an ~hour
07:11 dod joined #mojo
07:13 batman you're also co-maint on pause
07:13 batman "Added TEMPIRE to co-maintainers of Mojo::Facebook"
07:13 * batman can't seem to reach headjs.com
07:14 batman tempire: so you can make a new release, while i'm away now if you like
07:15 batman i can upload it when i get http://www.brooksgroup.com/assets/2013/08/Round-tuit1.jpg
07:28 dotandimet joined #mojo
07:48 McA joined #mojo
07:49 Vandal joined #mojo
07:51 rem_lex joined #mojo
07:52 mmp joined #mojo
08:08 eseyman joined #mojo
08:22 trone joined #mojo
09:00 basiliscos joined #mojo
09:02 Lee joined #mojo
09:05 shorty_mu joined #mojo
09:14 marcus How do you make DBD::Pg fatpackable?
09:14 juikuen joined #mojo
09:16 fhelmberger joined #mojo
09:26 batman marcus: the idea was not to use DBD::Pg
09:26 irq joined #mojo
09:26 batman marcus: regarding convos, right..?
09:27 batman convos with flat files (no need for database) and single process (no need for pub sub)
09:32 HtbaaPi joined #mojo
09:37 marcus batman: I think it could work.
09:38 batman wanna go crazy and make it...?
09:39 marcus need more of those wood coins ^^
09:39 batman :D
09:39 dotan joined #mojo
09:40 batman i guess we need ::ForkCall for search and scrollback
09:40 marcus aiee
09:40 batman to the batmobile!
09:40 marcus grep and tail?
09:40 batman s/bat/madcoding/
09:41 batman yeah, i guess so. or https://metacpan.org/pod/App::Ack::Filter comes to mind
09:42 batman guess we could even add pubsub with tail ;)
09:43 marcus I think we should start with the simplest thing that could work
09:48 Insane joined #mojo
09:49 * batman agrees
09:50 batman can we keep the existing log format marcus?
10:12 arthas joined #mojo
10:22 Insane joined #mojo
10:33 dp_ joined #mojo
10:35 Eddy joined #mojo
10:46 absolut_todd joined #mojo
10:54 denis_boyun joined #mojo
10:57 Dandre left #mojo
11:00 amon joined #mojo
11:01 batman sri: would this be an acceptable tail module? https://gist.github.com/jhthorsen/a08f6e3d4e8901d7861b
11:05 batman (or anyone else)
11:17 Dandre joined #mojo
12:43 asarch joined #mojo
12:53 neilhwatson joined #mojo
13:09 jkramer joined #mojo
13:09 jkramer Ahoy
13:10 jkramer Is there a way to have my controller named App::EBay or even App::eBay? It looks like when routing to "ebay#something", it only looks for App::Ebay
13:11 jkramer Also tried ->to(controller => 'EBay', action => 'something'), didn't help
13:17 jkramer With 'MyApp::eBay' it looks for 'MyApp::MyApp::eBay' :D
13:25 kwa joined #mojo
13:30 zivester joined #mojo
13:31 batman jb360: EBay should work, but not eBay.
13:32 batman jb360: are you sure you remembered to both rename the "package ...;" and filename when you tried EBay.pm and (controller => "EBay") ?
13:32 michael jkramer: it seems to work with 'namespace' instead of 'controller' (i.e. to( namespace => 'Full::Pkg::Name', action => 'method' ) )
13:32 batman arg. i meant jkramer
13:32 michael oh sorry, misread that totally
13:32 batman jb360: sorry about that
13:34 michael but i think that might still work for you, even if answering a different question?
13:37 batman jkramer: starting a module name with lowercase (except pragmas) is not a very standard way of naming in perl space.
13:39 jkramer batman: Yeah, but with EBay it's still looking for Ebay
13:39 jkramer I'll try the namespace thing
13:39 sh4 joined #mojo
13:40 jkramer michael: namespace works, thanks!
13:41 jkramer I wonder if this is a special case though, or if it also affects more "normal" camelcase names like UserLogin or something. That would be a rather common problem I guess
13:45 batman jkramer: both controller => "EXample" and "EXample#" works like a charm here
13:46 batman just tested to be absolutely sure
13:46 batman maybe you get tripped off because of the location of the template...?
13:46 batman (EXample because i tested with a generated app)
13:46 batman log: Routing to controller "Test::Controller::EXample" and action "welcome"
13:47 batman $r->get('/')->to('EXample#welcome');
13:52 jkramer batman: Not using a template. I'll try with controller again, maybe I got something wrong the first time
13:52 Ulti left #mojo
13:53 jkramer Ah, I know what was wrong. I think I used the full package name as controller before (MyApp::EBay). Now it seems to work
13:59 Insane joined #mojo
14:11 Adurah joined #mojo
14:28 Insane joined #mojo
14:35 klapperl connect_timeout timer seems always to be started at load time of Test::Mojo. What is the recommended way to start it later?
14:35 klapperl If I have MOJO_CONNECT_TIMEOUT=1 and run ...use Test::Mojo;sleep 2;Test::Mojo->new("MyApp")->get_ok... then I get Connect timeout.
14:36 jkramer How do you guys normally run hypnotoad on live systems? Just start it once manually or do you use some init scripts or daemon tools?
14:37 jkramer I'm using daemontools (http://cr.yp.to/daemontools.html) currently, but it's a little annoying sometimes with hypnotoad
14:37 jkramer With live systems I mean production webservices written with mojo and running with hypnotoad :)
14:49 moritz jkramer: so far I have only a small site and run it manually, but I'll use a systemd service file once I upgrade my OS
15:11 good_news_everyon joined #mojo
15:11 good_news_everyon [mojo] jberger created test_simple (+1 new commit): http://git.io/-U4byA
15:11 good_news_everyon mojo/test_simple fbd3c26 Joel Berger: updated Test::Mojo to use new Test::Stream::Context
15:11 good_news_everyon left #mojo
15:21 asarch Besides <pre></pre> is there any other HTML tag which shows the new line of a blog entry?
15:21 asarch With <p></p> everything is in a single line
15:22 Grinnz jkramer, you can do controller => 'e_bay'
15:24 jkramer Grinnz: Heh, nice hack :D Gonna try that later :)
15:29 Grinnz jkramer, not a hack, that's how it gets uncamelized
15:29 Grinnz or camelized, whatever
15:33 Grinnz sri, maybe examples with underscores mapping to camelcase could be included in these places? https://metacpan.org/pod/distribution/Mojolicious/lib/Mojolicious/Guides/Routing.pod#Special-stash-values or https://metacpan.org/pod/Mojolicious::Routes::Route#to
15:33 Grinnz i remember getting tripped up by the same thing
15:50 amon asarch: You can control how whitespace and newlines work with the "white-space: pre" CSS property.
15:51 asarch Thank you amon
15:51 asarch Thank you very much :-)
16:01 sri Grinnz: like?
16:02 sri the point of linking to the camelize function was to have more detailed examples there
16:03 sri i don't think duplicating everything is the solution, folks who don't bother following the link prolly won't pay much attention to the end of the section either
16:20 sri oh i know hat to do
16:22 disputin joined #mojo
16:23 good_news_everyon joined #mojo
16:23 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/wIEzRQ
16:23 good_news_everyon mojo/master b5bd406 Sebastian Riedel: better description for camelization
16:23 good_news_everyon left #mojo
16:28 Grinnz_ that's helpful i think
16:38 zackiv31 joined #mojo
16:58 Ptolemarch joined #mojo
17:06 dod joined #mojo
17:25 legz joined #mojo
17:28 Insane joined #mojo
17:34 sri lol, garbage collection vs http/2 http://lists.w3.org/Archives/Public/ietf-http-wg/2015JanMar/0057.html
17:37 sri i can't wait for all the new http/2 attacks with cutesy names and logos
17:44 bvinnerd joined #mojo
18:04 Ptolemarch joined #mojo
18:15 jberger sri: do you know anything about how wget does basic authentication?
18:15 jberger "According to the type of the challenge, Wget will encode them using either the basic (insecure), the digest, or the Windows NTLM authentication scheme"
18:15 jberger what does it mean "type of challenge"?
18:15 Grinnz_ the type the server asks for
18:16 Grinnz_ oh in wget... dunno
18:16 jberger how can I make my server request basic auth?
18:16 Grinnz_ when i did it with httpd, it was in the directives to set up auth
18:16 Grinnz_ with apache, that is
18:17 jberger I just want it to send the stinking Authentication: Basic suhgouhdgdupofghd thing
18:17 Grinnz_ what server?
18:17 purl server is confused.  What is the client sending to it?  Is it legal?
18:17 jberger my mojo app
18:17 Grinnz_ ah
18:18 Grinnz_ with apache, you either use mod_auth or mod_auth_digest
18:19 jberger this would imply that the client sends the server a request and the server is supposed to reply with some challenge
18:19 jberger I just want the first request to go to the server with the header
18:20 Grinnz_ right, there's a HTTP status for it
18:20 jberger in most cases, if you aren't logged in my app will redirect you to the login page
18:20 Grinnz_ 401 Unauthorized, i believe
18:21 jberger but if you happen to pass the Authentication header it will do that before_dispatch
18:21 Grinnz_ http://www.ietf.org/rfc/rfc2617.txt
18:21 Grinnz_ "The 401 (Unauthorized) response message is used by an origin server
18:21 Grinnz_ to challenge the authorization of a user agent. This response MUST
18:22 Grinnz_ include a WWW-Authenticate header field containing at least one
18:22 Grinnz_ challenge applicable to the requested resource."
18:22 Grinnz_ oops, RFCs have newlines
18:22 Grinnz_ lol
18:23 cfedde jberger: I've used the basic auth stuff from mojo. it works pretty well. Even though it insists on using the url encoding method rather than directly stuffing the headers.
18:23 cfedde still when it hits the wire it is header stuffed.
18:24 cfedde er in wget it is just those command line options.
18:25 dod joined #mojo
18:31 buu sri: Why does http/2 have priority
18:31 hernan604 jberger: maybe wget --header="Authorization: Basic `echo "Username:Password" | base64`" http://localhost/
18:47 cfedde what's wrong with --user and --password?
18:49 jberger cfedde: they don't actually do anything unless the server challenges it
18:49 bwf joined #mojo
18:50 jberger can I still do a redirect with a 401 status?
18:50 jberger I don't think that works does it?
18:50 Grinnz_ no, redirect is a specific status
18:50 purl okay, Grinnz_.
18:51 * Grinnz_ really hates HTTP authorization
18:52 jberger I implemented it yesterday as a shortcut for exactly this purpose
18:52 jberger oh well
18:52 jberger harumph
18:52 Grinnz_ it's not a shortcut to anything except tears :)
18:53 Grinnz_ i used to use it for a kind of private file sharing folder, but i just use google drive instead now <_<
18:55 Grinnz_ also, i just found out CGI.pm now has a "multi_param" method and "param" warns in list context, heh
18:57 cfedde jberger: right. the server has to pitch the 401 or whatever.
19:01 jberger ok well I guess I can still build the header manually, but ehhhh
19:06 stephan48 jberger: theres a wget argument forcing the client to send the credentials "--auth-no-challenge"
19:06 jberger oh oh
19:07 stephan48 also that what hernan604 sayed should work
19:07 jberger \o/
19:07 jberger stephan48++
19:07 stephan48 :)
19:08 stephan48 i got annoyed by it myself... curl is more do-what-i-say-ish... and will happily send the auth header
19:08 jberger sure, I knew I could build the header myself, but at that point I might just use the cookie jar
19:08 stephan48 heh
19:08 jberger cookie jar would require two request tho
19:13 denis_boyun joined #mojo
19:22 trone joined #mojo
19:24 sri jberger: you should know this! http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Basic-authentication1
19:24 sri buu: don't ask me
19:27 jberger sri: maybe I should, but I'm just learning about basic auth
19:27 * sri cracks the whip
19:28 jberger anyway, it's not worth breaking what I have (redirect to login) in order to support challenges
19:28 sri why bother with basic auth at all?
19:28 jberger because of mojo get mostly
19:29 jberger that is a real win for me
19:29 jberger or I should say ./app get
19:30 sri i see
19:32 jberger it was just a tiny before_dispatch to make that work
19:34 sri seems reasonable
19:35 * sri likes basic auth for rest apis too
19:36 jberger it might be handy to have a helper to parse out the info from the header, but it isn't hard to do on my own
19:36 sri ?
19:36 jberger or perhaps a method on the request object
19:38 mst I like having my run_cli code path override the app config to use the auth of the unix user the code's running as
19:38 mst no idea if that's as trivial in Mojo as it is in Web::Simple
19:39 jberger mst: even if it is, that wouldn't help me in this case
19:39 jberger I'm not the same user
19:40 Grinnz_ ...not since the accident...
19:42 batman sri: do you have time to look at the gist i posted earlier..? not sure if i'm doing too much evil there
19:44 sri batman: dunno
19:44 jberger Grinnz_++
19:44 basiliscos joined #mojo
19:44 batman https://gist.github.com/jhthorsen/a08f6e3d4e8901d7861b
19:45 sri batman: yea, that seems terribly inefficient
19:45 batman i agree. got any ideas on how to improve it?
19:45 batman i agree = the recurring timer. anything else i'm missing out on?
19:46 sri Mojo::IOLoop::Stream is made for sockets, anything else is an accidental feature
19:48 batman ok
20:05 jberger sri: ForkCall uses it for pipes
20:05 jberger is that dangerous?
20:08 denis_boyun joined #mojo
20:12 dod joined #mojo
20:14 sri jberger: unsupported at least
20:15 sri i would guess that error handling might not be correct for anything else than sockets
20:21 sri in fact, it's even optimized for http, not checking errors on write and only on read
20:48 jberger http://perltricks.com/article/143/2015/1/8/Extracting-from-HTML-with-Mojo--DOM
20:57 Grinnz_ nice
21:10 marty joined #mojo
21:14 denis_boyun joined #mojo
21:33 alnewkirk joined #mojo
21:38 irq joined #mojo
21:48 marty joined #mojo
22:04 basiliscos joined #mojo
22:23 batman oh. crap.
22:23 batman someone got assigned a pr for M::P::CGI :/
22:24 batman i wonder if i have to get him reassigned.
22:31 batman *should have
22:36 sri interesting EV problem https://groups.google.com/d/msg/mojolicious/sVJ9GPlZvaQ/k4kq1ePZLeYJ
22:42 meshl joined #mojo
22:44 absolut_todd joined #mojo
22:51 * Grinnz_ doesn't want to think about EV problems anymore
22:57 Grinnz_ #perl convo reminds me. i did some silly benchmarking with Mojo::JSON::MaybeXS and man it is fast
22:57 Grinnz_ even with the "slower" changes Cpanel::JSON::XS added
22:59 Grinnz_ what is M::P::CGI?
22:59 Grinnz_ oh, plugin
23:05 * sri wants to tell klapperl to just report it as an EV bug...
23:05 Grinnz_ hah...
23:06 sri yea...
23:18 basiliscos1 joined #mojo
23:33 Grinnz_ batman: i'm not able to get Mojo::IRC to install on my perl 5.10.1, it just hangs after the first test file and says # Connect timeout
23:34 Grinnz_ http://ur1.ca/jdkfp
23:36 batman Grinnz_: i'm going to bed now.
23:36 batman any help is appreciated
23:36 purl i already had it that way, batman.
23:36 basiliscos joined #mojo
23:36 Grinnz_ no rush :) not sure how to debug it really
23:38 Grinnz_ installs fine on my perl 5.18
23:39 Grinnz_ i'll look into it more tonight
23:42 basiliscos joined #mojo

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