Camelia, the Perl 6 bug

IRC log for #mojo, 2013-03-09

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

All times shown according to UTC.

Time Nick Message
00:05 Adurah joined #mojo
00:12 ka2u joined #mojo
00:15 phillipadsmith any thoughts on this: Event "close" failed: Can't call method "client" on an undefined value at /Users/phillipadsmith/perl5/perlbrew/perls​/perl-5.16.1/lib/site_perl/5.16.1/Mango.pm line 186 during global destruction.
00:16 sri i've previously answered that already, the connection management code in Mango is unfinished
00:18 phillipadsmith sri: not sure I was in the channel for that answer, but thank you for repeating. :)
00:18 sri there's a channel log with search
00:19 phillipadsmith sri: search I did not know about; I'll check that first next time
00:20 phillipadsmith sri: so, that aside, what's happening ?
00:21 phillipadsmith Everything was working a couple of days ago; today these odd errors from time-to-time.
00:21 sri not much, my motivation is a bit low atm, sooo i'm playing starcraft and wait for the realase of the addon :D
00:21 phillipadsmith LOL
00:21 MeierM joined #mojo
00:22 phillipadsmith motivation is overrated
00:25 phillipadsmith sri: in terms of the connection management code; is there a way I can avoid that error and the exist it results in?
00:25 lukep joined #mojo
00:36 stephan48 sri: so when we want to get a bug fixed we have to win against you in Starcraft?
01:26 jb360 joined #mojo
01:32 jb360 left #mojo
01:35 jb360 joined #mojo
01:38 jb360 left #mojo
01:52 mattastrophe joined #mojo
01:58 kitt_vl joined #mojo
02:02 mattastrophe joined #mojo
02:35 egopro joined #mojo
03:04 basiliscos joined #mojo
03:11 zivester joined #mojo
03:26 Adurah joined #mojo
03:27 duncanthrax joined #mojo
03:37 sh4 joined #mojo
03:48 moltar joined #mojo
04:40 rem_lex|pivo joined #mojo
04:40 Adurah_ joined #mojo
04:40 sh4|2 joined #mojo
04:43 tempire joined #mojo
04:52 mattastrophe joined #mojo
04:52 preflex_ joined #mojo
05:13 sh4 joined #mojo
05:16 mattastrophe joined #mojo
05:20 d4rkie joined #mojo
05:56 komodo joined #mojo
05:57 GabrielVieira joined #mojo
06:03 egopro joined #mojo
07:05 Mike-PerlRecruiter_ joined #mojo
07:21 Vandal joined #mojo
07:24 jzawodn joined #mojo
07:33 ladnaV joined #mojo
07:46 jnbek joined #mojo
07:48 ObseLeTe joined #mojo
08:00 chinaxing joined #mojo
08:01 chinaxing hi , everyone
08:01 chinaxing i want to get the response's file handler, then write data to it directly.
08:01 chinaxing how can i do this ?
08:02 basiliscos joined #mojo
08:08 berov joined #mojo
08:08 sh4 joined #mojo
08:21 arpadszasz joined #mojo
09:10 hrupp joined #mojo
09:13 Vandal joined #mojo
09:13 wk_ joined #mojo
09:27 berov left #mojo
09:43 wk joined #mojo
10:01 ladnaV joined #mojo
10:17 marcus sri: Do you use perltidy and syntax checking in TM2?
10:17 * marcus just hacked perlcheckmate.pl to bits to get it to work a bit better.
10:18 marcus (https://gist.github.com/5123746)
10:21 sh4|2 joined #mojo
10:28 wk joined #mojo
10:35 * marcus would like autoprove to work with notification center.
10:35 marcus but seems there's not anything that talks with notification center on cpan...
11:18 hide joined #mojo
11:39 mojonoob111 joined #mojo
11:40 mojonoob111 hi, i am building a website using mojolicious, its very good!
11:41 bpmedley mojonoob111: What does it do?
11:41 mojonoob111 i had a doubt regarding the web server, do we need to stick to morbo only, or we other servers like tomcat
11:42 mojonoob111 its for corporate purpose more , ERP web application.
11:42 mojonoob111 we will use it to track inventory of our softwares and servers
11:42 bpmedley mojonoob111: http://mojolicio.us/perldoc/Mojol​icious/Guides/Cookbook#DEPLOYMENT
11:43 bpmedley mojonoob111: My understanding is that morbo can be used for development and hypnotoad is great for production.
11:49 mojonoob111 bpmedley: Good O, thanks!
12:22 mojonoob111 how will javascript/ajax work with mojolicious ?
12:23 mojonoob111 need to create two tiered selects on webpage and then populate the web form
12:25 mire joined #mojo
12:27 ka2u joined #mojo
12:28 mojonoob111 need examples on using ajax with mojolicious
12:28 Akron joined #mojo
12:29 Akron mojonoob111: There is great support for JSON build into Mojolicious. The client side is up to you.
12:35 bpmedley mojonoob111: http://www.malsup.com/jquery/form/    <-- This could be helpful.
12:43 mojonoob111 Akron, bpmedley thanks for the help. Should get it working now.
13:11 bpmedley % Perl code line, treated as "<% line =%>"   … should that be "<% line %>" ?
13:11 bpmedley http://mojolicio.us/perldoc/Mojo/Template#SYNTAX
13:17 mojonoob111 bpmedley <% line %> is correct
13:19 berov joined #mojo
13:20 berov Hi all,
13:21 berov I run Mojolicious tests trough Devel::Cover and it reports many subroutines as uncovered.
13:21 berov is this embarrassing?
13:24 berov for example:
13:24 berov blib/lib/Mojo/Asset.pm Coverage:40.0%
13:24 berov for subroutines
14:55 gryphon joined #mojo
14:57 mojonoob111 berov: http://search.cpan.org/~pjcj/Dev​el-Cover-1.00/lib/Devel/Cover.pm
14:58 mojonoob111 berov: Sometimes you have code which is uncoverable for some reason. Perhaps it is an else clause that cannot be reached, or a check for an error condition that should never happen.
14:58 berov I understand
14:58 berov I will try with 1.00
14:59 mojonoob111 left #mojo
15:00 berov may be some simple can_ok tests
15:03 TitanOfOld joined #mojo
15:04 gryphon_ joined #mojo
15:05 gryphon__ joined #mojo
15:09 gryphon joined #mojo
15:16 Molaf__ joined #mojo
15:29 sh4 joined #mojo
15:37 gryphon joined #mojo
15:45 sri berov: you don't add garbage tests just to reach 100% with Devel::Cover, you add *good* tests because they make maintenance easier, personally i don't care at all about that value
15:46 berov ok
15:48 berov I n the case with Mojo::Asset it is may bok to know that it should croak when for example 'Method "add_chunk" not implemented by subclass'
15:48 sri why is that so important?
15:49 sri is that really something that should be considered a feature?
15:49 berov well, no
15:50 berov but it will make bettere impression somewhere
15:50 sri please elaborate
15:50 berov that the test coverige is close to 100%
15:51 sri that's not how we work
15:52 sri tests need to make sense and be useful, if your only goal is to reach a number in a tool you're wrong here
15:52 gryphon joined #mojo
15:52 berov ok :)
15:52 berov agreed
15:56 berov Still bosses prefere to see green over red :)
15:56 sri good thing i'm the boss here ;)
15:57 marcus sri++ # pragmatic
15:58 Vandal joined #mojo
15:58 marcus rafl: Did you ever look into adding support for notification center to Log::Dispatch::DesktopNotification?
15:59 rafl i don't think i know what that is
16:00 rafl oh, some apple thing. no, i haven't
16:00 marcus rafl: it's the built in notifcations in newer osx version
16:00 marcus +s
16:00 marcus rafl: I was a bit surprised you had something that supported growl in the first place :)
16:00 rafl i'd welcome patches and stuff, but i've got no way to do or test that myself
16:00 rafl me too! :)
16:00 rafl someone sent me patches, iirc
16:03 marcus rafl: there's only been one release of it tho ;)
16:04 rafl yeah.. i dunno, man. maybe i've written it in order to bug someone to replace his hardcoded growl stuff with something that'll work for me, too :)
16:05 marcus I guess the right way would be to write a new Log::Dispatch class anyways
16:05 marcus rafl: that's probably it. It's beeing used by Test::Continous. I guess it was just using growl at first.
16:05 rafl ah, yes!
16:06 rafl and yes. you want to write the standalone notification center module first and then make the backend detection bit in desktopnotification aware of it
16:09 marcus mm. There's a ruby thing that can talk to notification center with a command line tool. Guess making a cpan module depend on it would be a paijn tho.
16:10 GabrielVieira2 joined #mojo
16:12 marcus tempting to just fork and hack it on my own system :)
16:18 marcus too much yak shaving. I'll just build growl from source and make it talk to notification center #done
16:18 GabrielVieira joined #mojo
16:19 komodo1 joined #mojo
16:22 rafl fair
16:23 * sri wonders if it makes sense to add Mojo::Util::abstract, which would generate this kind of method https://github.com/kraih/mojo/b​lob/master/lib/Mojo/Asset.pm#L9
16:57 berov joined #mojo
16:57 bpmedley_ joined #mojo
17:02 d4rkie joined #mojo
17:04 mattastrophe joined #mojo
17:33 sri marcus, tempire, jberger, crab: btw. please think about the Mojo::Path design, is the current API with its side effects ok or not? what would be a better way to handle the normalization problems? or should we just get rid of ->parts, ->leading_slash and ->trailing_slash?
17:34 sri (also consider consistency with Mojo::Parameters, which has the same normalization "problem")
17:34 * tempire wishes perl had monads
17:34 sri now is the time to get that sorted out... before 4.0
17:37 tempire I like the idea of having it be more functional...each method returning the modified object.
17:38 tempire that would be one huge breakage, though.
17:39 * sri doesn't follow
17:39 sri huge brakage is no issue in a major release though
17:39 sri everything goes, it just has to be good
17:49 tempire https://gist.github.com/tempire/5125010
17:50 tempire er
17:50 tempire hold on
17:52 tempire ok updated
17:53 sri that would just be cloning the object before normalization
17:54 sri which would cost us quite a bit overall performance and a lot of rewriting to stuff like $req->url->path($req->url-​>path->trailing_slash(1))
17:55 sri and when i say quite a bit, i mean "damn, that's gonna hurt"
17:56 sri we could just as well remove ->parts then
17:56 sri the whole point was to be able to easily manipulate the path
17:57 sri push @{$path->parts}, 'foo';
17:57 sri cloning would make that useless
17:58 tempire I'm always going to support a more functional operation.  But I realize it doesn't make sense if the language isn't designed for it.
18:19 marcus very uncertain if I should make my oauth2 provider backend agnostic, or just write one against mango
18:21 marcus re params/paths, I think it's hard.
18:23 sri with params we don't really have much of a choice, we just have to normalize when we parse key/value pairs from a query string
18:24 sri with the path, we do have the option of removing the ->parts api
18:24 sri which would mean we can always treat the path as a string
18:25 sri of course canonicalizing gets much harder then
18:26 sri and the api is less versatile, removing stuff like this recipe http://mojolicio.us/perldoc/Mojol​icious/Guides/Cookbook#Rewriting
18:26 tempire I use parts all the time.
18:27 sri like marcus said, it's hard
18:28 marcus Can't we just keep parts, and stop decoding / ?
18:28 sri we don't need a quick solution now, but keep thinking about it, it will be a long time before we get another chance with 5.0
18:28 bpmedley https://metacpan.org/source/BPMEDLEY/Mojolici​ous-Plugin-FormValidator-0.01/eg/lite/script
18:29 bpmedley What do ya'll think of this Data::FormValidator usage?
18:29 marcus bpmedley: I noticed the module lacks pod :p
18:30 sri marcus: much more is normalized there
18:30 bpmedley Yes, I'm just getting opinions right now.  I'll add the usual stuff in a bit.
18:30 marcus sri: why do we have to normalize the path at all?
18:30 sri most people get in trouble because they set the wrong charset, or need stuff encoded that really shouldn't
18:30 sri marcus: because ->parts is perl characters
18:31 marcus sri: could it be bytes instead?
18:31 sri of course, but does it make sense?
18:31 sri what's the point of ->parts if it's still url-encoded?
18:32 marcus sri: splitting on literal '/'?
18:32 marcus for convenience..
18:32 sri i don't consider that convenient
18:32 marcus Often I want to treat the path as an array
18:33 sri so much stuff would break
18:34 sri https://github.com/kraih/mojo/​blob/master/t/mojo/path.t#L33
18:34 sri you would never know if ->parts is bytes or characters
18:34 marcus sri:  huge brakage is no issue in a major release though
18:34 sri unless we forbid character input
18:34 sri marcus: i mean breakage of good use cases
18:35 marcus oh
18:35 * marcus reverts to his "it's hard" stance
18:35 marcus (Yes, I said hard!)
18:36 sri perhaps try decoding and re-encoding at ->parse() time
18:37 sri but that normalizes early
18:38 berov joined #mojo
18:47 marcus Not sure why perlcheckmate does perl -T
18:47 marcus Mojo::Base doesn't pass taint checks..
18:48 * sri would compile his perl without taint mode if he could
18:49 janus isn't there something from smueller that removes it?
18:49 sri maybe in 5.18
18:49 janus potentially
18:51 marcus I'll try sending a pull request to the perl tmbundle
18:56 sri tempire: you would be ok with ->parts being url-encoded bytes?
18:57 sri (and less %2F protection)
19:00 tempire That seems less useful.  What's the problem we're trying to solve again?
19:00 sri side effects i suppose
19:03 tempire when you say side-effects, do you mean effects beyond the direct intention of a method call, or unintended n00b mistakes?
19:03 Mike-PerlRecruiter_ joined #mojo
19:03 sri i mean methods that normalize the path to do their intended job
19:06 sri perl -MMojo::Path -E 'say Mojo::Path->new("/f%6F%6F/bar")->tap(sub { push $_->parts, "baz" })'
19:07 sri perl -MMojo::Path -E 'say Mojo::Path->new("/f%6F%6F/bar")'
19:08 sri or just perl -MMojo::Path -E 'say Mojo::Path->new("/f%6F%6F/bar")->tap(sub { say shift->parts->[1] })'
19:08 sri the path gets normalized
19:09 sri before 3.88 the second case was actually even impossible, since every path got always normalized
19:10 sri since then it is a little more relaxed, but depending on what you do, normalization will happen on demand
19:10 basic6 joined #mojo
19:11 sri sooo, the big question is if this is the right design
19:11 tempire oh
19:12 tempire Now I understand why you're pushing for feedback.
19:12 tempire The current is scary.
19:12 sri it's less scary when you understand it :)
19:13 tempire as are all side-effects.
19:13 sri st some point normalization will always have to happen
19:13 sri *at
19:14 sri perl -MMojo::Path -E 'say Mojo::Path->new("/♥/bar")'
19:14 sri that has to be normalized
19:16 jberger joined #mojo
19:17 sri ->canonicalize also depends on the current normalization, percent encoding needs to be all uppercase and the like
19:20 sri also, if we stop dealing with %2F, we need a new protection layer for Mojolicious::Static, and we will have to warn users, even if breaking changes in 4.0 are ok, there will likely be quite a few security holes afterwards in user apps
19:22 * jberger catches up on backlog
19:22 mattastrophe joined #mojo
19:25 jberger is it worth looking at other CPAN modules to see how they behave?
19:25 jberger URI comes to mind
19:25 sri they serve a very different purpose
19:25 jberger I've not used it very much
19:26 sri URI just keep the whole URL as a string of bytes and provides methods to manipulate that string
19:26 jberger put it another way, someone else somewhere has had to deal with this stuff
19:26 sri *s
19:26 jberger I like it being modifiable with hash-y array-y like features
19:26 sri Mojo::URL is closer to how browsers deal with it
19:27 sri there is no spec though, all just trial and error
19:27 jberger as I've said before, I think that is a good design goal, Mojo::URL being close to the browser "standard"
19:28 sri keeping stuff as a string and parse it into parts on demand fir futher modifications is a concept used in browser implementations
19:28 sh4 joined #mojo
19:29 sri http://url.spec.whatwg.org # the closest we are to a spec atm
19:29 sri and it's a terrible spec all browser vendors reject :)
19:30 bpmedley What do you mean by normalize?
19:31 marcus bpmedley: decode
19:31 jberger sri: hahaha
19:31 sri for now we are really on our own, and will have to come up with a good API design, RFCs only tell us how normalization, merging, matching and stuff like that should work
19:32 jberger my initial gut reaction is to normalize first, right away, then use Perl characters internally from there on
19:32 jberger the big problem is / right?
19:32 crab argh! url handling! a subject that i have opinions on. and the first opinion is that i should not try to discuss it at 1AM :-/
19:32 sri when i say normalization i basically mean percent decode, try to decode with charset or consider it chars already, encode with charset, percent encode
19:33 marcus crab: grab a bottle of whiskey and join in!
19:34 tempire so many benders
19:34 jberger ETOOMANYBENDERS
19:34 sri fun fact, even if we don't normalize, ->to_string will encode with charset and percent encode the string
19:34 sri for cases like the unicode heart
19:34 sri Bender3: and none of them work!
19:35 jberger sri: does it make sense to try to do heuristic normalization?
19:35 sri mst: the benders, they are all broken!
19:35 jberger percent decode if % characters exist?
19:35 marcus sri: they don't bend?
19:35 Bender3 will it bend?
19:35 jberger they break but they don't bend
19:35 sri jberger: no sense whatsoever
19:35 marcus \o/
19:36 * marcus gets booze
19:36 * Bender3 gets bent
19:36 jberger it seems like others (crab) have opinions where I would really just be guessing on this stuff
19:37 sri jberger: read up on the code :)
19:37 jberger I should probably stay out of it until some concrete ideas form up, and then I can have opinions on what breaks :-)
19:37 jberger I will, where should I start? Mojo::URL
19:37 sri https://github.com/kraih/moj​o/blob/master/t/mojo/path.t
19:37 jberger k
19:37 sri the tests are rather comprehensive
19:38 sri it's actually a rather tiny module https://github.com/kraih/mojo​/blob/master/lib/Mojo/Path.pm
19:38 anewkirk what's the skinny on Mango?
19:38 GabrielVieira2 joined #mojo
19:39 anewkirk I think I'll start drafting MongoDB::DataHandler tomorrow evening after Spartacus
19:41 BeDa joined #mojo
19:43 jberger sri: ok, so now that I brushed up, is there a succinct way to state what the "issue" is
19:43 sri btw. normalization doesn't have to be a full roundtrip, operations like ->merge percent decode, try to decode with charset, and split on /, then merge based on arrays
19:44 sri jberger: http://irclog.perlgeek.de/​mojo/2013-03-09#i_6568827
19:44 sri i think that covers it
19:44 mattastrophe joined #mojo
19:45 sri basically, how do we really want to manipulate paths? how does normalization work best for us?
19:46 sri perl -MMojo::Path -E 'say Mojo::Path->new("/f%6F%6F/bar")'
19:46 sri perl -MMojo::Path -E 'say Mojo::Path->new("/f%6F%6F/bar")->tap(sub { say shift->parts->[1] })'
19:47 sri is this behavior correct? how else could it be handled?
19:47 sri or
19:47 sri perl -MMojo::Path -E 'say Mojo::Path->new("/f%6F%6F/bar")->tap(sub { push $_->parts, "baz" })'
19:48 sri jberger: to put it into one sentence... is the way Mojo::Path works now good?
19:48 jberger that's how I would expect them to work, if that makes any difference
19:48 jberger I think so
19:49 jberger I like thinking of the path as an array
19:49 jberger I use File::chdir in some of my code which lets you treat your cwd as a localizable array
19:50 jberger in this case you wouldn't localize, you would clone
19:50 jberger but the examples you sent are how I would like them to behave I think
19:56 jberger should leading_slash be something like is_abs?
19:57 sri you tell me
19:58 jberger is there a case where that scenario isn't the same?
19:58 sri leading_slash(1)
20:00 jberger I guess I'm just proposing changing the name of the method, the reason for is then its more what you MEAN, it reason against is that right now it is what it says it is
20:01 jberger I guess what I'm saying is that analogy to FIle::Spec (i.e. system paths) would be in terms of relative vs absolute
20:01 jberger not existance of a leading slash
20:01 sri it should get simpler, not more complicated ;p
20:01 * jberger thinks some more
20:02 sri afterwards you have ->is_abs, ->to_abs and ->trailing_slash
20:02 sri more methods with side effects, not less
20:03 jberger would you need a "to_abs"?
20:03 jberger is_abs(1)
20:03 sri how else would you add a leading slash?
20:03 sri wtf?
20:03 jberger "this path is absolute"
20:03 sri is_abs() as a setter?
20:03 jberger getter/setter
20:03 sri that is horrible
20:04 jberger I told you you wanted someone with better ideas on this than me :-)
20:04 sri heh ;p
20:05 jberger I like paths as array analogy, how to do leading slash doesn't matter to me very much
20:05 jberger trailing slash kinda makes you wish there was an "undef but present" scalar value which could sit in the array (and not be confusing)
20:06 jberger but since that doesn't exist, you kinda need it
20:07 sri not undef, just ''
20:07 jberger yeah
20:07 jberger that is kinda what one means with a trailing slash
20:07 sri also worls for leading slash
20:07 sri *works
20:08 sri doesn't really help with the normalization problem though ;p
20:08 jberger but it doesn't have the connotation of making it absolute
20:08 jberger maybe the first element could be / or not
20:08 sri that's horrible again ;p
20:08 jberger mean special casing of the rebuild process tho
20:08 jberger yeah
20:09 jberger I don't support that one at all, sometime stuff just pops out of my mouth
20:09 jberger (and/or from my fingers on the keys)
20:10 sri i assume you're also against percent encoded bytes in the array
20:10 jberger overload @{} ?
20:10 * jberger thinks I know what sri will think of that
20:10 sri you mean overload @[]
20:11 jberger ? its @{} isn't it?
20:11 sri it's more sugar coating, but still doesn't help with the problem ;p
20:12 sri oh, you're right of course
20:12 sri %{} was hash
20:12 jberger oh I see what got you there though
20:12 sh4|2 joined #mojo
20:13 jberger I guess I don't have good opinions on the normalization, I haven't really had problems though, so my vote might be "what we are doing works for me"
20:13 sri don't be too quick with that, the normalization behavior changed in 3.88
20:13 * jberger looks
20:14 sri before it would *always* normalize
20:14 sri now it only does so on demand
20:14 sri perl -MMojo::Path -E 'say Mojo::Path->new("/f%6F%6R/bar")'
20:14 sri that used to result in /foo/bar
20:15 jberger oh I see
20:15 jberger I guess I didn't get what we were talking about
20:15 jberger :-)
20:15 sri xD
20:15 jberger I will think about it
20:16 jberger I will be out for a bit, I'll see if my thought land somewhere
20:16 jberger thoughts
20:16 jberger meantime, I kinda like trailing '' for trailing slash
20:16 jberger and I think overload @{} might be friendly, but probably quite unimportant in the scheme of things
20:18 bpmedley sri: Would you consider a slice method for Mojo::Path?  Or maybe use Mojo::Collection instead of $self->{parts}?
20:19 sri bpmedley: why?
20:19 jberger you get all the array functions for free when overloading @{}, thats part of why that would be cute
20:19 marcus_ joined #mojo
20:19 bpmedley sri: http://irclog.perlgeek.de/​mojo/2013-03-09#i_6569268
20:19 jberger Mojo::Collection sounds like it would be overkill
20:20 sri $path->parts *is* and array, you can do whatever you like with that
20:20 sri that's part of the problem
20:20 jberger true, but you could do it on the object
20:20 bpmedley sri: I was focusing on the ->tap piece.  Maybe that wasn't what you intended.
20:20 jberger oh, you want it LESS like that :-P
20:20 sri bpmedley: not at all, that has no relevance
20:22 sri it's about internal representation, since you can do whatever you like with $path->parts we have to maintain two internal representations, an unmodified string (in case nothing changes), and an array for normalization
20:22 sri same for Mojo::Parameters, string for query strings, array for ordered key/value pairs
20:23 sri as we all know "?fo%6Fbarbaz" is a valid query string too
20:29 jberger fwiw, I would just keep an array
20:29 jberger but you want the on-demand for performance I guess
20:29 sri and more dwim
20:30 sri we actually had quite a few coplaints about /f%6F%6R/bar getting always normalized to /foo/bar
20:30 sri they strictly represent the same information, but real world web apps are often broken
20:57 Akron joined #mojo
21:01 basiliscos1 joined #mojo
21:08 sri yay, simcity 2013 in HTML5!!! http://tholman.com/playable-simcity-2013/
21:14 Akron marcus: I would very much appreciate a database agnostic oauth2 provider!
21:15 marcus akron: It would have to store some state somehow tho, when generating tokens.
21:16 Akron marcus: But these should be quite simple operations - possible to define callbacks on plugin registration, or not?
21:27 marcus akron: Yeah, that's the current thinking.
21:28 Akron I would prefer such a solution. That's also easier to maintain as long as the Mango API is still changing.
21:30 sri btw. this is the closest you can get to Mojo::Path->parts with URI, it normalizes just the same perl -MURI -E 'my $u = URI->new("/f%6F%6F/bar"); $u->path_segments($u->path_segments); say $u'
21:35 * rafl wonders if he should retaliate and share all his maint bits with marcus
21:36 marcus rafl: that would really hurt my feelings, dude.
21:36 sri global thermonuclear war
21:37 marcus sri: the password is 'joshua'
21:37 bpmedley sri: Would you consider only having the parts array?
21:37 rafl marcus: how about File::CheckTree? or Devel::DProf? Devel::SelfStubber maybe? :)
21:38 sri bpmedley: please elaborate
21:38 marcus rafl: selfstubber sounds like it's able to take care of itself.
21:39 bpmedley sri: It would seem difficult to keep the unmodified string in sync with parts if the user can change parts on the fly.
21:39 rafl you'd hope
21:39 * marcus is watching http://kottke.org/13/03/the​-world-championship-of-puns
21:39 sri bpmedley: that's the old behavior, then everything would be normalized again
21:41 bpmedley sri: From an api standpoint, what is the desired goal?
21:41 bpmedley sri: Sorry I'm not up to speed on prior behavior.
21:42 sri bpmedley: sorry, i'm tired of the discussion, really can't explain everything again
21:42 bpmedley sri: I understand about needing to change the internals; however, what should change from the api?
21:42 sri all information is in the backlog though
21:46 * sri is starting to think that everything should stay the way it is, and maybe just the api should be simplified a little
21:46 sri ->leading_slash and ->trailing_slash replaced with '' at the start and end of ->parts for example
21:47 sri no wait, that makes recipes like this harder again http://mojolicio.us/perldoc/Mojol​icious/Guides/Cookbook#Rewriting
21:53 marcus_ joined #mojo
21:57 bpmedley From a users perspective, the only odd thing is I would not expect trailing_slash and leading_slash to change the path, does that make sense?
21:57 sri how else could they work?
21:58 bpmedley I would only expect them to return if the string I passed in to new() had the respective slashes.
21:58 tuffguy joined #mojo
21:59 bpmedley If a couple other methods were added to change the string, then could those two methods be refactored more simply?
22:00 tuffguy joined #mojo
22:01 sri i don't think you've looked at the code yet, it's much much more complicated
22:01 bpmedley Yes, I have looked at the code.
22:01 tuffguy joined #mojo
22:04 good_news_everyone joined #mojo
22:04 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/1UBbUw
22:04 good_news_everyone mojo/master 2271df8 Sebastian Riedel: a few more Mojo::Path tests
22:04 good_news_everyone left #mojo
22:06 tuffguy joined #mojo
22:07 tuffguy joined #mojo
22:07 tuffguy joined #mojo
22:10 basiliscos joined #mojo
22:10 jberger sri: I have thought about it while I was out, I keep coming back to the only sane thing is the normalize first
22:11 jberger though possibly it might be useful to store the original string
22:11 sri jberger: you mean like it is now?
22:12 jberger well, almost
22:13 jberger I think your escaped example probably should come back normalized
22:13 jberger I understand that some webapps are broken, but it makes it harder on authors of apps that aren't, and that seems counterproductive
22:18 jberger anyway since any operation is going to involve parts, it seems like that should be the core data structure
22:19 jberger the only other action being to return the un-parsed (read original) path, that probably should be its own thing, say an attribute called orig
22:19 sri ah, so yo want this change reversed https://github.com/kraih/mojo/commit/86​8920d36e1fce26f6ae591a72866cbce6266f5a
22:21 sri you're not considering the bigger picture though, how does ->orig help with Mojo::UserAgent?
22:22 sri you're making it a special case somewhere else, possibly multiple places
22:22 jberger I'm only saying I'm making it available, in case its needed
22:23 jberger but I think ::Path should clean things up by default
22:23 jberger IM(very)HO
22:23 jberger its what I would want in my apps, that may not be true for others
22:28 jberger hmmmmm
22:28 jberger I was trying to trip it up, and you've done good job cloning where necessary
22:29 sri ;p
22:30 bpmedley What I was saying earlier is to possiblly keep all parts of the path in "parts".  So, the leading and trailing slashes would be 0 and -1 indexes.  That would probably break things, tho.
22:31 sri it actually makes array access suck imo
22:32 sri example http://mojolicio.us/perldoc/Mojol​icious/Guides/Cookbook#Rewriting
22:32 bpmedley perl -MMojo::Path -E '$s = Mojo::Path->new("/f%6F%6R/bar"); say $s->to_string; say $s->trailing_slash(1); say $s->to_string'
22:32 bpmedley Thank you for considering it.  I agree it's an obtuse change.
22:33 bpmedley In addition, I would not expect the trailing_slash(1) call to change the to_string() output.  I would expect a different name for the trailing_slash(1) method.
22:34 sri it's a manipulation, manipulations require normalization
22:34 tuffguy joined #mojo
22:35 bpmedley I do understand that data must change.  I am only saying I would expect the name of the method to be different.
22:35 jberger sri: given the new system, how do I get foo out of this:
22:35 jberger perl -MMojo::Path -E 'say Mojo::Path->new("/f%6F%6R/bar")->parts->[0]'
22:35 sri and before you bring up the ->trailing_slash() form, look at my last commit
22:36 tuffguy the spice must flow!
22:36 sri jberger: that oneliner has a typo
22:37 sri R is not hex
22:37 tuffguy %6R => %6F
22:38 jberger oh, right you are, but then again: http://irclog.perlgeek.de/​mojo/2013-03-09#i_6569373
22:38 jberger :-)
22:38 jberger ok
22:39 sri so... nobody actually tried my oneliner :,(
22:39 jberger I did, and it didn't give /foo/bar so I assumed it worked :-)
22:40 * jberger has to redo some testing
22:40 tuffguy joined #mojo
22:41 tuffguy joined #mojo
22:41 tuffguy joined #mojo
22:42 tuffguy joined #mojo
22:42 jberger I guess as long as all the manipulations force normalization and no non-manipulations do, then its ok by me either way
22:42 GabrielVieira joined #mojo
22:42 sri ->leading_slash() also forces normalization
22:42 jberger me personally, I would like to get the normalized string back by default, but its not hard to get
22:43 sri since the slash may be encoded
22:43 sri if you want to force normalization you can always go with ->canonicalize, which is a little more strict
22:44 jberger right, that's what I mean, "easy to get"
22:44 GabrielVieira joined #mojo
22:45 sri so, i guess you really want to keep array access with ->parts
22:45 * sri kinda wants that too
22:46 jberger I really like that
22:46 jberger I've said I would take it further, to overload @{}, but thats sugar as we've said
22:47 sri i'm undecided on that
22:51 * jberger is reading https://github.com/kraih/mojo/blob/97adf412d48​b4e506cb0b350505d577a738faf86/lib/Mojo/Path.pm
22:55 marcus joined #mojo
22:55 batman joined #mojo
22:57 Meiermann joined #mojo
22:59 sri jberger, marcus, crab, tempire: http://pastie.org/6434932 # you think the example gets better with this?
23:02 jberger it makes sense to me
23:03 jberger yes I would call that better
23:05 berov left #mojo
23:05 jberger I can "know" without looking at the documenation for path what pushing onto the path as arrayref will do
23:06 jberger I can GUESS what pushing onto the parts method will do
23:07 sri tempire said he uses parts a lot, i'd like his opinion too
23:07 * sri shakes Bender3
23:07 jberger absolutely, I don't want this all blamed on me!
23:07 sri too late for that
23:07 sri it's all your fault now anyway
23:08 * jberger bakes sri a pie, hope's he'll forget
23:08 jberger sri: is there a downside to remembering the original string passed to the constructor?
23:09 jberger seems like its less destructive that way
23:09 sri jberger: once you change the path it could get confusing
23:09 jberger thats why I would call it ->orig or some such
23:09 sri and of course i don't really see the value
23:09 marcus I truly hate the slash behavior.
23:10 marcus Not being able to send encoded slashes sucks
23:10 jberger there are two reasons to delay normalization, performance and getting access to the non-normalized path
23:10 sri marcus: but you can if you don't modify the path
23:10 jberger performance I can't argue with, but if you store the non-normalized path its available whenever
23:11 Bender3 I dig that.
23:11 sri marcus: perl -Mojo -E 'say Mojo::Path->new("/foo%2fbar/baz")'
23:11 Bender3 totes adorbs
23:11 sri that was the whole point of my change last week! ;p
23:11 sri lazy normalization, so you can send garbage if you have to
23:12 jberger sri: if you have to send garbage, why not just send a string (I really am asking, not trying to sound like a jackass)
23:13 good_news_everyone joined #mojo
23:13 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/cY_67g
23:13 good_news_everyone mojo/master 388fb4b Sebastian Riedel: added direct array access for path parts to Mojo::Path
23:13 good_news_everyone left #mojo
23:13 * jberger keeps missing my entrance window on the HTML5 simcity!!
23:13 sri jberger: Mojo::URL
23:14 jberger sri: thanks
23:14 sri Mojo::URL->path is wrapped in a Mojo::Path
23:14 * jberger has once again lost the forest for the trees
23:14 sri $ua->get('/foo%2Fbar/baz') just works since 3.88
23:15 jberger ok, then I say keep it
23:15 jberger but it should be super easy to get the normalized version, and I think direct array access tends to that
23:15 * sri assumes marcus was referring to the 3.87 behavior
23:16 marcus Sri: https://github.com/marcusramberg/pe​rl_tent/blob/master/t/profile.t#L12
23:16 sri lulz
23:16 sri .url_escape?
23:16 marcus Sri: the fact that this requires a star match?
23:17 ka2u joined #mojo
23:17 bpmedley One possible point of confusion is that, currently, sometimes to_string uses "path" and other times it uses "parts".
23:18 sri marcus: but that's unrelated to the current discussion
23:18 rem_lex| joined #mojo
23:18 sri route placeholders have no relation to Mojo::Path
23:19 marcus Sri: i Thought that was a side effect of converting encoded slashes to regular ones.
23:19 sri ok, seriously, you can't depend on %2f working
23:20 sri intermediaries will rewrite that
23:20 sri you should put that stuff in a query param
23:20 marcus I have never seen that happening. Only mojo.
23:21 sri i have seen it happen, a lot
23:21 sri but you're of course welcome to make a proposal for changing it
23:22 marcus Oh, I see Apache has some crap to rewrite it without AllowEncodedSlashes set.
23:23 marcus Not used it for a few years.
23:28 bpmedley Sorry, I see now that they support different types of data.  Namely, the /.
23:28 Bender3 yo dawg I heard you like paths
23:31 marcus You heard wrong. :)
23:31 * marcus & # bedtime
23:32 sri nobody said this was easy :)
23:35 sri marcus: if you're serious about the proposal, please include a new security strategy for Mojolicious::Static
23:36 sri we don't want that directory traversal attack again :S
23:44 bpmedley http://pastie.org/pastes/6435170/text
23:44 bpmedley Is that correct usage on my part?
23:51 jberger bpmedley, the % encoded part gets encoded again on to_string, I don't think thats what you mean
23:53 bpmedley jberger: Is it correct to expect new("/abc/%2F/123") and parts([qw(abc %2F 123)]) to create the same to_string?
23:54 sri no
23:55 bpmedley Understood
23:56 sri perl -Mojo -E 'say Mojo::Path->new->parts([qw(abc / 123)])'
23:57 sri it's still not the same, but you get the same result
23:57 jberger bpmedley, the constructor from string is to let you use real world paths, the parts api is more "friendly"
23:58 bpmedley Thanks

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