Camelia, the Perl 6 bug

IRC log for #mojo, 2013-09-22

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

All times shown according to UTC.

Time Nick Message
01:01 hrupp1 joined #mojo
01:28 perlite joined #mojo
02:56 Liam` joined #mojo
03:52 TheCrimsonRadish joined #mojo
03:59 preflex_ joined #mojo
04:02 TheCrimsonRadish joined #mojo
04:02 TheCrimsonRadish joined #mojo
04:26 hesperaux__ joined #mojo
04:37 jnbek joined #mojo
04:41 mattp joined #mojo
05:07 basic6 joined #mojo
05:09 dotandimet joined #mojo
05:15 hesperaux__ joined #mojo
05:41 d4rkie joined #mojo
05:42 d4rkie joined #mojo
06:42 denisboyun joined #mojo
07:18 Vandal joined #mojo
07:30 jamadam joined #mojo
07:37 n0n joined #mojo
07:42 hesperaux__ joined #mojo
07:58 sh4 joined #mojo
08:09 hesperaux__ joined #mojo
08:19 MisterHatt left #mojo
08:21 yakudza joined #mojo
08:51 KindOne joined #mojo
08:52 n0n joined #mojo
09:17 dotan joined #mojo
09:36 basiliscos joined #mojo
09:51 hummeleBop joined #mojo
10:59 tokuhirom joined #mojo
11:22 Vandal joined #mojo
11:25 mire__ joined #mojo
12:07 mire_ joined #mojo
12:39 denisboyun joined #mojo
13:17 mib_v720te joined #mojo
13:20 dqw5 joined #mojo
13:40 gtodd this is nice ...  -->  Dancer::Plugin::Auth::Extensible  are auth plugins the way to do this for mojo ?
13:42 gtodd ...  https://metacpan.org/release/​Dancer-Plugin-Auth-Extensible
14:06 gryphon joined #mojo
14:41 dotandimet joined #mojo
14:44 zivester joined #mojo
14:54 sh3 joined #mojo
14:55 memowe \o/
15:13 dvinciguerra joined #mojo
15:20 rem_lex|pivo joined #mojo
15:36 basic6 joined #mojo
16:01 howitdo joined #mojo
16:02 denis_boyun joined #mojo
16:08 rem_lex joined #mojo
16:20 dotandimet joined #mojo
16:24 dqw5 joined #mojo
16:52 TheCrimsonRadish joined #mojo
17:15 mire_ joined #mojo
17:21 howitdo joined #mojo
17:27 yakudza joined #mojo
17:41 denis_boyun joined #mojo
18:36 denis_boyun joined #mojo
18:55 iloveyou joined #mojo
18:56 iloveyou I have a mojo lite app and I have a public folder with some static reports. From my mojo script (not EP template) I seem to need to access the files with the absolute path. I figured I could do 'reports/blah.json'
18:57 iloveyou Since it is in the public/reports folder, I would assume then that Mojo would automatically check templates / public folders.
19:08 iloveyou By the way, to the mojo team I just want to say that I really like Mojo framework and I appreciate all the hard work you all are putting into this. It's awesome.
19:09 iloveyou one last question, is there any way to decode a JSON file into a Perl data structure? Something like $json->decode("/path/to/file.json");
19:14 iloveyou I was trying this, my $out = {}; push @{ $out }. @{ $json->decode( read_file("/tmp/test.json") ) }; $self->render( json => \$out );, but that doesn't work
19:18 k0xa joined #mojo
19:22 k0xa Hey guys! Does anyone know how to extract URI part from URL, I thought to_rel() func could do it, but it's useless. http://pastebin.com/ispm8g8F
19:23 k0xa Could Mojo::URL do that?
19:27 good_news_everyone joined #mojo
19:27 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/kJdBWg
19:27 good_news_everyone mojo/master ca2aa4c Sebastian Riedel: added a few Mojo::URL examples
19:27 good_news_everyone left #mojo
19:30 sri k0xa: starting by saying something is useless generally doesn't make people want to help you
19:30 iloveyou k0xa, I can accomplish what you're attempting to do with $url->path;
19:31 k0xa sorry, English is not my native lang
19:31 bowtie_ joined #mojo
19:31 iloveyou Actually, my bad... it cuts everything after the ?
19:32 k0xa iloveyou, yes, it does so..
19:35 k0xa some examples appeared on GitHub, thanks to Sebastian
19:37 iloveyou right on
19:37 iloveyou I was trying to figure it out
19:39 sri if you still think something doesn't work as it should, please point at the appropriate spec sections
19:40 iloveyou Hey sri, are there any examples of how to read a JSON file into a perl data structure?
19:40 iloveyou Perl*
19:40 sri iloveyou: i don't understand the problem
19:41 tianon Mojo::Util::slurp ?
19:41 iloveyou push @{$uuts->{aaData}}, @{ decode_json( read_file("/tmp/file.json") ) };Is an example using JSON::XS and File::Slurp.
19:42 iloveyou Basically, I am loading a bunch of JSON files from a directory and pushing that into $uuts->{aaData}.
19:42 sri Mojo::JSON is no different, as long as read_file doesn't mess with the encoding
19:43 iloveyou Interesting. Alright, I will continue messing with it, because I am not getting the expected results (works with CGI + JSON::XS, prints "false" using Mojo::JSON).
19:44 iloveyou I'm probably doing something wrong.
19:44 sri why are you passing a reference to a reference to render(json => ...)?
19:44 asarch joined #mojo
19:44 iloveyou Actually, that line results in "Not an ARRAY reference"
19:45 sri you're doing some very weird stuff there
19:45 iloveyou It's cool, I am learning this stuff. I will continue trying to figure it out.
19:45 iloveyou If anyone helps me I won't retain it, so better of working on it on my own.
19:45 iloveyou I am :)
19:47 sri hmmm... now that we have native JSON support for WebSockets i suppose we could make Mojo::JSON::j die on errors
19:48 sri jberger, tempire, marcus, crab: opinions?
19:49 sri the only argument against it so far was the use with websockets... which became a non-issue in 4.0
19:50 marcus sri: +1
19:50 marcus (I think I brought it up in the first place :)
19:50 sri hmm, just noticed the current behavior is documented
19:51 sri and tested
19:51 sri so it's a feature :(
19:51 marcus sigh
19:51 sri i don't really see a deprecation path
19:51 marcus me neither
19:52 marcus maybe ->J
19:52 marcus but heh
19:53 sri we don't do upper case function names
19:53 marcus yeah, I don't think it's worth touching it
19:54 sri only jberger uses it on cpan in Galileo, and only for encoding, not decoding
19:56 sri first time we are really trapped by the deprecation policy, too bad this has been overlooked in 4.0 :(
19:56 sri everyone--
19:56 marcus I actually discussed mojo with someone this weekend who's waiting for it to become more stable.
19:57 marcus I told him to not count on it as long as we keep developing it.
19:57 sri mojolicious has been pretty damn stable recently
19:57 marcus yeah, my point
19:57 marcus there's only like two deprecations since 4.0
19:58 marcus and I don't think it will ever be zero
19:59 marcus Strider is pretty neat btw.
19:59 marcus Setting it up now for smoking our private projects
20:16 denis_boyun joined #mojo
20:18 dotandimet joined #mojo
20:22 d4rkie joined #mojo
20:28 k0xa Hey sri, maybe we need a shortcut/attribute in Mojo::URL for URI part? Acessing it via $url->to_rel(Mojo::URL->new('http://'.$url->host)) is not so beautiful as $url->uri, IMO. I think access to URI is a very common task
20:31 sri URI doesn't mean what you think it means
20:34 sri before you make any proposals, please read the specs and make proposals based on them
20:34 sri specifically http://www.ietf.org/rfc/rfc3986.txt and http://url.spec.whatwg.org
20:35 k0xa u'r right, my bad.
20:35 sri i'm not opposed to making changes... but even for small ones there is *a lot* to consider
20:37 k0xa I meant 'path'+'query'+'#fragment (if present)', it's same as web pass to GET request
20:37 k0xa we*
20:38 iloveyou So, this works with JSON::XS, my $out = json_decode( read_file("/tmp/json.pl") ); print Dumper $out;
20:39 iloveyou However, doing it with Mojo::JSON prints undef: my $json = Mojo::JSON->new; my $out = $json->decode( read_file("/tmp/file.json") ); print Dumper $out;
20:39 iloveyou in the JSON::XS example s/json.pl/file.json/
20:39 sri warn $json->error
20:41 k0xa Mojo::UserAgent is really cool library for writing crawlers, thanks by the way, I'm migrating to it from AnyEvent::HTTP
20:42 sri k0xa: btw. you not quite right, the fragment is not passed for GET requests
20:43 k0xa sri, yes, I know that, but I need this fragment, because my spider needs to extract links from a web page, then turn them into relative ones, saving #fragment (I used to call it 'hash') at the end
20:44 sri the logic is here btw. moving some of it back to Mojo::URL and making it easier to test might be a good idea, and an angle to make me accept a patch https://github.com/kraih/mojo/blob/ma​ster/lib/Mojo/Message/Request.pm#L99
20:47 iloveyou "Malformed JSON: Expected string while parsing object before end of data"... Odd that JSON::XS has no issues with the file, and even using JSON data from a JSON example on http://json.org/example.html results in the same error.
20:50 asarch joined #mojo
20:50 iloveyou my $json = Mojo::JSON->new; my $out = $json->decode(read_file("/tmp/test.json")); warn $json->error; print Dumper $out; and this JSON: http://pastebin.com/pstC6VPM
20:50 memowe iloveyou: what a beautiful nickname!
20:52 iloveyou memowe, I happen to like yours as well. Adventure Time :)
20:52 sri iloveyou: like i said before, almost certainly an encoding issue, JSON::XS is not as strict as Mojo::JSON
20:52 iloveyou Hm, an encoding issue with the JSON example pulled from json.org?
20:52 sri i think File::Slurp does decoding shenenigans by default, just use Mojo::Util::slurp
20:53 iloveyou ohh, alright, let me try that
20:53 sri Mojo::JSON only accept bytes, no characters
20:55 iloveyou Now results in this error "Use of uninitialized value in warn at /tmp/test.pl line 13. Warning: something's wrong at /tmp/test.pl line 13." but I am getting the desired output
20:55 iloveyou YES!
20:57 iloveyou Awesome. The documentation is great, but there's a lot to learn. Did not know about Mojo::Util::Slurp
20:57 iloveyou Well, except that someone mentioned it above and I continued on the wrong path anyway.
21:00 * sri finds File::Slurp annoying, when i slurp a file i want the exact same thing that was stored on disk... no auto magic decoding
21:05 tianon sri's own ways ftw - always working best :)
21:05 tianon Mojo::Util <3
21:10 good_news_everyone joined #mojo
21:10 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/NBJhHw
21:10 good_news_everyone mojo/master cb24ea6 Sebastian Riedel: more Mojo::URL examples
21:10 good_news_everyone left #mojo
21:12 sri oh, we've reached 10k tests again \o/
21:18 denisboyun joined #mojo
21:27 good_news_everyone joined #mojo
21:27 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/3s_f3A
21:27 good_news_everyone mojo/master 7bb3556 Sebastian Riedel: slurp and spurt work with bytes
21:27 good_news_everyone left #mojo
23:26 basiliscos joined #mojo

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