Camelia, the Perl 6 bug

IRC log for #mojo, 2011-02-03

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

All times shown according to UTC.

Time Nick Message
00:12 MadManchegan joined #mojo
00:12 MadManchegan left #mojo
00:15 l_almaraz I am confused about routing - if I have a class, MyApp::Help and within that there is 'sub index { $shift....}, do I have to mention a route for each action?
00:15 Alias left #mojo
00:25 l_almaraz left #mojo
00:32 metaperl1 joined #mojo
00:34 metaperl left #mojo
00:35 ltriant left #mojo
00:37 perlrocks Twitter: "[Perl] + in the α "PerlRequire / path / to / startup.pl" If you could be pre-loaded with Ministry of memory modules or / Mojolicious how to deploy applications to mod_perl - Div ... http://htn.to / JKurSX" (ja) --hide_o_55 http://twitter.com/hide_o_5​5/status/32960909143969792
00:39 metaperl1 left #mojo
00:40 metaperl joined #mojo
00:42 MojoGuest201 joined #mojo
00:42 MojoGuest201 From: http://news.ycombinator.com/item?id=1277067 (188 hits)
00:42 MojoGuest201 left #mojo
00:48 alnewkirk joined #mojo
00:58 stephen left #mojo
01:21 MojoGuest828 joined #mojo
01:21 MojoGuest828 From: http://www.networkedblogs.com/33Knp (51 hits)
01:21 MojoGuest3 joined #mojo
01:21 MojoGuest3 From: http://news.ycombinator.com/item?id=1277067 (190 hits)
01:21 MojoGuest828 left #mojo
01:21 MojoGuest3 left #mojo
01:39 metaperl left #mojo
01:42 metaperl joined #mojo
02:26 metaperl1 joined #mojo
02:30 metaperl left #mojo
02:33 fhelmber_ joined #mojo
02:38 ispy_ left #mojo
02:50 tempire l_almaraz: There is no automatic route detection
02:51 tempire For full apps, at least
02:59 ispy_ joined #mojo
03:08 metaperl joined #mojo
03:09 ispy_ left #mojo
03:11 metaperl1 left #mojo
04:03 tl joined #mojo
04:05 tholen42 left #mojo
04:29 l_almaraz joined #mojo
04:33 l_almaraz left #mojo
04:49 Foxcool joined #mojo
05:00 xantus[] left #mojo
05:06 MojoGuest630 joined #mojo
05:06 MojoGuest630 From: http://news.ycombinator.com/item?id=1277067 (191 hits)
05:07 MojoGuest630 left #mojo
05:20 perlrocks Twitter: "You'd think it'd be easier for web guys to wrap their heads around the fact that yes, the ENTIRE SITE is a single perl script #Mojolicious" --MisterHatt http://twitter.com/MisterHa​tt/status/33031945440993281
05:21 MojoGuest56 joined #mojo
05:21 MojoGuest56 From: http://www.reddit.com/r/html​5/comments/bt76k/irc_client/ (44 hits)
05:21 MojoGuest56 is now known as Jeffy
05:29 MojoGuest479 joined #mojo
05:29 MojoGuest479 From: http://www.reddit.com/r/html​5/comments/bt76k/irc_client/ (45 hits)
05:30 Jeffy left #mojo
05:30 MojoGuest479 left #mojo
05:47 ispy_ joined #mojo
05:50 kaare joined #mojo
06:02 dekimsey joined #mojo
06:06 dekimsey1 left #mojo
07:01 metaperl left #mojo
07:06 Foxcool left #mojo
07:12 metaperl joined #mojo
07:16 koban joined #mojo
07:17 Foxcool joined #mojo
07:33 perlrocks Twitter: "Guest instructor's welcome @ yusukebe, Hokkaido.pm # 2 4 / 19 will be held! The two-part system of morning and afternoon, morning @ charsbar Mojolicious's hands in the afternoon a talk tech. We welcome beginner's! http://goo.gl/q5YzW" (ja) --hokkaidopm http://twitter.com/hokkaido​pm/status/33065555804037120
07:37 Foxcool left #mojo
07:46 Alias__ left #mojo
07:49 Foxcool joined #mojo
07:54 crab i wish i could specify multiple controller namespaces.
07:59 breaker313 joined #mojo
08:07 Foxcool left #mojo
08:18 Foxcool joined #mojo
08:27 chansen left #mojo
08:48 ver joined #mojo
09:01 ysyrota joined #mojo
09:06 ispy_ left #mojo
09:21 otaviof joined #mojo
09:23 Foxcool left #mojo
09:34 Foxcool joined #mojo
09:36 crab in fact, i seem to have painted myself rather into a corner here.
09:38 ato left #mojo
09:39 * crab thinks harder
09:39 moritz not every problem calls for a solution by improving the framework :-)
09:41 crab i have no idea what that's supposed to mean.
09:42 moritz if you can't do $x in $framework, the solution might not be to extend $framework to do $x, but rather structure your application so that it doesn't need to do $x to achieve its goal
09:47 crab ah.
09:48 moritz I notice that in #perl6 with s/framework/programming language/g
09:50 crab i did it this way based on something of a misunderstanding about routes and namespaces. but i can't think of a better way to do it anyway. so i'll have to think of some sort of hackery.
09:52 moritz if it exposes a conceptual problem in mojolicious' routing, it might still be worth fixing
09:52 * moritz lays down his hat of painted wisdom
09:53 crab i don't think it's a conceptual problem in mojolicious's routing. or maybe it's arguable.
09:55 crab i have various controllers in lib/G/blah.pm, and my app is named App and has other controllers in lib/App/blah.pm. for those controllers that are in G which i inherit from in App, all is well. but for those i *don't* override, i have to specify 'namespace=>"G"' in each route.
09:56 Foxcool left #mojo
09:59 crab but since this is an inconvenience only barely more than the "more typing" level, a hack to fix it is acceptable. maybe i could have app declare a list of names and set @App::${name}::ISA=("G::$name") or something.
10:08 crab i also have to Mojo::Loader->load() the "native" modules, but then it works. whee.
10:08 Foxcool joined #mojo
10:08 * crab sticks THAT in moritz's painted hat of wisdom
10:09 * moritz watches the paint dissolve
10:10 ver left #mojo
10:14 crab and i don't even need to declare anything in my derived App. i can just do: foreach (@builtin_controllers){if(Mojo::Loader​->load("App::$_")){Mojo::Loader->load(​"G::$_");@{"App::$_::ISA"}=("G::$_")}}
10:15 crab (where "if (...load...)" means "if i can't load..."
10:16 Foxcool left #mojo
10:18 spleenjack joined #mojo
10:27 AmeliePoulain joined #mojo
10:27 Foxcool joined #mojo
10:36 AmeliePoulain left #mojo
10:36 sri moin
10:37 sri crab: what keeps you from using multiple namespaces?
10:37 sri my $r2 = $r->route->to(namespace => 'MyApp::Controller2');
10:38 sri all $r2 routes now inherit the namespace
10:39 crab !
10:39 AmeliePoulain joined #mojo
10:39 sri http://mojolicio.us/perldoc?Mojolicious/Gu​ides/Routing#Route_To_Class_28namespace29
10:40 sri routes actually have very little limitations, with a little creativity you can do just bout anything
10:41 sri "I came here to kick ass and assign IPv4 addresses. And I'm all out of IPv4 addresses!"
10:42 * moritz waits for a Turing machine based on routes
10:42 * sri shudders
10:43 crab sri: i saw that (route to class in the docs), but i didn't realise that i could get an $r2 with that namespace as default.
10:44 sri feel free to make it more clear
10:44 crab because the examples only override the default namespace in individual routes.
10:44 sri all child routes inherit all ->to() values
10:44 crab so i see now. neat.
10:45 crab not that this solves my problem directly, but i feel sure i will find a good use for it someday.
11:08 crab what happens if a bridge function returns 0? must see source.
11:09 crab but where is the code that does it?
11:26 metaperl left #mojo
11:44 sri crab: just look at the documentation
11:45 crab yes, i'm trying to understand what "or the dispatch chain will be broken" means.
11:46 crab does the client get a 404?
11:48 sri nothing happens automatically
11:50 crab so it'll do nothing and eventually timeout and close the connection? ok.
11:51 sri once a route matches it is all your responsibility
11:51 sri 404 only happens when no route matches
11:52 crab ok
12:03 crab damn. my @ISA hack breaks when i do daemon --reload
12:06 crab though i'm not sure why. it's being set in startup, and startup gets run at the expected time.
12:08 * crab sighs
12:12 koban left #mojo
12:12 koban joined #mojo
12:55 ispy_ joined #mojo
13:19 GitHub139 joined #mojo
13:19 GitHub139 mojo: master Sebastian Riedel * be3a045 (1 files in 1 dirs): added cookbook recipe - http://bit.ly/igHTEj
13:19 GitHub139 left #mojo
13:26 GitHub166 joined #mojo
13:26 GitHub166 mojo: master Sebastian Riedel * 5fc178a (1 files in 1 dirs): pod cleanup - http://bit.ly/h6hLnd
13:26 GitHub166 left #mojo
13:27 perlrocks Twitter: "The cookbook recipe for today shows how much fun #mojolicious oneliners can be. :) http://t.co/8XQ8IX8 #perl" --kraih http://twitter.com/kraih/status/33154670012792832
13:32 GitHub189 joined #mojo
13:32 GitHub189 mojo: master Sebastian Riedel * 27a2c0f (1 files in 1 dirs): more pod cleanup - http://bit.ly/hYbYPt
13:32 GitHub189 left #mojo
13:32 kaare Looking for something equivalent to Catalyst's forward.  ie give a route as parameter and transfer there.
13:32 sri we don't do internal redirects
13:33 kaare ok, so if I want to redirect to a login page, redirect_to is the thing?
13:33 sri most of the time yes
13:33 kaare OK by me.
13:34 sri internal redirects just encourage bad non-RESTful design
13:35 sri i always challenge people asking for it to give me a sensible use case that doesn't have better solutions, so far nobody succeeded :)
13:35 Foxcool left #mojo
13:40 kaare I guess ->forward is some kind of optimization. But for e.g login it's pointless
13:45 sri well, when i added it to catalyst REST was not even a buzzword yet
13:46 sri now we have learned that updating the location bar has many advantages
13:47 Foxcool joined #mojo
13:47 sri the original idea was actually to encourage code reuse
13:48 sri but helpers are much better for that
13:53 Foxcool left #mojo
13:59 bwigfield left #mojo
14:04 Foxcool joined #mojo
14:07 bwigfield joined #mojo
14:09 bellaire joined #mojo
14:11 bellaire good localtime
14:12 arthas joined #mojo
14:15 bellaire we're having an issue with, we think, url_for since commit 28b90c
14:15 * sri waves
14:15 bellaire we're using mod_rewrite and trying to set the url base in a hook, which worked before then
14:15 sri what kind of issue?
14:16 bellaire but now the <base> tag has a different url in it than before
14:16 bellaire so all our links break :)
14:16 sri think i heard that yesterday already
14:16 sri and i couldn't verify anything
14:16 sri i'm afraid i have to ask for a test case
14:17 bellaire probably dekimsey? he works with me.  we've got tests, but we're not sure what the correct behavior is
14:17 sri ye it was dekimsey
14:19 sri the commit you mentioned at least did not break any tests
14:19 bellaire https://gist.github.com/809518
14:20 bellaire in 28b90c these tests pass, after that, they dont, so some behavior has changed
14:20 sri ok, i see an error there
14:20 sri "/sandbox/to-myself\n"
14:20 sri thats not a relative url
14:21 sri http://kraih.com/sandbox/to-myself and /sandbox/to-myself will result in http://kraih.com/sandbox/to-myself
14:21 sri "sandbox/to-myself" would be a relative path
14:22 sri resulting in http://kraih.com/sandbox/t​o-myself/sandbox/to-myself
14:23 sri url_for is supposed to give you the relative path for the base url
14:25 sri i can see why it would cause confusion though
14:26 bellaire well it looks like none of these cases take the base into account
14:26 bellaire even in to_abs
14:26 bellaire which is why we are confused
14:27 sri html rules apply
14:27 sri base is treated as a html base url
14:29 bellaire so you're saying base should be in the <base> tag?  because it isn't.
14:29 sri you're not using <%= base_tag %> right?
14:29 bellaire no, we use url_for('root')
14:29 sri ok, thats the problem
14:30 sri maybe i'm expecting too much
14:30 sri there is something else we could do
14:31 sri people seem to have problems with html url rules
14:32 bellaire well yeah, everything would work if we had the <base> correct
14:32 sri possible solutions would be to generate absolute urls without base, or to move the base path and always return absolute paths
14:33 bellaire the first one is what the code did prior to the commit we talked about
14:33 sri you're pretty much expected to use <%= base_tag %> atm
14:33 bellaire where does base_tag come from?
14:33 sri nope, quite sure it never returned absolute urls
14:33 sri it's a built in tag helper
14:34 bellaire well the test cases we gave in the gist worked, and they are absolute...
14:36 sri they are wrong though
14:36 bellaire so the code was broken before and we were using the broken behavior
14:36 sri ye
14:36 sri a relative path can't start with a /
14:37 sri and an absolute path with a base that also contains a path makes no sense at all
14:38 bellaire so we can't use absolutes at all if we specify a base?  why is the base information in the url objects?
14:39 sri the base information is there so you can turn relative urls into absolute ones
14:39 sri url_for->to_abs
14:42 sri the easy way out would be to just call ->to_abs on all urls in url_for
14:42 sri or we break with all html conventions
14:42 sri and generate invalid but working urls
14:43 bellaire ok, so in the first test, we are at route /another-place, and we ask for the absolute path to the named route 'to_myself', and we get http://kraih.com/to-myself, not http://kraih.com/sandbox/to-myself
14:43 bellaire even tho the base is specified as http://kraih.com/sandbox
14:43 sri because you base has no trailing slash
14:44 sri html rules
14:44 bellaire adding a trailing slash does not change the result
14:44 sri ok, then something is missing from the picture
14:44 metaperl joined #mojo
14:45 AmeliePoulain left #mojo
14:47 crab i went and had a nap, and i still can't understand how to solve my problem. or even why it breaks with --reload.
14:47 bellaire yes :)
14:47 crab must eat some freshly-baked bread and try again.
14:48 bellaire we like to think we aren't too ignorant of html rules, but we strive for enlightenment
14:48 chansen joined #mojo
14:48 bellaire we're definitely more familiar with browser behavior which isn't always to spec
14:54 Foxcool left #mojo
14:58 sri seems i've found a bug
14:58 dekimsey what's that?
14:58 sri routes generate absolute paths at times
14:59 sri which override the base path
14:59 marcus oh noes
15:00 sri fix is rather easy, i'll make sure we have good test coverage for it from now on
15:01 bellaire awesome
15:06 Foxcool joined #mojo
15:18 crab sri: did you see my description above of what i was doing with ISA? any ideas why that breaks with --reload?
15:19 sri nope
15:19 sri umm, yes and nope
15:21 crab it says "App::blah does not exist, maybe a typo?" so it means Mojo::Loader->load() is being called again, and the fact that it fails at that point is unsurprising.
15:22 crab so that must mean that the ->can('new') check is failing. let me poke around in the debugger a little.
15:27 breaker313 left #mojo
15:27 crab ah crap. it never tests ->can('new') because $ENV{MOJO_RELOAD}, it straightaway tries to require the file.
15:30 Foxcool left #mojo
15:32 crab i know how to fix that. but it involves even worse hackery. i'd better wonder if i can accomplish what i want by some other means.
15:33 GitHub150 joined #mojo
15:33 GitHub150 mojo: master Sebastian Riedel * c179867 (2 files in 2 dirs): fixed relative path bug - http://bit.ly/gKQHIL
15:33 GitHub150 left #mojo
15:34 sri bellaire: should be fine now
15:34 bellaire that was quick, thanks so much!
15:34 dekimsey thanks sri
15:34 sri thanks for reporting it
15:35 sri the question if we should break with html rules still stands though
15:36 dekimsey which/what rules is that?
15:37 sri base "http://kraih.com/rebased/" with relative url "foo" vs base "http://kraih.com/" with absolute path "/rebased/foo"
15:37 sri s/path/url/
15:38 sri the whole base_tag thing might be too smart
15:38 sri just generating absolute paths is more user friendly
15:39 dekimsey at least for the purposes of url_for in its stringified state might be best to always go absolute. that way its guaranteed to work in all contexts.
15:40 dekimsey fyi, pidgin's right-click menu has "Send" as the first entry. don't mis-click.
15:40 sri ye, correctness might be the wrong decision in this case
15:40 marcus I agree
15:41 dekimsey the thing i think the problem is with the current method is that it means url_for depends on the existence of a correct base tag. that linkage is probably the problem
15:41 sri right
15:41 sri it's correct but very easy to get wrong
15:41 spleenjack1 joined #mojo
15:43 bellaire i'd almost be inclined to say it should be an option, but the philosophy here seems to be DWIM out of the box, so...
15:43 * marcus wonders when web sockets will be fixed.
15:43 sri dream on
15:43 purl the dream is now on
15:43 sri take a look at the hybi list ;p
15:43 marcus s/fixed/usable/?
15:43 crab hybi?
15:43 marcus sri: will it make me depressed?
15:43 sri they are still arguing about message masking
15:44 sri s/message/packet/
15:44 marcus fuckers
15:44 sri http://www.ietf.org/mail-archive​/web/hybi/current/maillist.html # websockets are made here
15:44 sri or rather delayed
15:45 spleenjack left #mojo
15:45 dekimsey would it be enough to document the behavior in url_for? that one will want to use a base_tag. i'm not sure here. I usually prefer correctness myself. and amusingly enough, i didn't know about the base tag till I saw it in Mojo's exception template.
15:46 sri think we'll go with DWIM
15:46 marcus I'm supposed to talk about html5 and web sockets 22.march, so they better get cracking!
15:46 sri it's a rather small change
15:46 sri lol, this year?
15:47 marcus yepp
15:47 bellaire i know, we can hook into the base_tag helper, and see if its called from within renderer, and if it is not then use absolutes, otherwise use relative.  it's so simple, and not brittle at all!
15:47 sri bellaire: evil!
15:47 marcus sri: http://www.goopen.no/html5-og-web-sockets/ - included web sockets as an excuse to demo mojo :/
15:48 bellaire the line between dwim and evil is blurred sometimes...
15:49 dekimsey what line?
15:49 bellaire i'd show you but its too blurry
15:49 dekimsey nah, thats just a floater
15:50 sri we'll just go with dwim and make all paths absolute, shouldn't take longer than a few mins
15:50 bellaire cool
15:51 metaperl1 joined #mojo
15:55 metaperl left #mojo
15:58 GabrielVieira2 left #mojo
16:05 yegor joined #mojo
16:06 yegor left #mojo
16:11 otaviof left #mojo
16:17 koban left #mojo
16:36 GitHub114 joined #mojo
16:36 GitHub114 mojo: master Sebastian Riedel * 43c415e (11 files in 7 dirs): simplified url_for behavior and added image helper - http://bit.ly/hqcbk1
16:36 GitHub114 left #mojo
16:36 sri please test, i might have broken everything ;p
16:36 dekimsey heh, will do :)
16:46 crab ah, that one-liner works when i upgrade to the latest releases of AE and AE::DBI
16:46 crab urk
16:49 GitHub89 joined #mojo
16:49 GitHub89 mojo: master Sebastian Riedel * 2e38a4c (2 files in 2 dirs): bypass routes for paths - http://bit.ly/eMAFT5
16:49 GitHub89 left #mojo
16:51 dekimsey sri, works for me! Many thanks.
16:51 sri \o/
16:51 * sri likes how the documentation got easier too
16:53 dekimsey hah! awesome
16:56 sri <%= image '/foo.png' %> should be quite useful for portability too now
16:56 dekimsey Oh, whoops in the exception template references to "mojolicious-pinstripe.gif" didn't get updated
16:56 sri oh noes!
16:57 dekimsey Its okay, it makes you not wanna have exceptions to look at, just call it "motivational css"
16:57 sri haha
16:59 GitHub122 joined #mojo
16:59 GitHub122 mojo: master Sebastian Riedel * 984f4e8 (2 files in 2 dirs): fixed motivational css - http://bit.ly/dWdnbz
16:59 GitHub122 left #mojo
16:59 dekimsey /lol/
17:11 perlrocks Twitter: "Guest instructor's welcome @ yusukebe, Hokkaido.pm # 2 4 / 19 will be held! The two-part system of morning and afternoon, morning @ charsbar Mojolicious's hands in the afternoon a talk tech. We welcome beginner's! http://goo.gl/q5YzW" (ja) --onagatani http://twitter.com/onagatan​i/status/33211001281183744
17:12 GitHub133 joined #mojo
17:12 GitHub133 mojo: master Sebastian Riedel * e6d8063 (2 files in 2 dirs): updated url_for documentation - http://bit.ly/fZHpC8
17:12 GitHub133 left #mojo
17:12 esskar left #mojo
17:23 crab yay! it works!
17:25 crab what a vile hack.
17:38 otaviof joined #mojo
17:38 ysyrota left #mojo
17:44 perlrocks Twitter: "Our Mojolicious event is approaching February 12th.  did you get your tickets? if not call us at 212 932 2220" --bibisalonnyc http://twitter.com/bibisalon​nyc/status/33219384713555968
18:01 bwigfield left #mojo
18:02 dekimsey1 joined #mojo
18:06 dekimsey left #mojo
18:13 vko sri: Do you have real medium or big projects on Mojolicous? Could you show?
18:13 sri no i can't
18:14 vko Please. :)
18:20 crab vko: are you yko's brother?
18:29 vko crab: A bit brotherish ;) Vyacheslav too.
18:33 stephen joined #mojo
18:34 metaperl1 left #mojo
18:37 metaperl joined #mojo
18:42 arthas left #mojo
18:54 keith joined #mojo
18:56 keith left #mojo
19:01 GitHub177 joined #mojo
19:01 GitHub177 mojo: master Sebastian Riedel * 1cfa412 (18 files in 8 dirs): get rid of many ugly variable names - http://bit.ly/fymg2z
19:01 GitHub177 left #mojo
19:11 spleenjack1 left #mojo
19:28 fhelmber_ left #mojo
19:53 vko is now known as su-bzero[A]
19:54 su-bzero[A] is now known as sko
19:55 sko is now known as vko
20:14 sherr left #mojo
20:17 sherr joined #mojo
20:35 tholen joined #mojo
20:35 tholen left #mojo
20:35 tholen joined #mojo
20:37 tholen left #mojo
21:15 tempire hmm.
21:16 tempire I wonder if css selectors would work for navigating key/value stores.
21:19 sri what would be the point?
21:19 sri i think something regex like would be much cooler for keys
21:20 marcus yeah, css selectors only seem useful for trees
21:21 marcus maybe for a ldap store? ;)
21:22 tempire ack.  This is going to take a while.  I'm still thinking relationally.
21:23 * tempire has a hunch that when you try to re-create sql, you're probably doing it wrong
21:28 * sri nods
21:28 perlite_ joined #mojo
21:32 perlite left #mojo
21:32 perlite_ is now known as perlite
21:33 ltriant joined #mojo
21:41 perlrocks Twitter: "We've simplified the url_for behavior in #mojolicious today, please make sure to test it with your apps. http://t.co/g3YWmAb #perl" --kraih http://twitter.com/kraih/status/33278881779683328
21:45 chansen sri, marcus: I'm truly sorry for my outburst the other day, it's not your fault that developers doesn't read documentation (I had a few beers and was really annoyed with the work it caused me to cleanup their JSON queue)
21:46 marcus chansen: don't worry about it mate :)
21:46 marcus was the ice bar good?
21:47 marcus chansen: anyways, I don't think it hurt to make the documentation even more clear.
21:47 chansen yeah, ice bar in copenhagen was nice, free drinks (rented by a company)
21:47 marcus cool.
21:48 chansen I agree, the relaxed or minimalist part could use some explanation
21:48 marcus chansen: sri added a section while we were discussing it tho.
21:48 * chansen checks
21:48 sri chansen: no problem
21:49 marcus chansen: http://mojolicio.us/perldoc?Mojo/JSON
21:49 sri i've even added the same to Mojo::DOM
21:51 marcus wish search.cpan.org pod rendering looked as good as mojolicio.us
21:52 sri apparently there is only one person with access to the search.cpan.org code
21:53 chansen sri: would you accept a stricter and faster decoder (faster than both JSON::PP and Mojo::PP, I felt bad for my outburst so i polished an old parser I wrote a few years ago)?
21:54 chansen nopaste?
21:54 purl nopaste is http://nopaste.snit.ch (works with the script in $_PARROT/tools/dev/nopaste.pl) or http://paste.scsys.co.uk or http://www.extpaste.com or http://gist.github.com or App::Nopaste or http://codepeek.com/paste/ or (: pastebot)
21:54 marcus gist?
21:55 jamesw wow, rock serif is ugly on the new nbcu logo
21:55 chansen https://gist.github.com/810296
21:56 chansen and it has better error reporting than Mojo::JSON
21:56 chansen sri: feel free to borrow it under any license you see fit
21:57 marcus Beerware!
21:58 marcus chansen: it looks quite clean and nice.
21:58 sri chansen: thanks, will have a look
21:58 chansen conscience-ware!! ;)
21:59 chansen marcus: thanks
21:59 sri actually doesn't look too much unlike Mojo::JSON, wonder where the performance differences are
22:00 marcus smaller regular expressions :-)
22:00 sri my first guess would be better regular expressions yea
22:00 chansen sri: http://nopaste.snit.ch/30359
22:01 chansen JSON::Tiny is above implementation
22:01 * chansen an idea I had a few years ago
22:02 chansen but I would focus more on error reporting which is somewhat lacking from Mojo::JSON
22:06 bellaire left #mojo
22:06 marcus yeah, the error reporting in Mojo::JSON has annoyed me at times.
22:06 chansen JSON doc I used (from official JSON decoder) http://nopaste.snit.ch/30363
22:06 marcus specially the fact that it doesn't report the position of the error like this one does
22:06 marcus if you bork your config files, for instance
22:07 marcus Couldn't parse config "/Users/marcus/Source/NHO/nho_ws.json": Syntax error near " localhost   "database_n". at /Users/marcus/perl5/perlbrew/perls/perl-5.10.1/lib​/site_perl/5.10.1/Mojolicious/Plugin/JsonConfig.pm line 90.
22:10 marcus chansen: would have been even nicer if it could have reported line numbers rather than just offset.
22:11 * marcus is the kind of guy who looks a gifted horse in the mouth. =)
22:11 chansen marcus: it would be easy to add either context such as "before "hjkl" or line numbers
22:12 chansen we don't consume the string, so it only need to count \n or \r from beginning of string to pos()
22:13 marcus good point
22:24 marcus sri: what do you think? Want me to try to stuff it into Mojo::JSON and check for test failures?
22:25 sri already on it ;p
22:25 sri you can look for ways to improve error reporting
22:25 marcus ok :p
22:25 marcus btw why does Mojo::JSON return on missing string?
22:26 sri returns undef on any kind of error
22:26 marcus comment says 'shortcut'
22:26 sri patches welcome :)
22:26 marcus I guess you just got a big one from chansen ;)
22:27 sri i'm sure he'll be swearing at me for butchering his code later :)
22:29 chansen no, I rater see good implementation of JSON in Mojo than a half-baked baked one ;)
22:29 * sri bakes chansen
22:29 * marcus gets baked
22:29 * chansen knows from experience  ;P
22:29 * sri wants too :(
22:30 marcus great episode of californication this week
22:30 sri i can totally relate to that guy
22:31 marcus sri: monkeys fling poo at you too?
22:31 sri all the time :S
22:45 metaperl left #mojo
23:00 kaare left #mojo
23:01 sri heh, just 50% fail at the first try
23:11 chansen line 35 ("if m! \G [0x00-\xFF\\]  !x;") should be replaced with "if m! \G [\x00-\x1F\\]  !x;", my bad
23:15 * chansen is off to sleep, I'll backlog
23:15 sri ok, down to about 5 errors
23:15 chansen cool =)
23:16 sri some weird ones
23:16 sri ["hello\t\"world!"] -> $got->[0] = 'helloworld!'
23:16 sri ["hello\nworld!"] -> $got->[0] = 'helloworld!'
23:17 sri actually, i think those are the only real ones :)
23:17 sri the rest is just strictness related
23:19 chansen ok, they parse ok using http://nopaste.snit.ch/30364
23:20 chansen json_parse.pl '["foo\tfghj"]' # ["foo\tfghj"]
23:20 chansen json_parse.pl '["hello\nworld!"]' # ["hello\nworld!"]
23:21 sri ok, any code changed or does it have to be my fault?
23:22 chansen I just changed the line 35 (only triggered during error reporting on unterminated strings) as I reported above
23:23 sri good, i'll hunt it down then
23:24 chansen cool
23:26 sri and got it, now there's just a little mismatch with my encoding code
23:46 sri and all pass :)
23:53 chansen nice
23:53 * chansen is supposed to sleep =(
23:53 sri argh
23:54 sri [null,false,true,"",0,1] this one doesn't roundtrip
23:54 sri prolly my fault again
23:54 sri 0 and 1 end up in quotes
23:56 sri ah, you don't flag numbers i think
23:57 chansen json_parse.pl '[null,false,true,"",0,1]' # [undef, "", 1, "", 0, 1]
23:57 chansen json_parse.pl ^^above pasted script
23:58 sri yea, but 0 and 1 get assigned as strings
23:58 chansen true, no special code for booleans
23:58 sri i'm using the B:: trick to see if a scalar is really a number
23:59 chansen I guess you need if (m/ \G true /xgc) { return $MY_BOOLEAN_OBJECT }
23:59 sri you would have to "$value = 0 + $value" to flag a scalar
23:59 sri it's not about the boleans
23:59 sri just 0 and 1
23:59 sri at the end
23:59 purl well, at the end is like putting "} else {" at the end. It makes finding it very hard :)
23:59 chansen ahh

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