Camelia, the Perl 6 bug

IRC log for #mojo, 2012-10-25

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

All times shown according to UTC.

Time Nick Message
00:11 memowe joined #mojo
00:59 tempire I think randomness is not hypnotoad's problem as well.
00:59 tempire but
00:59 tempire does it hurt to call srand after a fork?
00:59 * tempire wonders about side-effects
01:06 laouji joined #mojo
01:09 zpmorgan joined #mojo
01:12 xaka joined #mojo
01:29 vervain joined #mojo
01:31 crab sri: better would be: use Scalar::Util qw(refaddr); return !!1 if refaddr \!!1 == refaddr \$_[0] or something like that
01:32 crab well, you'd have to check both !!1 and !!0
01:32 crab but that's robust.
01:32 crab and faster.
01:33 crab and it won't break because the core uses the exact same comparison all over.
01:48 d4rkie joined #mojo
01:49 d4rkie joined #mojo
02:03 Adurah joined #mojo
02:03 _xaka_ joined #mojo
02:03 D4RK-PH0ENiX joined #mojo
02:04 augensalat joined #mojo
02:04 gryphon joined #mojo
02:05 GabrielVieira joined #mojo
02:05 whee joined #mojo
02:06 romel joined #mojo
02:06 perlite joined #mojo
02:06 dwierenga joined #mojo
02:06 migo joined #mojo
02:07 kvorg joined #mojo
02:07 kenjiskywalker joined #mojo
02:07 laouji joined #mojo
02:07 dminus joined #mojo
02:07 duncanthrax_work joined #mojo
02:07 yakudza joined #mojo
02:07 gizzlon joined #mojo
02:07 cosimo joined #mojo
02:07 dvinciguerra joined #mojo
02:07 hide joined #mojo
02:07 ki0 joined #mojo
02:07 ask joined #mojo
02:07 heytrav joined #mojo
02:07 spacebat joined #mojo
02:07 robinsmidsrod joined #mojo
02:07 human39 joined #mojo
02:07 kthakore joined #mojo
02:07 DaTa joined #mojo
02:07 nicomen joined #mojo
02:07 stephan48 joined #mojo
02:07 al joined #mojo
02:07 nuba joined #mojo
02:08 duncanthrax joined #mojo
02:08 plu joined #mojo
02:08 bc547_ joined #mojo
02:08 Averna joined #mojo
02:08 amirite joined #mojo
02:08 Britzel_ joined #mojo
02:08 buu joined #mojo
02:08 jamesw joined #mojo
02:08 pie joined #mojo
02:08 mikegrb joined #mojo
02:08 tholen joined #mojo
02:08 dbr joined #mojo
02:08 edoardo joined #mojo
02:08 jwang joined #mojo
02:08 phillipadsmith joined #mojo
02:08 keedi joined #mojo
02:08 bzero joined #mojo
02:08 mfontani joined #mojo
02:08 kd joined #mojo
02:08 jmaister joined #mojo
02:08 Ulti joined #mojo
02:08 Annihitek joined #mojo
02:08 phips joined #mojo
02:08 ruz joined #mojo
02:08 tardisx joined #mojo
02:08 espen joined #mojo
02:08 garu joined #mojo
02:08 BinGOs joined #mojo
02:36 noganex_ joined #mojo
03:11 GabrielVieira joined #mojo
03:13 Foxcool joined #mojo
03:57 sawtooth joined #mojo
05:16 laouji joined #mojo
05:21 michaelfung joined #mojo
05:21 ovnimancer joined #mojo
05:21 michaelfung Greetings everyone.
05:25 michaelfung Any hints on how to make the html templates workable for a presentation designer?
05:27 michaelfung I used to smarty templates(php), which can be processed easily by a non programming web designer.
06:02 crab joined #mojo
06:02 crab argh.
06:04 marcus graph
06:04 marcus michaelfung: I tend to use TT for that, but I don't like it much.
06:12 dpetrov_ joined #mojo
06:14 vervain joined #mojo
06:30 crab hi marcus.
06:31 marcus hi crabbie
06:31 * marcus setup airspeakers in the office today, waiting for other people to arrive so controversy can start.
06:54 tempire ok ok ok
06:54 tempire I definitely got it this time
06:54 tempire mojo theme song
06:55 tempire http://www.youtube.com/watch?v=TrcT7sseLZI
07:18 judofyr joined #mojo
07:20 Mike-PerlRecruiter_ joined #mojo
07:21 arpadszasz joined #mojo
07:21 yakudza joined #mojo
07:24 batman joined #mojo
07:30 mauriez haha
07:30 Vandal joined #mojo
07:30 spleenjack joined #mojo
07:39 tempire so I've been watching a lot of korean television.
07:39 tempire and I'm pretty convinced I need to move there.
07:39 * tempire wonders if korea haz the perls
07:41 omega wasn't there just a korean perl workshop?
07:41 omega like this last weekend?
08:14 sri \o/
08:14 sri tempire++ # closing ticket
08:15 sri there was a mojolicious talk at the korean perl workshop too afair
08:17 sri crab: when you said that yesterday i actually tried refaddr, but i couldn't get to the actual value perl -MScalar::Util=refaddr -E 'say refaddr \!!1; say refaddr \!!1; my $foo = !!1; say refaddr \$foo'
08:28 sri https://gist.github.com/3948157 # still the best solution we have
08:29 pau4o joined #mojo
08:30 * sri would really like for ->render(json => {foo => $foo ? Mojo::JSON->true : Mojo::JSON->false}) to become ->render(json => {foo => !!$foo})
08:31 * sri shakes tempire and marcus
08:37 crab yes, you're right, $foo's address will obviously be different.
08:37 crab i was trying refaddr \!!$foo, which works, but which we can't use in a sub
08:37 * sri nods
08:38 crab i've solved it! ->render(json => {foo => \!!$foo})
08:38 * crab hides
08:39 yakudza how cat I get raw http data from request ?
08:39 sri crab: you think the detection hack in my gist is too unreliable?
08:39 yakudza $self->req->to_string shows me data without file encoded
08:40 yakudza and get_body_chunk too
08:40 crab sri: i think it's ok, i was just trying to do better
08:40 crab but i have FAILED. /me hangs his head
08:40 sri ah :)
08:41 marcus sri: I don't care about bools
08:42 sri marcus: it would mean we can generate all JSON with native Perl data types!
08:42 marcus \m/
08:45 yakudza ppl please help. how can I get raw http data from mojo::Message with all params and encoded file attached
08:46 sri marcus: judofyr started the discussion yesterday :)
08:46 judofyr I did?
08:46 judofyr \o/
08:46 sri \o\
08:47 sri /o/
08:48 AmeliePoulain joined #mojo
08:48 marcus you get an op, you get an op, EVERYBODY gets an op!
08:49 bjoernfan \o/
08:49 bjoernfan Oh. :(
08:50 bjoernfan "In fact, everybody in this room's an honorary Mojotrotter!"
08:50 sri http://cdn.memegenerator.net​/instances/400x/28970469.jpg
08:50 nic I don't want to be honorary, I want to be paid
08:51 nic :D  now that site looks useful
08:55 bjoernfan <3
09:04 sri crab: if only \!!0 was actually false :S
09:09 crab yakudza: i don't understand what you mean
09:27 spleenjack joined #mojo
09:27 daxim joined #mojo
09:27 Vandal joined #mojo
09:27 Mike-PerlRecruiter_ joined #mojo
09:27 dpetrov_ joined #mojo
09:27 ovnimancer joined #mojo
09:27 sawtooth joined #mojo
09:27 Foxcool joined #mojo
09:27 noganex joined #mojo
09:27 BinGOs joined #mojo
09:27 garu joined #mojo
09:27 espen joined #mojo
09:27 tardisx joined #mojo
09:27 ruz joined #mojo
09:27 phips joined #mojo
09:27 Annihitek joined #mojo
09:27 Ulti joined #mojo
09:27 jmaister joined #mojo
09:27 kd joined #mojo
09:27 mfontani joined #mojo
09:27 bzero joined #mojo
09:27 keedi joined #mojo
09:27 phillipadsmith joined #mojo
09:27 jwang joined #mojo
09:27 edoardo joined #mojo
09:27 dbr joined #mojo
09:27 tholen joined #mojo
09:27 mikegrb joined #mojo
09:27 pie joined #mojo
09:27 jamesw joined #mojo
09:27 buu joined #mojo
09:27 Britzel_ joined #mojo
09:27 amirite joined #mojo
09:27 bc547_ joined #mojo
09:27 plu joined #mojo
09:27 duncanthrax joined #mojo
09:27 nuba joined #mojo
09:27 al joined #mojo
09:27 stephan48 joined #mojo
09:27 nicomen joined #mojo
09:27 DaTa joined #mojo
09:27 kthakore joined #mojo
09:27 human39 joined #mojo
09:27 robinsmidsrod joined #mojo
09:27 spacebat joined #mojo
09:27 heytrav joined #mojo
09:27 ask joined #mojo
09:27 ki0 joined #mojo
09:27 hide joined #mojo
09:27 dvinciguerra joined #mojo
09:27 cosimo joined #mojo
09:27 gizzlon joined #mojo
09:27 duncanthrax_work joined #mojo
09:27 dminus joined #mojo
09:27 kenjiskywalker joined #mojo
09:27 kvorg joined #mojo
09:28 sri hmm
09:28 Lucas1 joined #mojo
09:28 sri if i add Mojo::Util::looks_like_bool i guess i might as well add https://github.com/kraih/mojo/bl​ob/master/lib/Mojo/JSON.pm#L291 as Mojo::Util::assigned_as_number
09:29 sri suggestions for a better name welcome!
09:32 arthas joined #mojo
09:33 vervain joined #mojo
09:36 judofyr sri: why not looks_like_number ?
09:36 judofyr or, is_number and is_bool ?
09:38 nicomen then you have the possibilty of having variables with dual values ;)
09:44 Britzel joined #mojo
09:49 yakudza_ joined #mojo
10:02 lukep joined #mojo
10:07 sri judofyr: looks_like_number is something else already https://metacpan.org/module/Scalar::Util
10:12 cosmincx joined #mojo
10:30 spleenjack joined #mojo
10:36 judofyr sri: what's the difference between looks_like_number and assigned_as_number?
10:39 pierrick joined #mojo
10:46 jamadam joined #mojo
10:48 batman i'm starting hypnotoad and it logs Listening at "http://*:8080". and Server available at http://127.0.0.1:8080.
10:48 batman i thought "*" was supposed to listen to all interfaces?
10:49 batman got Mojolicious 3.42
10:49 sri judofyr: looks_like_number is very liberal, it considers 23, "23" and "0 but true" all numbers
10:50 sri while assigned_as_number checks the flags of the scalar to see if it has been assigned as a number and not a string
10:50 sri $foo = 23 vs $foo = "23"
10:51 sri for perl it doesn't matter, but JSON makes a difference
10:51 sri in
10:51 sri batman: the log one is authoritative, the other is just so the user knows where to look
10:52 batman ah. thanks
10:54 sri augensalat: we are not reluctant to fixing problems, you just failed to convince us that it is a problem https://metacpan.org/module/GRAF/Mojo​licious-Plugin-OnFork-0.001/lib/Mojol​icious/Plugin/OnFork.pm#DESCRIPTION
10:58 augensalat sri: Yes, all my fault. That's why the plugin exists.
10:59 omega fwiw, starman (just picked one) does srand on child_init_hook (from Net::Server)
10:59 sri omega: i don't see how that's relevant, but you're welcome to continue the discussion over here https://github.com/kraih/mojo/issues/402
11:01 crab i should write a program where a parent and multiple children depend on having the same values from rand() to send each other cookies for synchronisation and then run around filing bugs against people who call srand behind my back.
11:01 sri omega: Ruby also calls srand automatically after fork, does that make it a Perl bug?
11:01 sri crab: :D
11:02 omega sri: no, I am only saying that the starman author(s) seems to be of a different opinion
11:02 omega in the spirit of "more data couldn't possibly hurt"
11:03 crab vive la diffÉérence
11:03 sri i see, the starman argument has been brought up in a different spirit yesterday already
11:04 ObseLeTe joined #mojo
11:07 SmokeMachine joined #mojo
11:18 ovnimancer joined #mojo
11:30 d4rkie joined #mojo
11:31 ObseLeTe joined #mojo
11:33 sri batman: we know looks_like_bool works, cpantesters doesn't tell us if it's too crazy ;)
11:34 batman haha. nothing is too crazy imo
11:34 sri i'm more interested in edge cases people might now where it doesn't work or might backfire
11:34 sri *+k
11:34 sri or how the odds are that it breaks in future perl versions
11:35 batman i see.
11:35 batman sounds wise
11:37 nicomen sri: re: json and number, actually I've ran into similar issues lately with XMLRPC, where it by default tries to guess corresponding types (but I wanted to force everything to be a string)
11:38 sri $value = "$value"
11:39 ovnimancer joined #mojo
11:40 nicomen http://search.cpan.org/~rjray/RPC-XML-0​.77/lib/RPC/XML.pm#SUBROUTINES/METHODS smart_encode(@args)
11:42 sri i don't see an issue, JSON encoders have always worked like that
11:45 nicomen sure, just mentioning there might be someone else that found a good/better/worse way of identifying how a number is set
11:46 sri i've not actually looked at the code
11:47 sri it appears to use placeholder objects, don't think that's very relevant here
11:48 sri marcus, tempire, crab: are you +1 or -1 on the boolean thing?
11:49 * sri thinks he's +1, since JSON with only native Perl data types is awesome
11:49 good_news_everyone joined #mojo
11:49 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/UYC55A
11:49 good_news_everyone [mojo/master] added assigned_as_number and looks_like_boolean functions to Mojo::Util - Sebastian Riedel
11:49 good_news_everyone left #mojo
11:50 sri it's in master for now, so everyone can test it
11:50 nicomen sri: looking at how they did it, they use regexps, so less magical than assigned_as_number, but perhaps less flexible
11:55 nicomen sri: I'm curious about the looks_like_bool, are there tests on different variations on what is regarded as bool and not?
11:56 sri nicomen: see commit
11:56 nicomen ah sorry found at the end
11:56 nicomen would be interesting to see if any common Boolean modules ended up correct ;)
11:57 nicomen I see right now, it's only !!0 and !!1 that are tested
11:57 sri boolean modules are always wrong
11:57 nicomen (that should be bool)
11:57 arpadszasz joined #mojo
11:57 nicomen sri: oh, heh
11:59 sri test runs on different platforms would be appreciated
12:01 spleenjack joined #mojo
12:04 sri argh, typo in commit message... my OCD is going haywire :S
12:06 good_news_everyone joined #mojo
12:06 good_news_everyone [mojo] kraih force-pushed master from 2cf505f to 4ca52fa: http://git.io/BhzC7A
12:06 good_news_everyone [mojo/master] added assigned_as_number and looks_like_bool functions to Mojo::Util - Sebastian Riedel
12:06 good_news_everyone left #mojo
12:07 marty moin
12:08 sri o/
12:08 judofyr sri: force push :O
12:08 sri :o
12:08 ZadYree Hi & beat my skinny perlish ass
12:09 nicomen $ perl -Ilib -Mboolean -MMojo::Util -wle 'print "no" if ! Mojo::Util::looks_like_bool booleam::true'
12:09 nicomen no
12:10 sri as expected
12:10 nicomen guess a bug should be filed against boolean ;)
12:10 sri booleans can't be blessed
12:10 nicomen is thre no way to construct a "proper" boolean with right flags and types?
12:11 sri of course
12:11 sri !!1 and !!0
12:11 sri any double negation should generate a true boolean
12:11 sri !!$foo
12:12 sri true being PL_sv_yes and PL_sv_no
12:12 sri which are two constants that get reused every time you generate a boolean
12:13 sri to keep it in master i still want votes from marcus, tempire and crab though... so it's not just my fault in case something goes wrong :D
12:14 nicomen the change is that before you never generated a true/false value in json?
12:14 sri we had placeholder objects
12:14 sri Mojo::JSON->true/false
12:15 nicomen ah
12:15 sri it's ->render(json => {foo => !!$foo}) vs ->render(json => {foo => $foo ? Mojo::JSON->true : Mojo::JSON->false})
12:17 ovnimancer joined #mojo
12:18 ovnimancer left #mojo
12:18 good_news_everyone joined #mojo
12:18 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/GshtYg
12:18 good_news_everyone [mojo/master] updated Changes file - Sebastian Riedel
12:18 good_news_everyone left #mojo
12:21 ObseLeTe joined #mojo
12:23 spleenjack joined #mojo
12:25 ObseLeTe joined #mojo
12:47 sri argh
12:47 sri looks like the commit has to be reverted :(
12:48 sri after a second copy of the value flags start changing
12:48 sri so it's not reliable
12:54 judofyr sri: second copy?
12:56 sri or actually any copy
12:56 * sri is confused
12:58 sri something is very weird
12:58 sri perl -MDevel::Peek -E 'Dump !!1; my $foo = !!1; Dump $foo'
12:58 sri how the hell did the tests pass
12:59 jnap joined #mojo
12:59 sri i guess that was what demerhq meant with booleans in are fragile
13:00 sri no clue how this test is different https://github.com/kraih/mojo/​blob/master/t/mojo/util.t#L73
13:02 sri they seem to mutate randomly
13:02 judofyr :(
13:03 spleenjack joined #mojo
13:04 nicomen the boolean module seems to do some overloading on !!1 and !!0 (didn't know that was possible)
13:11 bluescreen joined #mojo
13:15 good_news_everyone joined #mojo
13:15 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/0t2P-Q
13:15 good_news_everyone [mojo/master] removed assigned_as_number and looks_like_bool functions again - Sebastian Riedel
13:15 good_news_everyone left #mojo
13:18 good_news_everyone joined #mojo
13:18 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/41JQlw
13:18 good_news_everyone [mojo/master] fixed Mojo::Util exports - Sebastian Riedel
13:18 good_news_everyone left #mojo
13:20 good_news_everyone joined #mojo
13:20 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/vLSKRw
13:21 good_news_everyone [mojo/master] test tweaks - Sebastian Riedel
13:21 good_news_everyone left #mojo
13:49 ovnimancer joined #mojo
13:49 ovnimancer left #mojo
14:01 GabrielVieira joined #mojo
14:03 sh4 joined #mojo
14:12 gryphon joined #mojo
14:22 dotan joined #mojo
14:24 dotan sri: The JSON module uses \1 for true, \0 for false; Mojo::JSON just stringifies the scalar ref.
14:25 dotan I think it would be worthwhile adding the convention used by the general module to Mojo::JSON
14:25 rem_lex|pivo joined #mojo
14:26 sri dotan: meh, that's pretty underwhelming compared to real booleans
14:28 dotan when you're driving yourself crazy to get perl to talk to your javascript, underwhelming but effective.
14:28 sri afraid i don't understand that sentence
14:28 dotan I think frew (CDBI guy) forked Ext.js to get it to accept the strings "true" and "false"
14:29 arpadszasz joined #mojo
14:30 sri $foo ? "\1" : "\0" is about as shitty as $foo ? Mojo::JSON->true : Mojo::JSON->false
14:30 dotan not "as shitty". Less typing!!!
14:30 sri no
14:31 sri both require a separate helper making them even
14:31 sri bool($foo)
14:31 sri helper bool => sub { pop ? Mojo::JSON->true : Mojo::JSON->false };
14:32 sri "\1" and "\0" don't bring anything new to the table
14:32 inokenty joined #mojo
14:32 sri not to mention perl -E 'say "FAIL!" if "\0"'
14:37 jnap joined #mojo
14:38 knshaum joined #mojo
14:38 cosimo joined #mojo
14:39 sri not to mention this is valid JSON perl -MMojo::JSON -E 'say Mojo::JSON->new->encode({foo => "\0"})'
14:40 dotan "\0" is a string, \0 is a scalar ref.
14:42 sri so which one does it use?
14:43 sri not that it matters much... both are still true values
14:46 dotan a scalar ref isn't a valid value to be serialized as JSON, the JSON module just offers it as a convenient shortcut for JSON::true and JSON::false.
14:51 sri i'm arguing that a) it is not more convenient than true/false methods with a helper and b) that using a true value for false is silly
15:01 labrown joined #mojo
15:13 sri dotan: if you really care about it you're welcome to collect votes
15:21 alester joined #mojo
15:23 dotan sri: here's a gist - https://gist.github.com/3953299
15:24 dotan sri: what I would like is for the last test to pass.
15:25 dotan This would allow users to specify identical input to either JSON
15:25 dotan or Mojo::JSON that would generate proper true and false values in the output.
15:27 judofyr dotan: that's not going to roundtrip though
15:28 pierrick hi everybody, i got a strange issue with mojolicious when i put a . my url, got a 404 when url ends by . and no response when i put a . in middle of url it s better to make a mailing list message or here its ok ? thanks
15:35 judofyr pierrick: see http://mojolicio.us/perldoc/Mojoliciou​s/Guides/Routing#Relaxed_placeholders
15:35 judofyr pierrick: generic placeholders don't accept dots
15:38 pierrick judofyr: ok thanks
15:42 pierrick judofyr: works better with relaxed placeholders :) thanks
15:48 judofyr pierrick: great!
15:51 pierrick judofyr: yes! i read the documentation too fast
15:51 judofyr no worries
16:01 sri dotan: my vote is -1, you'll have to poke marcus, tempire and crab
16:09 pau4o left #mojo
16:15 xaka joined #mojo
16:34 dotan judofyr: the aim isn't to roundtrip, it's to send a json bollean to javascript.
16:40 ZadYree judofyr> pierrick: generic placeholders don't accept dots # About that, I noticed using a wildcard placeholder '(*)' was bugging with dots either. (like in .foo)
16:40 ZadYree any way to redirect every non-defined routes to a page (like the index)
16:40 ZadYree ?
16:44 vervain joined #mojo
17:09 good_news_everyone joined #mojo
17:09 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/rLUX2Q
17:09 good_news_everyone [mojo/master] improved Hypnotoad recipe a bit - Sebastian Riedel
17:09 good_news_everyone left #mojo
17:11 batman joined #mojo
17:23 diegok dotan: didn't know that about JSON module. I prefer to use the method but I don't see problems to have it as scalar ref are not allowed and I like to be able to replace JSON for Mojo::JSON and vice-versa. But still, it looks too hacky :-/
17:24 diegok bool() helper looks much more expressive for an app
17:25 jberger joined #mojo
17:25 jberger sri: hi
17:25 jberger I really don't have much time for a while, but I had one more thought in my mind
17:25 sri jberger: i'm opening a "Future" issue for the escaping thing :)
17:26 jberger sri: thanks
17:26 jberger what if I don't play with _escape, but instead if the sandbox has a function escape then _escape calls it rather than xml_escape
17:26 jberger this preserves the Mojo::ByteStream handling and doesn't expose _escape
17:27 jberger so its closer to your redefinable helper concept
17:27 sri escape helper in the application still breaks it
17:27 jberger except once again its only in the Sandbox namespace
17:27 jberger so no breakage
17:27 jberger unless I am missing something
17:28 sri an application helper called "escape" will redefine the escape function in the sandbox and break all escaping
17:28 sri that's the backcompat issue
17:29 jberger maybe I need to learn how the helpers are exposed to the template
17:29 jberger I think that's where I'm missing the boat
17:30 sri helpers are just a sub foobar {} in the template
17:30 sri every single one of them
17:30 ObseLeTe joined #mojo
17:31 jberger wow
17:31 jberger where does that happen, I don't see it
17:31 jberger or is that not in Mojo::Template
17:32 sri MOJO_TEMPLATE_DEBUG=1 and see for yourself
17:32 jberger (.pm)
17:32 sri EPRenderer
17:32 sri Mojo::Template knows nothing about helpers
17:33 Adurah What kind of flag mutation were you seeing with looks_like_bool?
17:33 jberger sri: gotcha, ok more learning for me
17:33 ObseLeTe joined #mojo
17:34 sri Adurah: perl -MDevel::Peek -E 'Dump !!1; my $foo = !!1; Dump $foo'
17:34 jberger sorry for the noise, its all with good intentions I promise :)
17:34 Adurah Only that?
17:34 sri jberger: no worries
17:35 sri Adurah: "only" :)
17:35 Adurah my $FLAGS = $obj->FLAGS ^ B::SVf_READONLY; ... return !!0 unless $obj->FLAGS & $FLAGS;
17:35 Adurah Until some other test fails.
17:36 Adurah That's compared to your older code, mind you.
17:37 sri there's also PADMY
17:37 sri and on 5.10 PADTMP on the original but not the copied one
17:38 sri completely unreliable
17:39 Adurah So just use... IOK,NOK,POK,pIOK,pNOK,pPOK?
17:40 sri seems too hackish to me
17:40 Adurah It's always seemed hackish.
17:41 Adurah Guess I need to install all the perls via perlbrew.
17:44 jberger sri: last thought, then I have to go: my fear then for the redefinable helper idea is that it would only work when run under EPRenderer and not when used as Mojo::Template in a standalone manner (i.e. not in a webapp)
17:44 jberger just something to keep in mind
17:45 sri jberger: you can always defined a new sub escape {} in your template, or with the ->prepend attribute
17:46 sri s/d//
17:47 sri jberger: thinking about it, there is something else i don't like, escape would be a new special case
17:47 jberger as long as EPRenderer knows not to allow a helper of that name
17:47 ki0_ joined #mojo
17:47 sri that's the new special case
17:48 jberger I like the concept that I was going down before, I really am out of time, but soon I will propose one more thing, like exposing _escape, but not :-)
17:48 jberger cheers
17:48 * jberger goes teachin
17:49 sri this needs to be discussed further before we can add it to the roadmap :o
17:49 sri o/
17:52 sri Adurah: https://gist.github.com/3948157 # hahahahaha
17:52 sri see comments
17:53 Adurah Hmm.
17:54 Adurah Once I get all the perls, I'll figure something out.
17:57 Adurah Or, maybe not...
17:57 Adurah A rare situation where one would do all that to a scalar.
17:59 * tempire bonks sri on the noggin with a sheriff badge for cursing
17:59 * sri cries
18:00 perler joined #mojo
18:02 perler While installing perlbrew I am getting "Can't locate version.pm" error. Any idea of what is happening?
18:03 * marcus shoots the sheriff, and the deputy too.
18:04 Adurah Guess \!!X is the only verifible way, but, messy.
18:05 Adurah All of one's subs  would have to return a ref.
18:06 sri \!!X is the same as \1 and \0 support
18:06 Adurah Yup.
18:06 sri my main problem with that is \0 is true
18:07 sri convenience of \!!$foo is undeniable though
18:09 sri dotan: that's how you sell it :)
18:10 marcus uglyness of \!!$foo  is undeniable too
18:10 Adurah Looks like Perl.
18:10 sri vs $foo ? Mojo::JSON->true ? Mojo::JSON->false
18:12 sri i'm pretty much neutral on it now, with marcus -1 we need more votes
18:19 tempire I don't understand what the drive is
18:20 sri tempire: a) Mojo::JSON->true is hard to type b) generating a boolean based on input data is even harder $foo ? Mojo::JSON->true ? Mojo::JSON->false
18:22 tempire I like Mojo::JSON->true because it's obvious.
18:23 tempire it's a shame that !!$foo doesn't work
18:26 sri http://hastebin.com/raw/qofuduhegu # that would be the patch
18:27 sri i'm still neutral on it though, so whatever you vote happens
18:27 * sri pokes marcus, tempire and crab
18:28 tempire -1
18:29 sri oh, marcus did seem -1-ish before too
18:31 Adurah Why \1 instead of \!!1? You can actually confirm sv_yes in the latter.
18:31 sri Adurah: \!!1 is also supported and tested
18:31 * sri bonks Adurah on the noggin
18:32 sri in case this wasn't clear
18:32 sri the patch is for \1, \0 and \!!$foo
18:32 Adurah Hmmkay.
18:32 sri you can turn any arbitraty value into a Mojo::JSON boolean
18:33 Adurah Ah, ${B::svref_2object(\!!$num) does give you 2/3.
18:43 rem_lex joined #mojo
18:43 sri oh
18:44 sri actually even \$foo works :)
18:44 * sri pokes tempire
18:44 sri update!
18:46 sri $self->render(json => {foo => \$foo}); # boolean based on value of $foo
18:47 sri and marcus!
19:00 kthakore ping sri
19:05 kthakore sri: you think I could run mojolicious on perldroid (perl for Android) ?
19:06 marcus sri: seems ok
19:07 kthakore marcus: plausible?
19:07 marcus kthakore: when I checked a long time ago, it had very broken unicode
19:07 kthakore perl 5.16.0 came out recently
19:07 kthakore on perldroid
19:11 tempire \$foo++
19:11 kthakore hi tempire
19:11 tempire hello
19:11 kthakore whats \$foo++ ?
19:12 sri o/
19:12 kthakore \o
19:12 * sri wishes folks would just say +1 or -1
19:13 kthakore I am considering making a andorid tablet app that will run a server over the hotspot to collect research data.
19:13 Adurah perl -MB -e 'use feature qw(:5.10); say ${B::svref_2object(\!!0)}; sub b { !!0 } say ${B::svref_2object(\!!0)}' # Isn't 3 3 on Strawberry... hm.
19:13 sri last i heard android perl sucks, no Encode and stuff like that
19:13 kthakore wanna run mojo but might have to use mongoose (C web library)
19:14 Adurah The wonders of Win32 perl.
19:14 sri oh, yea, what marcus said :)
19:15 kthakore ah oh well
19:15 sri but it was like years ago
19:15 sri then again... android folks don't upgrade as often i heard too
19:20 Mike-PerlRecruiter_ joined #mojo
19:21 kthakore ok
19:33 asarch joined #mojo
19:38 good_news_everyone joined #mojo
19:38 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/0-l2TQ
19:38 good_news_everyone [mojo/master] added boolean shortcut support to Mojo::JSON - Sebastian Riedel
19:38 good_news_everyone left #mojo
19:38 sri if interpret marcus and tempire right, the patch was at +2
19:38 sri *+i
19:39 marcus mm
19:51 Adura joined #mojo
20:00 sri mmm
20:04 Polarn joined #mojo
20:11 marcus mmmm
20:16 perlite joined #mojo
20:18 sri mmmmm
20:19 tempire mmmmmm?
20:20 marcus mmmmmmm!
20:24 xaka joined #mojo
20:28 lukep joined #mojo
20:31 ki0 joined #mojo
20:39 jberger o/ (as seems to be the custom around here)
20:39 marcus \o
20:39 jberger sri: rather than submit another pull request, may I direct your attention to my fork: https://github.com/jberger/mojo/commit/5​cdb8d2cea902b88c489372258ccefc2ad6397ab
20:39 marcus jberger: I like your CMS
20:39 jberger marcus: thanks
20:40 jberger its really rough
20:40 jberger I need to find someone with some prettifying ability
20:40 marcus jberger: I was wondering, is there a way to stuff pure html into pages?
20:40 marcus jberger: like, I wanted to put a google maps embed on a page.
20:40 jberger IIRC markdown will pass html though it
20:41 jberger then again, perhaps the sanitizer blocks it
20:41 marty_ joined #mojo
20:41 marcus jberger: yeah, it probably does
20:42 marcus jberger: why do I need to santize the markup for my own site?
20:42 sri jberger: i like the direction, not the implementation
20:42 marcus can it be disabled?
20:42 jberger sri: hey I'll take that
20:42 jberger :-)
20:42 sri jberger: btw. i very much prefer being poked here over pull requests out of the blue ;)
20:42 jberger sri: yeah, my bad
20:43 sri so much nicer to discuss a change on irc
20:43 jberger marcus: yeah, though I haven't exposed that
20:43 jberger my concept for Galileo has been that I can set it up and let a non-technical user run it
20:44 jberger so I was being safe, but yeah, I could allow a per-page option for santizer or something
20:44 jberger sri: indeed\
20:45 jberger sri: I know that you string eval in Mojo::Base for speed, but in Mojo::Template you will need string eval for the template, do you also expect speed from it?
20:46 jberger I ask because perhaps the _escape sub could be globref injected in either case
20:46 sri i was just thinking the same :)
20:46 sri "why the hell is _escape a string eval?"
20:47 sri injecting should actually even be faster
20:47 jberger I think having a subref as the escape attribute is the least surprising (POLS)
20:47 sri agree
20:47 jberger rather than a string of perl code to be eval'ed
20:47 jberger cool
20:47 sri i'd like the most minimalistic implementation possible of that :)
20:47 * jberger works
20:48 marty joined #mojo
20:48 jberger its easy if we want to just make a ref to sub { Mojo::Util::xml_escape("$_[0]") }
20:49 jberger but then its a closure when it needn't be
20:49 jberger I don't know about the speed implication of that
20:49 sri right, double closure costs a bit
20:50 sri a quick benchmark may be in order
20:51 * sri actually has no idea how much a closure really costs these days... it's usually just method lookups killing performance
20:52 ki0 joined #mojo
20:55 jberger https://github.com/jberger/mojo/bl​ob/afd416c02a9cc3dd30a7d76a3c6d792​ddbd84e32/lib/Mojo/Template.pm#L96
20:56 jberger this is the minimalistic approach
20:56 jberger it could probably be faster if the default $escape was sub { goto &Mojo::Util::xml_escape }
20:56 jberger but I wasn't sure if you like that or not
20:57 jberger saves setting up an additional stack
20:58 jberger wait, nm I can do better
20:59 sri jberger: i like that
20:59 sri stringification is wrong though
20:59 sri $escape->("$_[0]");
21:00 sri that's why the "no warnings 'uninitialized';" is there
21:00 jberger oh, I thought it was for the ref check
21:00 sri some tests should complain
21:00 sri ref works on undef :)
21:01 jberger eq doesn't thoguh
21:01 sri ref returns an empty string
21:01 * sri loves that about ref
21:03 * jberger wonders if I have been doing that wrong all these years
21:03 jberger https://github.com/jberger/mojo/bl​ob/44ab30f68567722447df6b493d904c7​84a6dfac3/lib/Mojo/Template.pm#L96
21:03 jberger a slightly different approach
21:03 jberger which did you like better?
21:04 sri not sure
21:05 sri .oO(has escape => \&Mojo::Util::xml_escape;)
21:06 jberger nice
21:06 sri no wait, it needs to be wrapped
21:06 sri has escape => sub { \&Mojo::Util::xml_escape };
21:07 sri think i'll do some testing later too, the solution is already good enough imo
21:07 jberger in case Mojo::Util::xml_escape is redefined
21:07 jberger ?
21:07 jberger oh
21:07 sri if default value is a closure it gets called by Mojo::Base
21:07 jberger no I got it, because Mojo::Base will see it as a code ref and deref it to get the default, which will make no sense
21:07 sri yea
21:08 jberger all thats left then is, you might think about turning the bare block into an if block like:
21:08 jberger if ($self->namespace->can('_escape')) {
21:09 jberger to save on the redefinitions
21:09 jberger but perhaps you want the redefinitions
21:09 sri oh, interesting question
21:11 jberger the current behavior would be to redefine
21:11 jberger but is that needed?
21:11 sri shared namespaces could have funny side effects with both solutions
21:12 sri although we kinda already have that with helpers...
21:12 jberger (also now my added test to see if _escape is in the eval string is pointless)
21:12 sri don't worry about little details, i will clean up anyway, just look for bigger design flaws :)
21:13 jberger for my LaTeX handler I will use a different namespace
21:13 jberger just for safe keeping
21:13 sri i think a note in the escape pod will do
21:13 jberger like "don't define a helper named _escape"
21:14 sri hmm, perhaps a note for the namespace attribute :)
21:14 sri it's a bigger problem
21:14 jberger but one that has always existed
21:14 sri "Don't reuse namespaces"
21:14 marty joined #mojo
21:14 jberger oh right
21:15 sri yeye, it's nothing new
21:15 jberger "a different namespace if recommended if you monkey around with things too much"
21:15 * sri nods
21:16 jberger well its all in the benchmarks now I guess, there are a few different options
21:16 jberger goto $subref might help there
21:20 sri i hope that doesn't make much of a difference, i hate messing with the callstack
21:22 jberger https://github.com/jberger/mojo/commit/a​bd72eaba531980bcdcd66434eef004b74102e3c
21:24 jberger I think of goto $subref as a way of handling dispatch, the only reason this isn't purely dispatch is because it skips ByteStream objects, but otherwise its true
21:25 jberger remember the user doesn't know that they are calling Mojo::Template::Sandbox::_escape
21:25 jberger they think they are calling Mojo::Util::xml_escape or whatever
21:25 jberger but this is DEFINITELY up to you
21:26 jberger thats just the way I think about it, whenever this comes up in my projects
21:31 jberger that latest link I sent allows this update of my old gist to work:https://gist.github.com/3913017
21:33 * sri starts merging
21:39 JiYu joined #mojo
21:40 good_news_everyone joined #mojo
21:40 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/h5g1EA
21:40 good_news_everyone [mojo/master] added escape attribute to Mojo::Template - Sebastian Riedel
21:40 good_news_everyone left #mojo
21:40 sri jberger++
21:40 sri everything else is optimization
21:40 jberger excellent! and you are happy with that?
21:41 sri yea, this solution feels right
21:41 jberger assuming benchmarks perform adaquately
21:41 jberger cool
21:41 * jberger give sri a high five
21:41 sri o/
21:41 jberger \o
21:45 jberger you know why you don't want goto $escape ... you need to stringify $_[0]
21:45 jberger so thats settled
21:47 good_news_everyone joined #mojo
21:47 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/1LaFlQ
21:47 good_news_everyone [mojo/master] mention that namespaces should only be shared very carefully - Sebastian Riedel
21:47 good_news_everyone left #mojo
21:49 ki0 joined #mojo
21:49 * sri would really like to split up Mojo::Template->build a bit
21:50 jberger I can see that, though for as long as build is, there are already several method names to worry about, I'm assuming the splitup would be into several private methods?
21:51 sri of course
21:51 * jberger nods
21:52 sri parse and build there are the longest methods in mojolicious
21:53 jberger does build even need to be a public method?
21:53 sri don't think so, but by now there surely are folks that rely on it
21:57 jberger anyway, its been fun! I'm off to Chicago.pm now, so I guess I have something to talk about tonight
21:57 sri \o/
21:57 jberger gonna be a busy night, scripting git
21:58 jberger o/
21:59 good_news_everyone joined #mojo
21:59 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/7b7Bkw
21:59 good_news_everyone [mojo/master] split up build method in Mojo::Template - Sebastian Riedel
21:59 good_news_everyone left #mojo
22:00 gryphon joined #mojo
22:02 good_news_everyone joined #mojo
22:02 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/hwP9MA
22:02 good_news_everyone [mojo/master] renamed _lines to _wrap - Sebastian Riedel
22:02 good_news_everyone left #mojo
22:24 ki0 joined #mojo
22:37 jzawodn joined #mojo
22:44 ki0 joined #mojo
22:51 duncanthrax_work joined #mojo
23:24 ki0 joined #mojo
23:45 good_news_everyone joined #mojo
23:45 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/JzwFcg
23:45 good_news_everyone [mojo/master] added max_buffer_size attribute and is_limit_exceeded method to Mojo::Content - Sebastian Riedel
23:45 good_news_everyone left #mojo
23:45 sri a little more security
23:52 good_news_everyone joined #mojo
23:52 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/-67fTQ
23:52 good_news_everyone [mojo/master] finish content if buffer limit is exceeded - Sebastian Riedel
23:52 good_news_everyone left #mojo
23:55 * tempire octaves
23:55 * tempire plots

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