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

IRC log for #mojo, 2014-01-31

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

All times shown according to UTC.

Time Nick Message
23:05 marty_ left #mojo
23:24 * sri always kinda wanted a distance_of_time_in_words helper... but bets as soon as he adds it there would be complaints about i18n
23:25 tempire MOJO.CONF!!!!1
23:26 tempire It needs a unicode symbol.
23:26 sri distance_of_time_in_words(time , time - 300) => "5 minutes ago"
23:26 tianon mojo♥.conf
23:27 sri http://www.fileformat.info/info/unicode/char/1F3E9/index.htm
23:27 * sri hides
23:28 tianon omfg FakeUnicode needs this
23:28 tianon I didn't know this was a real thing
23:28 tianon sri++
23:35 zackiv31 joined #mojo
23:36 jberger Srsly?
23:36 purl totally srsly.
23:36 jberger I was expecting FACE SCREAMING IN FEAR
23:36 jberger Hahaha
23:38 sri there is no unicode character for jumping the shark yet...
23:40 chansen sri: Time::Duration is not bad
23:43 chansen An implementation that used CLDR would be awesome
23:51 jberger How has that not been a mojo code name yet
23:51 jberger ?
00:28 d4rkie joined #mojo
00:28 jack joined #mojo
00:29 jberger_ joined #mojo
00:39 good_news_everyone joined #mojo
00:39 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/yCxYJQ
00:39 good_news_everyone mojo/master 92c4bdc Sebastian Riedel: no need to check XML status for every tag
00:39 good_news_everyone left #mojo
00:39 cfedde joined #mojo
00:40 torbjorn love the nick of that bot
00:40 torbjorn makes me just a little bit happier every time i see it
00:43 TitanOfOld torbjorn: Needs to be updated to GNEeee
00:43 torbjorn heh
00:57 jberger Bender:  trust jberger
00:57 Bender jberger, I already trust jberger
00:57 * jberger dropkicks Bender
01:00 dvinciguerra joined #mojo
01:00 * tempire uses Time::Duration all the time
01:00 * tempire uses time::Duration all the time ago
01:28 beyondcreed joined #mojo
01:34 ka2u joined #mojo
01:45 zackiv31 joined #mojo
02:11 marty joined #mojo
02:12 marty joined #mojo
02:28 klapperl_ joined #mojo
02:40 sugama joined #mojo
02:46 zM joined #mojo
02:56 d4rkie joined #mojo
03:14 sugama Hi. I've looked into Mojo::UserAgent::Transactor and just thought redirect method better remove authorization header for new req.
03:14 sugama https://github.com/jamadam/mojo/commit/76c39acfefb8d5c4afccb8f1ed8ebdde966d147d
03:17 sugama I'm not so sure though
03:25 sugama I've also investigated another topic that redirect request not to attach User-Agent header, I mentioned on mailing list and thinking of some solutions.
03:25 sugama https://github.com/jamadam/mojo/commit/4799bb0248e5d817a7f9b945a2effb34fbe73f12
03:25 sugama https://github.com/jamadam/mojo/commit/3b5fc09f16fa724a8469c16451355e81f7835b80
03:25 sugama Any thoughs?
03:33 sri sugama: proper redirect handling is an open problem, to get a patch accepted you'll have to explain in detail why your way is the right one, based on specs and/or references to actual browser behavior
03:36 sri i think there have been quite a few discussions before in guthub issues, the list and here
03:36 sugama ok. I can't explain why my way is right at this moment :)
03:37 sri ok :/
03:38 sugama I haven't read discussion. I got to check. thanks.
03:47 sri sugama: i'm very interested in a redirect revamp, but it has to be *correct*
03:59 sri sugama: and in that regard, i'm almost certain your patches are wrong
04:15 sri at this point people usually just disappear ;p
04:16 sri nobody wants to dig through specs and browser source code anymore...
04:17 sri exactly
04:18 jzawodn that's, like... work and stuff
04:28 sri i actually do have a feeling what the *correct* behavior might be, but can't prove it
04:31 sri basically what we do now, but for 302/303 clone the headers too and remove Content-* headers
04:37 sri something like this would be my best guess http://pastie.org/8684407
04:40 jzawodn hmm.. I wish I was informed enough on the matter to say
04:42 sri i would be surprised if there were more than a handful of people in the world that are truly informed on the matter
04:42 sri it's a mess of legacy behavior really
04:44 sri the pragmatic solution might be to just do whatever curl does :)
04:46 sri curl actually removes the Authorization header btw.
04:46 sugama joined #mojo
04:48 sugama joined #mojo
04:49 jzawodn yeah, mimicing another well known and widely used tool isn't actually a bad strategy at all
04:50 sri i already see quirks though
04:50 sri if i add -H 'Authorization: foo' it does not care and just blindly adds the header again
04:51 sugama Sorry for disappering. I work for this under the desk at my office
04:52 sri is that some kind of euphemism?
04:53 sugama Never mind. just found it on a dictionary
04:59 ka2u joined #mojo
05:01 sri this might be the closest to curl http://pastie.org/8684451
05:02 sri the real problem is that browsers and curl reset headers based on global settings, not by inheriting them from a previous request
05:03 btyler joined #mojo
05:06 zivester joined #mojo
05:18 sri http://pastie.org/8684480 # ok, i think this would be a mostly complete patch for curl-like behavior
05:22 sri https://bugs.webkit.org/show_bug.cgi?id=40138 # ok, looks like we have confirmation that browsers remove Authorization
05:23 ka2u joined #mojo
05:25 sugama Thanks for working on it. I don't understand all part of the patch but looks good for me.
05:30 sri i just wanted to google some firefox/webkit issues on the topic... then started reading... and before i knew it there was a patch ;p
05:30 sri but i'm still not sure about which header to inherit from the previous request
05:34 irq joined #mojo
05:45 irq_ joined #mojo
05:57 good_news_everyone joined #mojo
05:57 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/NkWUJQ
05:57 good_news_everyone mojo/master ce643c6 Sebastian Riedel: fixed Mojo::UserAgent::Transactor to handle redirects more like most common browsers
05:57 good_news_everyone left #mojo
05:58 sri content negotiation headers after redirect is a common request, so i'm willing to give this a try... it does not appear to conflict with specs and is pretty close to curl behavior
05:58 sri tempire, jberger, marcus, crab: take a look!
05:59 sri and anyone else!
05:59 purl rumour has it anyone else is welcome to answer also :P
06:00 * sri pokes sugama
06:00 sugama yes
06:02 sugama will try
06:31 dod joined #mojo
06:31 sri too bad the descriptions in the reworked RFC 2616 didn't get much better http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-25#section-6.4
06:39 Vandal joined #mojo
06:42 sri hmmmm... firefox behavior is mixed... but that might be a bug https://bugzilla.mozilla.org/show_bug.cgi?id=401564
06:44 sri webkit behavior seems to differ https://bugzilla.mozilla.org/show_bug.cgi?id=553888
06:44 sri tricky situation
06:49 sugama My scripts worked with new version of transactor!
06:52 dod joined #mojo
07:05 sri haha, i've actually looked into urllib2 and found that they do clone most headers
07:06 sri http://svn.python.org/view/python/trunk/Lib/urllib2.py?revision=81636&view=markup
07:06 sri Authorization and friends are excluded through a secondary system there
07:08 sri and they really cram everything into a single file
07:08 hesperaux joined #mojo
07:19 tianon oh gosh, I've read through urllib2.py source code; now I'll have nightmares again tonight :)
07:19 tianon thar be dragons
07:19 tianon "only" 1415 lines in the file in that specific revision
07:23 dotandimet joined #mojo
07:41 Foxcool joined #mojo
07:44 dod joined #mojo
07:51 basiliscos joined #mojo
08:13 dotandimet joined #mojo
08:18 hummeleBop joined #mojo
08:22 trone joined #mojo
08:30 rawler joined #mojo
08:39 odc joined #mojo
08:42 fhelmber_ joined #mojo
08:48 Dandre joined #mojo
08:52 rem_lex|pivo joined #mojo
08:59 ver joined #mojo
09:02 Negor joined #mojo
09:10 Perl662 joined #mojo
09:12 Perl662 hi, i have a mojolicious app with its own namespace (MyApp::). now i want to set up commands i can use from the command line, but putting them in MyApp::Command:: doesnt work, they are not recognized.
09:13 Perl662 is there a documentation about own commands, not living in Mojolicious::Command:: ? i couldn´t find something about that
09:18 Tiger Guys, i'm new in mojo, can you help me. i want to use helper for zabbixapi auth, i wrote this code http://pastebin.com/RU4mRcm0 but i get error Can't locate object method "render" via package "Graph". Can i use mojolicious render in anon subroutine?
09:28 moritz Tiger: what is Graph? Is that supposed to be your controller?
09:28 Tiger Graph is my app name
09:31 Tiger i want rewrite my login_to_zabbix soubroutine from https://github.com/dmitry-tiger/Graph/blob/master/lib/Graph/Screen.pm to helper for using in other controller
09:37 basiliscos joined #mojo
09:40 basiliscos joined #mojo
09:50 Perl662 joined #mojo
10:16 Perl662 do you know a simple way to place own commands in an own namespace, not within Mojolicious::Commands::? i couldn´t find any documentation about this special question.
10:22 arthas joined #mojo
10:47 abra_ joined #mojo
10:49 alnewkirk joined #mojo
11:36 d4rkie joined #mojo
11:50 mire joined #mojo
12:20 zM joined #mojo
12:31 ladnaV joined #mojo
12:43 Tiger can i get stash or session value in  anonymous sub  in main  package (which use Mojo:base)
12:50 sugama joined #mojo
12:52 jberger sri: ENOTQUALIFIEDTOCOMMENT
12:52 marcus sri: I think it's sensible
12:53 moritz Tiger: if you can get a reference to a controller object, then yes
12:54 Tiger i want to share 1 procedure between different controllers what is the best way to do this?
12:55 moritz a helper
12:55 purl it has been said that a helper is a thin wrapper for Schema::Loader
12:55 moritz in your application class, install it in the 'startup' method
12:57 Tiger i try to write this, but i cant give params
12:58 Tiger $self->helper('zapilogin' => sub { return shift->app->zapilogin });
12:58 Tiger i need give param to shift->app->zapilogin
12:59 Tiger but it's not supported by mojo
13:00 Tiger i can't find another way to pass param to shift->app->zapilogin (stash and session doesn't work in main package)
13:02 Tiger this is my example http://pastebin.com/RU4mRcm0 i need to pass $zserver variable into zapilogin
13:05 moritz if you do
13:05 moritz ->helper(zapilogin => sub { my $controller = shift; $controller->app->zapilogin($controller) } )
13:05 moritz then you pass on the controller to method zapilogin
13:07 Tiger hmm, i tried  $self->helper('zapilogin' => sub { return shift->app->zapilogin(@_)}); it doesn't work
13:09 Tiger we cant use parameters with shift->app->zapilogin because @_ need to have one item in @_ array
13:09 moritz well, you shift off the controller from $_
13:09 moritz erm, from @_
13:10 moritz so it's not there anymore
13:10 moritz Tiger: then modify the API of the ziplogin function
13:11 Tiger if you have more than 1 itrem in @_ then tis code http://pastebin.com/YPqUNEQB return second param
13:13 Tiger this link http://pastebin.com/YPqUNEQB is generated eval from mojolicious
13:13 moritz doesn't like like that to me
13:16 smammy joined #mojo
13:17 dpetrov_ joined #mojo
13:23 denisboyun joined #mojo
13:30 dvinciguerra joined #mojo
13:32 smammy left #mojo
13:34 Tiger moritz: i tried $self->helper('zapilogin' => sub {my $controller = shift; $controller->app->zapilogin($controller)}); but it doesn't run  zapilogin soubroutine
13:38 Tiger http://www.zimagez.com/zimage/screenshot-01312014-053744pm.php
13:39 d4rkie joined #mojo
13:41 Tiger maybe i need add  has zapilogin => sub {  .... }  in controller except main package
13:43 moritz maybe you just do   ->help(zapilogin => sub { write your actual code here, not some weird call to some other thingy })
13:45 jberger Tiger how is there a zapilogin in your app namespace
13:47 Tiger jberger: i wrote it in main  package where  startup soubroutine located
13:48 jberger So why not just make that a helper?
13:49 Tiger i need to pass parameter in  anon subroutine
13:49 Tiger this is my example http://pastebin.com/RU4mRcm0 i need to pass $zserver variable into zapilogin
13:50 Tiger jberger: i can't find another way to pass param to shift->app->zapilogin (stash and session doesn't work in main package)
13:50 moritz well, it works in a helper
13:54 jberger Tiger, once the app method is called, you no longer have the controller to access the stash
13:54 d4rkie joined #mojo
13:54 jberger Again, try just making your method a helper itself and I think you'll be happy
13:55 jberger You don't need that wrapper helper
13:55 moritz jberger: I've been trying to convince Tiger to use a helper for an hour now
13:57 jberger Tiger, wait wait
13:57 jberger Why is that first sub a ' has '?
13:57 jberger That's completely broken
13:58 Kulag joined #mojo
13:58 jberger In fact just change that has to helper, remove to helper at the bottom and you are done
14:00 jberger Well you are in a full app, so you can't do that
14:00 jberger Move the body of the has declaration to be the helper in your startup method
14:01 jberger Tiger ^^
14:02 jberger Annnnd you can't interpolate as you are doing for the url
14:04 jberger Looks like you changed from interpolation to concatenation at some point and never corrected it
14:07 ryozi joined #mojo
14:08 jberger joined #mojo
14:08 jberger Bender share the love
14:09 jberger Bender spread the love
14:09 jberger Bah
14:16 marty_ joined #mojo
14:19 Tiger jberger: i changed  url  with   config value a few time ago and not tested it yet.
14:20 Tiger jberger: you think the best way in my situation is move code from has to helper sub?
14:20 jberger Tiger that has will not work
14:21 jberger Not at all
14:22 jberger So ... yes
14:36 mire joined #mojo
14:43 Tiger jberger: Thanks, it works fine with code in helper
14:44 jberger Tiger do you understand why has wouldn't work?
14:45 ka2u joined #mojo
14:47 Tiger no, i didn't find any documentation about using "has", i copied this method from exapmle (working with database in prefork server)
14:48 Tiger https://github.com/kraih/mojo/wiki/Hypnotoad-prefork-web-server
14:48 moritz Mojo::Base supplies (and documents) 'has'
15:03 jberger has makes an attribute, a sub should return the default value, evaluated lazily
15:04 jberger Anyway, glad you got it working
15:04 btyler joined #mojo
15:18 cleverfox joined #mojo
15:24 ka2u joined #mojo
15:35 denisboyun joined #mojo
15:39 D4RK-PH0ENiX joined #mojo
15:50 sh4 joined #mojo
16:01 sri \o\
16:01 sri /o/
16:01 sri Bender: trust jberger
16:01 Bender OK, sri
16:02 jberger sri o/
16:13 mire joined #mojo
16:27 arpadszasz joined #mojo
16:31 KindOne joined #mojo
16:35 ka2u joined #mojo
16:36 tianon joined #mojo
16:58 arpadszasz_ joined #mojo
17:08 KindOne joined #mojo
17:10 plenum joined #mojo
17:17 ka2u joined #mojo
17:17 Dandre hello,
17:18 denisboyun joined #mojo
17:20 Dandre how can I get Locale information in my Models from the controller that use them.?
17:20 Dandre I could give this information to the Model class at instanciation but I wonder whether there is a more clever way to do this
17:21 arpadszasz_ joined #mojo
17:23 Dandre I am using Mojolicious::Plugin::I18N in my controllers
17:26 plenum joined #mojo
17:27 good_news_everyone joined #mojo
17:27 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/FTapGA
17:27 good_news_everyone mojo/master c827d62 Sebastian Riedel: handle 301 redirects like most common browsers
17:27 good_news_everyone left #mojo
17:28 sri ok, reworked RFC 2616 makes that pretty clear
17:28 plenum joined #mojo
17:29 sri 301 is the permanent version of 302 (which was mistakenly used instead of 303, so those are now equal), and 308 is the permanent version of 307
17:29 sri it all makes sense now
17:39 Kulag joined #mojo
17:43 punter joined #mojo
17:46 denis_boyun joined #mojo
17:49 beyondcreed joined #mojo
17:50 dod joined #mojo
17:55 KindOne joined #mojo
18:01 basiliscos joined #mojo
18:28 denis_boyun joined #mojo
18:51 sri wow, catalyst core is almost 6000 lines of code now :o
18:52 sri all of mojolicious is still under 9000
18:53 DaTa and a little less dependencies :)
18:54 sri moose alone is 18000 lines
19:00 denis_boyun joined #mojo
19:06 mire joined #mojo
19:10 nornagest joined #mojo
19:52 bluescreen joined #mojo
19:52 dvinciguerra joined #mojo
19:58 buu Uhm
19:59 buu Is there any way to get mojo to print a list of routes its matching?
20:00 jberger_ joined #mojo
20:11 jberger joined #mojo
20:22 sri buu: http://mojolicio.us/perldoc/Mojolicious/Guides/Routing#Introspection
20:28 marty_ joined #mojo
20:30 sh4|2 joined #mojo
20:32 cooper joined #mojo
20:41 buu sri: Ah
20:42 sri buu: also https://twitter.com/kraih/status/422055841999880192/photo/1
20:46 buu sri: Oh hey, even cooler
20:47 buu sri: Does that error page get tripped if a bridge returns false?
20:47 sri http://mojolicio.us/perldoc/Mojolicious/Guides/Rendering#Rendering_exception_and_not_found_pages
20:55 sri the fact that you've not seen them yet blows my mind
20:56 sri and makes me wonder if the generate commands should maybe contain a hint
20:57 sri # Built-in exception page\n get '/dies' => sub { die 'Good bye cruel world!' };
20:59 sri # Built-in not found page\n get '/missing' => {template => 'does_not_exist'};
21:00 nic sounds good
21:00 sri no wait... auto rendering doesn't trigger it, has to be sub { shift->render('does_not_exist') }
21:00 sri :)
21:01 sri i don't want to overload the generated apps... but we are already hinting at the documentation browser... so hinting at those pages doesn't seem out of line
21:02 nic more reasons to get beginners to use app generation is a good thing imo
21:02 sri it's really a shame that they might get missed by beginners
21:04 nic I must confess when I was learning I thought "but I don't want a generated app" but that's not the point, it's v valuable to see a correctly constructed app, then to play with it, then to think how you want it to grow
21:04 nic s/learning/learning at the beginning/
21:12 sri http://pastie.org/8686687 # patch i had in mind
21:12 sri not sure if it makes the default apps look overloaded
21:13 sri maybe they should just have their own section in the lite tutorial
21:14 sri although i'm not sure where to include and how to describe them :S
21:17 bowtie joined #mojo
21:30 sri http://pastie.org/8686736 # different approach
21:30 sri buu: would that have made you look?
21:31 buu Um
21:32 tianon "they are gorgeous" +1 <3
21:33 buu sri: I wish I had a better answer for you but when I started (quite a while ago now) I went straight to full mojolicious, skipping ::Lite, and in the particular case that prompted my question earlier we were doing json based service calls
21:33 buu So not much chance to see html rendered things
21:33 sri i hate you
21:33 buu =[
21:33 * buu dies
21:36 good_news_everyone joined #mojo
21:36 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/s5xc7A
21:36 good_news_everyone mojo/master 3b765df Sebastian Riedel: added section about built-in pages to tutorial
21:36 good_news_everyone left #mojo
21:37 sri seems like the best choice, later in the tutorial mode specific templates are mentioned, and the rendering guide covers advanced uses
21:41 sri hmm... maybe worth considering the removal of certain parts of the tutorial that is covered by guides too and non-essential
21:47 good_news_everyone joined #mojo
21:47 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/N--tAg
21:47 good_news_everyone mojo/master b0e3b6c Sebastian Riedel: removed redundant section from tutorial
21:47 good_news_everyone left #mojo
21:52 good_news_everyone joined #mojo
21:52 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/BW0MrA
21:52 good_news_everyone mojo/master 520a958 Sebastian Riedel: mention that blocks are important for helpers
21:52 good_news_everyone left #mojo
22:03 mgrimes joined #mojo
22:58 good_news_everyone joined #mojo
22:58 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/A8P2lg
22:58 good_news_everyone mojo/master 16a8dd0 Sebastian Riedel: mention that default values without placeholder get merged into the stash
22:58 good_news_everyone left #mojo

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