Camelia, the Perl 6 bug

IRC log for #mojo, 2013-02-24

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

All times shown according to UTC.

Time Nick Message
00:05 kthakore oh hai sri
00:27 basic6 joined #mojo
00:44 basic6 joined #mojo
00:54 basic6 joined #mojo
01:06 jeen joined #mojo
01:13 btyler joined #mojo
01:21 jeen joined #mojo
01:32 basic6 joined #mojo
01:56 jeen joined #mojo
02:08 basic6 joined #mojo
02:32 fotodigital joined #mojo
02:33 btyler joined #mojo
02:47 ka2u joined #mojo
02:54 btyler joined #mojo
03:14 marty_ joined #mojo
03:18 jwang joined #mojo
03:55 jberger sri: o/
03:56 jberger remember when I was on about websocket testing
03:56 jberger there was still one more thing I would have liked, but we couldn't settle on an implementation
03:56 jberger for every message you still can only run one test
03:57 jberger if I need to check that a number in a json message is in a certain range, I can't do it
03:57 jberger I was focusing on how to get the message out, but I think I have something better now
03:58 jberger https://gist.github.com/jberger/5022507
04:02 jberger its a VERY preliminary implementation
04:02 jberger I might want to use the proper Test::More::subtest
04:10 jberger I'm leaning towards thinking that this syntax is cleaner
04:11 jberger (than using Test::More::subtest)
04:30 ka2u joined #mojo
04:36 lukep joined #mojo
04:40 preflex_ joined #mojo
05:00 mattastrophe joined #mojo
05:18 asarch joined #mojo
05:30 fotodigital joined #mojo
05:59 dotandimet joined #mojo
06:15 Vandal joined #mojo
06:44 laouji joined #mojo
06:50 mattastrophe joined #mojo
07:07 Mike-PerlRecruiter_ joined #mojo
07:11 marcus jberger_: maybe make it more generic? like ->test_message(sub { my ($t,$msg), ...  }) - then you could deserialize it any way you like.
07:12 jzawodn joined #mojo
07:42 ladnaV joined #mojo
07:48 dod joined #mojo
07:48 dotan joined #mojo
07:50 Vandal joined #mojo
07:56 sh4 joined #mojo
07:58 fotodigital joined #mojo
08:04 ladnaV joined #mojo
08:16 dod joined #mojo
08:17 basiliscos joined #mojo
08:29 d4rkie joined #mojo
08:30 d4rkie joined #mojo
08:38 Britzel joined #mojo
09:17 rihegher joined #mojo
09:17 rihegher left #mojo
09:40 bayashi_ joined #mojo
09:41 jeen joined #mojo
09:41 Vandal joined #mojo
09:46 berov joined #mojo
09:46 ladnaV joined #mojo
09:50 basic6 joined #mojo
09:51 Vandal joined #mojo
09:53 ladnaV joined #mojo
10:00 nelio joined #mojo
10:15 nelio joined #mojo
10:24 ynonperek joined #mojo
10:36 dhg joined #mojo
10:45 Britzel joined #mojo
10:47 jeen joined #mojo
10:48 dpetrov_ joined #mojo
10:51 jeen_ joined #mojo
11:14 d4rkie joined #mojo
11:22 dhg joined #mojo
11:25 lammel2 joined #mojo
11:39 ObseLeTe joined #mojo
11:52 mattastrophe joined #mojo
12:06 jeen joined #mojo
12:19 kitt_vl joined #mojo
12:27 mire_ joined #mojo
12:28 jeen joined #mojo
12:31 TitanOfOld joined #mojo
12:36 Vandal joined #mojo
12:41 mire__ joined #mojo
12:47 Vandal joined #mojo
12:55 ladnaV joined #mojo
13:26 sri jberger, marcus: you're wasting your time, the feature already exists
13:27 sri http://mojolicio.us/perldoc/Test/Mojo#message_ok
13:28 sri why doesn't anyone look at the documentation?
13:50 berov joined #mojo
13:50 Britzel_ joined #mojo
14:06 Vandal joined #mojo
14:13 sri you can even run multiple tests on a custom message http://mojolicio.us/perldoc/Test/Mojo#message
14:15 * jberger facepalm
14:15 marty joined #mojo
14:16 * jberger claims temporary insanity
14:16 sri :)
14:16 * jberger now understands how Test::More::subtest works
14:17 jberger so thats a silver lining
14:19 jberger I'm not totally incorrect though, there's no easy way to check that a number is in a range
14:19 jberger there isn't json_message_like
14:19 jberger I think my idea still has value
14:20 jberger just not as much as I thought it had
14:20 jeen joined #mojo
14:22 jberger no I mean, this is still possible
14:22 jberger ok
14:22 jberger I conceed
14:25 jberger ----------------
14:25 jberger ok I'm making my websocket example plotting live data from the server
14:25 jberger for my chicago.pm talk
14:25 jberger here is the test: https://github.com/jberger/WCpm-Moj​olicious/blob/master/ex/websocket.t
14:26 jberger what I would like to do is check that the response array's second value is between -2 and 2
14:27 jberger I guess in the real world I wouldn't test this from the websocket anyway, it should probably be a model-layer test
14:27 jberger anyway that was what got me going down the road I was on
14:29 gryphon joined #mojo
14:31 jberger marcus: you basically can do that if you end the chain and get the raw message from the $t->message attribute
14:31 jberger but then you have to understand how the frame works
14:31 jberger which is not all that onerous
14:31 jberger sri: you know what, this all uses public api
14:32 jberger this should be an extension module!
14:32 jberger Test::Mojo::More or something
14:32 jberger no need for it to be in core
14:42 d4rkie joined #mojo
14:47 dpetrov_ joined #mojo
14:59 d4rkie joined #mojo
15:10 ynonperek Hi,
15:11 ynonperek do you guys know if/how Mojo and Pocjket::IO play together /
15:11 ynonperek ?
15:11 ladnaV joined #mojo
15:12 lammel2 joined #mojo
15:19 tempire joined #mojo
15:44 yakudza joined #mojo
16:00 human39 joined #mojo
16:07 BeDa joined #mojo
16:14 andrefs joined #mojo
16:21 btyler joined #mojo
16:27 marty ynonperek:  http://irclog.perlgeek.de/​mojo/2013-02-20#i_6478036
16:39 sh4 joined #mojo
16:41 fotodigital joined #mojo
16:57 bpmedley_ joined #mojo
17:03 jberger marty++
17:16 sri jberger: don't forget json_like
17:16 sri if you do json_message_like
17:17 sri not that i have any idea what those methods would do :)
17:17 sri json_is is a wrapper around is_deeply
17:17 jberger sri: they would take a pointer and a qr
17:20 jberger makes sense to me
17:20 jberger :-)
17:23 sri dunno, seems awkward to me, all json tests are structure tests usually
17:27 jberger I won't be able to get to it for a while anyway, I'll let it percolate through the gray matter for a while
17:28 sri maybe a good idea, i'm not entirely opposed to it, just feels awkward
17:28 sri maybe tempire, marcus or crab have an opinion too?
17:30 jberger http://joel.phy.uic.edu:3000/10
17:32 sri looks good
17:32 jberger you said you expected a websocket example ;-)
17:32 sri shorter than i expected
17:33 sri you have no on(finish => ...) though
17:33 sri the example will explode if the connection closes ;p
17:34 sri (you have to drop the recurring timer in the finish event)
17:34 jberger oh, yeah thats probably true
17:34 jberger I'll just mention that verbally
17:34 jberger or ...
17:34 jberger hmm
17:35 sri one of the most annoying things about PSGI streaming, there is no signal when a connection get closed, so appreciate that mojolicious feature ;)
17:35 jberger is there a good way to kill the recurring?
17:35 * jberger looks
17:36 sri it returns its id
17:36 jberger oh ok
17:36 sri Mojo::IOLoop->remove($id)
17:36 jberger that sounds doable
17:38 jberger updated
17:40 sri the first incarnation of Mojo::IOLoop actually tied timers to connections... it was convenient but not very versatile :)
17:41 sri i suppose that could be a plugin now
17:41 jberger other than a mention of commands I think the talk is about finished
17:41 sri $self->connection_timer(5 => sub {...}); and it gets cleaned up automatically if the connection dies
17:42 jberger can you think of any major feature that I haven't at least glanced on?
17:42 sri lets see
17:42 jberger you can use arrow keys/page keys to navigate too
17:45 jberger there are some things, like template blocks which would be nice, but it doesn't really fit in the narrative
17:46 sri i guess you have the biggest features covered
17:46 sri yea, indented perl lines also don't get enough love ;)
17:46 sri that's usually one of the things people coming from Mason love
17:47 jberger I will glow for a minute about Mojo::Template on the second example
17:47 sri commands and oneliners are the only bigger features that come to mind atm
17:47 jberger I'm going to demo the first example as a one liner
17:48 jberger and I'm going to add a slide about the commands system
17:48 sri ah, then you can cover commands at the same time
17:48 sri get with css selectors impresses people usually
17:49 jberger I will also show the routes command at least once
17:49 jberger I'm also going to mention Galileo's db admin commands that I added via the pluggable commands system
17:52 jberger all the examples shown except the first are live rendered server side from the examples folder
17:52 jberger so the code I run when I demo each one is actually the code I showed
17:52 jberger <3 my ppi plugin
17:52 sri stuff like this usually impresses people the most :)
17:53 sri mojo get www.reddit.com/r/perl/ 'p.title > a.title' text
17:53 * jberger copies that
17:54 jberger nice example!
17:54 sri the get command was made to run against your apps, because debugging html pages sucks
17:54 sri ./myapp.pl get / title text
17:54 jberger that was what I was (and will) show
17:54 sri you grab only the parts you're debugging
17:54 jberger perl ex/hello.pl / p 1
17:54 jberger show the time
17:55 * sri nods
17:55 jberger the problem with the place we meet is that the internet sucks
17:56 jberger actually it doesn't exist, so people open their phones for others to use
17:56 jberger so I want to be sure that all my examples are self-contained, at least for the most part
17:56 jberger but that doesn't mean that I can't show off some others for later
17:58 sri damn, that reddit example is from 2011... time flies
17:59 sri that was mojolicious 1.2 or so :o
17:59 jberger still works
18:01 sri jberger: you're not showing user agent generators btw
18:01 sri sending json might be something to show off too
18:02 sri or at least a form
18:03 * sri is really happy with how generators are working out
18:04 jberger yeah, maybe I could make a form/test example
18:04 jberger show off a lot of the tag helpers in the app
18:04 jberger then use the generator to test it
18:05 sri if your audience knows a bit about non-blocking code (and callback hell), it might be worth considering a delay example too :)
18:05 sri https://github.com/kraih/mango/​blob/master/t/connection.t#L65
18:05 jberger oh on that note
18:06 jberger I haven't had a chance to test it yet
18:06 jberger I'm on my 32 bit perl here
18:06 jberger https://gist.github.com/jberger/5017886
18:07 jberger but this was my fully non-blocking workup of the message buffer from the other day
18:07 ObseLeTe joined #mojo
18:08 jberger who knows if I've done it correctly
18:08 jberger there are a few steps that don't need ->begin exactly
18:08 sri jberger: the first argument is wrong
18:08 jberger but to pass args to the next step ...
18:08 sri the ->begin callback chops off the invocant
18:09 sri my ($delay, $db, $err, $names) = @_; should be my ($delay, $err, $names) = @_;
18:09 jberger oh
18:09 jberger ok
18:10 jberger what if I want it? like later down I want the $coll
18:11 * jberger gets so lost in all this
18:11 jberger I really shouldn't have shown this until I had a chance to try it
18:11 jberger :-P
18:11 sri then you ->end the delay manually and pass all the argument you like
18:11 jberger k
18:11 jberger its been a good introduction to this stuff though
18:11 jberger makes my brain think in that way
18:12 sri sub { $delay->end(@_) }
18:12 ObseLeTe joined #mojo
18:12 sri it's trivial
18:12 Vandal joined #mojo
18:12 jberger cool
18:12 jberger I will remember that
18:13 jberger I really  can't imagine trying to do this with nested callbacks though
18:13 sri or even my $end = $delay->begin; ... sub { $end->(undef, @_) }
18:13 sri :)
18:14 jberger which I started, but immediately saw that it would be next to impossible to understant
18:14 jberger d
18:14 sri if you want the order preserving properties of the callback
18:14 sri nested callbacks suck
18:15 jberger mojolicious += 3
18:15 jberger I think thats worth 3
18:15 sri indubitably
18:15 sri actually
18:16 sri marcus++ # i believe
18:16 sri judofyr++ # too
18:16 jberger (i was counting on mojolicious to share the score obviously) :-)
18:17 jberger OH its a login form!
18:17 jberger then I can show sessions too
18:18 * jberger is back on the generator example
18:19 dotandimet joined #mojo
18:20 nelio joined #mojo
18:21 jeen joined #mojo
18:24 tempire Hmm
18:24 tempire so who is writing the TOML perl implementation
18:30 ladnaV joined #mojo
18:36 mattastrophe joined #mojo
18:37 sri tempire: i liked it until i saw native date type
18:37 Vandal joined #mojo
18:48 sri some of the TOML issues are hilarious, this is why design by committee doesn't work :)
18:48 sri https://github.com/mojombo/toml/issues
18:49 sri lets add a special ip address type it's easy!
18:49 sri because ip addresses don't come in a million different forms that all need to be special cased
18:50 sri oh and file inclusion, because portability is easy!
18:53 dotandimet joined #mojo
18:58 jeen joined #mojo
19:08 Mike-PerlRecruiter_ joined #mojo
19:11 sri lets try base64 encoding for bson binary data in json https://github.com/kraih/mango/commit/5​f3ea63a5e783cc2fe81d6207d8e18d294dff60b
19:11 btyler joined #mojo
19:14 sri should be conventient with window.atob()
19:26 dotandimet anyone there? is there a simple way to write the paths to my static files so that they work when my app is detoured with Mojolicious::Plugin::Mount ?
19:30 jberger dotandimet, I would be interested in that too
19:31 sri what's the question exactly?
19:32 sri what is "write the paths to my static files"?
19:32 jberger rephrased, can you use url_for pointing to a static file?
19:33 sri of course
19:33 jberger then dotandimet that's how you would do it
19:33 dotandimet something with push app->static->paths, let me try...
19:34 dotandimet I've got an app with a template with links to js and css files in it's public dir.
19:34 jberger dotandimet, use url_for to generate the url to your static files
19:34 dotandimet I want to mount it under /slides in another app.
19:35 jberger %= javascript url_for 'myfile.js'
19:39 sri jberger: javascript '/myfile.js'
19:39 sri those helpers use url_for
19:39 jberger and if you detour the app under '/myapp' you would get '/myapp/myfile.js'
19:39 jberger ?
19:40 sri i'd use a / before the path so there's no chance it conflicts with a named route
19:40 dotandimet Jberger, you're too smart for me. I'm just doing $self->plugin('Mount' => '/path/to/other/script'); and then for the static images and javascript in other script's public directory to be reachable, I just need to add push @{$self->static->paths}, '/path/to/otherscript/public/';
19:40 dotandimet And yay, I has images.
19:41 sri jberger: i suppose your questions were not the same
19:41 jberger very possible
19:41 dotandimet I wasn't really explaining myself properly.
19:55 kmx joined #mojo
19:57 dotandimet Hmm. My javascript ajax bits with their hard-wired urls don't work, ofcourse. I saw there's a Korchick plugin to dump the routes as a hash into javascript, but maybe I should put the url_for in data-attributes.
19:57 lucs Beginner question: http://scsys.co.uk:8002/232174
19:59 jeen joined #mojo
20:01 sri the rendering guide
20:01 lucs Aha. Ok. I'll get to that soon :)
20:02 sri it's ok if you don't understand everything in the tutorial right away, parts of it are just there to show the possibilities
20:02 sri the guides go into more detail later
20:02 lucs Ok, thanks.
20:34 lukep joined #mojo
20:39 lukep joined #mojo
20:44 lucs Um, I found a couple of typos in the docs, what's the preferred way to report them?
20:49 sri depends on how many, usually you can just point at them here
20:49 lucs Ok. In Mojolicious::Lite:
20:50 lucs __DATA__;
20:50 lucs ...req->heaers->header...
20:51 lucs (that's it)
20:53 sri thanks fixed :)
20:54 lucs :)
20:54 sri github bot seems a bit slow again today
20:54 rem_lex| joined #mojo
21:01 basiliscos joined #mojo
21:03 jeen joined #mojo
21:29 human39 joined #mojo
21:35 berov1 joined #mojo
21:45 ynonperek joined #mojo
21:53 btyler joined #mojo
22:09 mattastrophe joined #mojo
22:09 kongelaks joined #mojo
22:12 kongelaks is it safe to call Mojo::UserAgent->start multiple times on a the same Mojo::Transaction::HTTP ?
22:12 human39 joined #mojo
22:13 kongelaks looking at the docs/source leads me to assume that tx->res will be reset, but otherwise it is safe
22:14 kongelaks and doing it doesn't warn me or cause any noticeable errors
22:14 sri it is not considered safe
22:16 kongelaks k, thanks
22:18 sri what makes you believe ->res will be reset?
22:18 sri because it absolutely won't, that would be a terrible bug
22:18 asarch joined #mojo
22:19 kongelaks sri: nvm, you're correct
22:20 kongelaks my test was to run a tx twice and examine them visually with Data::Dumper
22:37 kongelaks is there a doc that discusses the life cycle of a transaction?
22:43 berov1 left #mojo
22:53 dhg joined #mojo
22:57 human39 joined #mojo
23:02 mattastrophe joined #mojo
23:04 jeen joined #mojo
23:11 hrupp joined #mojo
23:22 mattastrophe joined #mojo
23:28 btyler joined #mojo
23:34 ObseLeTe joined #mojo
23:46 btyler joined #mojo
23:58 GabrielVieira joined #mojo

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