The web in a box - a next generation web framework for the Perl programming language

IRC log for #mojo, 2014-07-05

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

All times shown according to UTC.

Time Nick Message
00:01 d4rkie joined #mojo
00:02 Phil21 go|dfish: naw, not with CLI, but just lightweight script to interact with a JSON API, more or less toss it into a hash tree
00:02 Phil21 trying to figure out the Mojo Way(tm) vs. LWP :)
00:05 Phil21 hmm, CPAN 503 for me
00:06 preaction is it the standard weekend s.c.o downtime?
00:06 preaction Phil21: use metacpan.org and/or a different cpan mirror
00:11 Phil21 thanks
01:56 klapperl joined #mojo
02:31 gatitskiy joined #mojo
02:47 KCL_ joined #mojo
02:59 KCL joined #mojo
03:14 KCL_ joined #mojo
03:14 Phil21 hmm, has anyone seen anything like this?  Newb to JSON...
03:14 Phil21 using curl against an API, -d '{"object": "folder", "params": ["performance1", "refer"], "method": "get_child_props"}' works fine
03:15 Phil21 same thing w/ Mojo using: my $data = encode_json('{"object": "folder", "params": ["performance1", "refer"], "method": "get_child_props"}');
03:15 Phil21 API errors with "error": {"message": "string indices must be integers"} (looks like a standard python lib)
03:16 Phil21 the PUT looks pretty much identical save the order of the json object
03:16 Phil21 been one of those days :)
03:24 Phil21 not using easy-paste json_encode it generates valid json it looks like, hrm
03:24 * Phil21 googles more
03:29 Phil21 hmm, wonder if I'm just not sending the json via POST :)
03:29 Phil21 my $tx = $ua->post($url => json => $data);
03:31 punter joined #mojo
03:48 basic6 joined #mojo
03:49 R0b0t1 joined #mojo
03:51 riche joined #mojo
03:53 R0b0t1 Mojo is too awesome.
03:55 Phil21 hmm
03:55 Phil21 'content' => '"{\\"params\\":[\\"performance1\\",\\"refer\\"],\\"object\\":\\"folder\\",\\"method\\":\\"get_names\\"}"'
03:55 Phil21 does that mean UserAgent is literally sending that as the content?
03:56 btyler joined #mojo
04:08 Phil21 ha. sigh
04:08 Phil21 json => in the $ua->post call also encodes json :)
04:08 Phil21 for the peanut gallery
04:12 abhishekisnot joined #mojo
04:13 phillipadsmith joined #mojo
04:13 sri tempire: "interesting" doesn't really tell me much btw ;p
04:14 sri i need to know if you want the feature or not!
04:14 cfedde joined #mojo
04:16 jnbek joined #mojo
04:17 gatitskiy joined #mojo
04:21 * tempire considers
04:22 tempire Whenever I need nested params, I pass json
04:22 tempire Even get can accept json bodies now
04:23 tempire not sure if url passing of nesting params is all that useful
04:23 tempire I'd like to see a use case where it's better than accepting a json body
04:26 Phil21 tempire: using your vimrc, thanks :) (not to mention mojo.. but I actually found mojo by watching a webcast linked to me and loving the vim setup)
04:27 tempire rock on
04:27 tempire I should post my current dotvim
04:27 tempire it's much better
04:27 Phil21 I'd definitely make use of it
04:27 Phil21 all I've done is add a couple color schemes and turn off folding for my setup, otherwise worked great out of box
04:34 ua_ joined #mojo
04:36 gatitskiy joined #mojo
04:36 ryozi joined #mojo
04:42 mattp_ joined #mojo
04:43 sri tempire: brings up an interesting problem... json validation
04:46 tempire json schema
04:46 purl well, json schema is so lame
04:46 cfedde joined #mojo
04:46 tempire shut it, purl
04:46 purl Phuque Oph!
04:46 gatitskiy joined #mojo
04:46 jnbek joined #mojo
04:46 sri :D
04:47 tempire I'm just about to start using json schema
04:47 tempire it looks decent
04:49 sri i'm going to trust purl on this
04:49 * tempire cries
04:55 neyasov_____ joined #mojo
05:18 R0b0t1 WHOSE VIMRC?
05:21 gatitskiy joined #mojo
06:27 R0b0t1 So what goes on when I do get 'path' whatever
06:27 R0b0t1 Where is the under the hood for those bits?
06:32 R0b0t1 What is the best way to break off large subroutines that are connected to a path?
06:35 basiliscos joined #mojo
06:46 berov joined #mojo
06:57 batman jberger: i'm not sure how, but i'm considering not showing all kinds of media inline in Convos... the gists take a lot of space :/ i need to figure out something clever there
06:58 batman xevz: i didn't know you pinged me. i think the notifications are broken for new installations. working on a fix now, but i've been sick so i haven't had time to finish the convos changes i had planned for this week :(
07:00 batman sri: what do you think about https://github.com/jhthorsen/refine ? can i release it? (would add credits to your name+paste if that's ok) i'm planning to add optional support for Sub::Name and Package::Anon
07:27 _eugen joined #mojo
07:48 kyshtynbai joined #mojo
07:57 Vandal joined #mojo
07:57 kyshtynbai joined #mojo
08:02 mire joined #mojo
08:25 gatitskiy joined #mojo
08:26 TenshiLyle joined #mojo
08:27 akiym joined #mojo
08:37 disco joined #mojo
08:37 disco Hi there
08:39 disco I'm wondering what's the best solution in order to: 1. get a picture with the useragent (password protected) and 2. serve it with correct file type (image/jpeg) directly from a route in mojolicious
08:45 gatitskiy joined #mojo
08:46 batman disco: create a $private = Mojolicious::Static->new(paths => ["/path/to/your/images"]); and then call $private->serve($c, "your/file.jpg"); from the password protected action
08:46 disco In other words, how can you change the mime type before rendering data ? (in: get '/snap/:id' => sub { };)
08:47 xevz batman: At work, miksva. :)
08:47 batman disco: why do you want to change the mime type?
08:47 batman xevz: aha! didn't know you where the same person :)
08:47 xevz =|
08:47 xevz :)*
08:47 disco batman: I have to get the jpeg from a HTTP GET, not from a flat file
08:47 batman the action can be protected using something like app->routes->route("/private")->over(cb => sub { .... })->to("controller#action");
08:48 disco batman: that's why I will need to use the useragent to GET it and then resend.
08:48 batman oh. i thought you wanted to password protect -your- files :)
08:48 batman i can't answer your question without knowing the password protection. is it basic auth?
08:48 disco batman: non, I have to access password protected (htaccess) a jpeg file from a network camera
08:49 disco batman: yes, basic auth
08:49 purl i heard basic auth was in box tho?
08:49 disco At the moment I'm linking directly within the HTML with src="http://user:pass@url/snap.jpg" but this is not very secure ;)
08:50 gatitskiy joined #mojo
08:50 disco and I'm running the mojo scripts with https, that means there are non https elements.
08:51 batman rigth. $app->ua->get("http://username:password@10.0.0.10/your/picture.jpg", sub { my ($ua, $tx) = @_; $c->render(data => $tx->res->body); });
08:51 disco batman: thank you, excellent.
08:51 batman that's non-blocking by the way^ (the way you should do it)
08:52 batman if you need to set the content type, you can also do $c->headers->content_type($tx->res->headers->content_type);
08:52 batman oops!
08:52 batman if you need to set the content type, you can also do $c->res->headers->content_type($tx->res->headers->content_type);
08:52 disco batman: Actually I don't need to change the mime type. I didn't know precisely that render() was rendering correctly ;)
08:53 batman ok.
08:54 batman remember that the browser will probably get confused if you're asking for "/some-picture.png" and you have $c->render(data => $jpeg_data);
08:54 batman so you might want to restrict the route to the same extension as the picture.jpg. is this a lite or full app?
08:54 disco batman: it's lite.
08:55 disco batman: I could do get '/snap/:id.jpg' ?
08:55 disco btw I've some cgi-bin scripts called picture.sh which returns a jpeg file and that works perfectly.
08:56 batman not quite. use get "/snap/:id", [format => "jpg"] => sub { my $c=shift->render_later; app->ua->get(...., sub {...}); };
08:56 batman the trick is [format=>...]
08:56 disco ok, nice
08:56 disco (I'm quite a newbie with mojolicious as you can see) ;)
08:57 disco (this is my first app, playground to start)
08:57 batman you can also do [ format => [qw(jpg txt)] ] -- even though that doesn't really make any sense in this case ;)
08:58 batman but [format=>qr{jpe?g}] <-- this might: match both .jpeg and .jpg
08:58 sh4 joined #mojo
08:59 disco very powerfull
08:59 batman you could also make it case insensitive i think, but i really hate .JPEG extensions so i'm not trying that out ;)
08:59 batman yeah. mojo got your back ;)
09:00 disco I hate as well ;)
09:00 disco .jpg is perfect.
09:00 batman :D
09:01 Eke- joined #mojo
09:01 disco btw, what is the $app object ? In my lite app I'm using "app->start", so I don't have a ref ($app)
09:08 batman it's the same. just translate everything that is said about "$app" to "app" (or app()) when working with a lite app
09:09 batman my $app = app() #:)
09:10 gatitskiy joined #mojo
09:10 batman i got a bug report from a person who require me to register on a web form to reply back #fail
09:10 batman that is the worst i've experienced so far (iirc)
09:11 disco batman: ok, thank you ;)
09:11 batman you're welcome
09:11 disco batman: I had this after sending a mail to some institution as well... this and SPF is a shame
09:12 batman i have no experience with spf.
09:12 batman sounds awful if it's the same ;)
09:30 disco not the same, but it restricts the smtp server you are using.
09:30 cpan_mojo Mojolicious-Plugin-AssetPack 0.15 by Jan Henning Thorsen - http://metacpan.org/release/JHTHORSEN/Mojolicious-Plugin-AssetPack-0.15
09:30 disco ok, barbecue, see you later and thank you for your help
09:30 barbecue you're welcome.
09:39 gatitski_ joined #mojo
09:41 disco lol ;)
09:58 cpan_mojo Mojolicious-Plugin-CSSLoader 0.04 by Renee Baecker - http://metacpan.org/release/RENEEB/Mojolicious-Plugin-CSSLoader-0.04
10:06 mattastrophe joined #mojo
10:10 rem_lex|pivo joined #mojo
10:16 drift joined #mojo
10:25 d4rkie joined #mojo
10:35 dexteruk joined #mojo
10:38 dod joined #mojo
10:47 dod joined #mojo
10:52 d4rkie joined #mojo
11:09 meshl joined #mojo
11:28 mire joined #mojo
11:31 denis_boyun joined #mojo
11:33 denis_boyun_ joined #mojo
11:37 denis_boyun__ joined #mojo
11:38 gatitskiy joined #mojo
11:45 gatitskiy joined #mojo
11:56 denis_boyun joined #mojo
12:04 gatitskiy joined #mojo
12:17 bpmedley joined #mojo
12:19 mire joined #mojo
12:45 Jonneh_ joined #mojo
12:58 cpan_mojo Ado 0.51 by Krasimir Berov - http://metacpan.org/release/BEROV/Ado-0.51 (depends on Mojolicious::Plugin::DSC)
12:59 berov Hopefully now my tests do not fail miserably under Windows
13:02 mire joined #mojo
13:38 kyshtynbai Guys, are there any "syntax highlights" for vim for .html.ep files? I'd like to have html highlighted as well as perl - in <%%> tags.
14:05 Negor joined #mojo
14:49 gatitskiy joined #mojo
14:59 KCL joined #mojo
15:11 mire joined #mojo
15:12 gatitskiy joined #mojo
15:18 denis_boyun joined #mojo
15:37 irq joined #mojo
15:47 gatitskiy joined #mojo
15:53 denis_boyun joined #mojo
15:57 denis_boyun_ joined #mojo
16:00 berov kyshtynbai: http://www.vim.org/scripts/script.php?script_id=3168
16:01 berov see also https://github.com/kraih/mojo/wiki#ideeditor-support
16:08 Eke- joined #mojo
16:13 dod joined #mojo
16:29 btyler joined #mojo
16:38 good_news_everyon joined #mojo
16:38 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/Q98UeQ
16:38 good_news_everyon mojo/master ead8245 Sebastian Riedel: more consistent delay examples
16:38 good_news_everyon left #mojo
16:41 mire joined #mojo
16:50 denis_boyun joined #mojo
16:51 sri batman: sure
16:52 sri i don't really care about the refine stuff, it was just an experiment
17:04 kyshtynbai berov: thanks.
17:04 gatitskiy joined #mojo
17:05 berov wellcome :)
17:53 Eke- joined #mojo
18:42 sri haha... "You're having a beer at lunch?" "It's okay, i work in a type-safe language."
18:42 sri the ruby is dead meme gets stronger https://blog.abevoelker.com/sick-of-ruby-dynamic-typing-side-effects-object-oriented-programming/
18:53 crab i'm trying to remember if when i started programming people spent so much time complaining about programming languages
19:02 bjoernfan I guess those who did created their own programming languages, most likely the ones being complained about today. ;)
19:02 bjoernfan sri: love the quote
19:04 zacts joined #mojo
19:12 good_news_everyon joined #mojo
19:12 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/1qMMLQ
19:12 good_news_everyon mojo/master 40bbf5d Sebastian Riedel: better Mojo::DOM examples
19:12 good_news_everyon left #mojo
19:12 denis_boyun_ joined #mojo
19:25 denis_boyun joined #mojo
19:25 mire joined #mojo
19:33 basic6_ joined #mojo
19:35 kyshtynbai joined #mojo
19:36 Eke- joined #mojo
19:42 sujithm joined #mojo
20:08 rawler joined #mojo
20:17 denis_boyun_ joined #mojo
20:33 rawler joined #mojo
20:46 denis_boyun joined #mojo
20:53 gatitskiy joined #mojo
21:06 meshl joined #mojo
21:15 jberger I'm reading that ruby article, I'm in the testing section and I think its something that Perl doesn't get enough credit for
21:16 jberger writing tests using Test::More etc is really easy
21:16 jberger and since mocking is so easy in Perl, all is simple
21:16 jberger (when you even need mocking that is)
21:18 * sri pretty much never mocks
21:21 jberger I find myself needing to mock all the time in python
21:21 jberger and almost never in Perl
21:22 * sri is very very happy with testing in mojolicious, and thinks it doesn't get enough credit for it
21:23 sri all the other frameworks use mock servers
21:24 jberger "Ruby: where requiring a module that ships with the stdlib changes how integer division works everywhere. " ZOMG!
21:24 jberger Test::Mojo is teh awsme!
21:25 jberger and I agree, it doesn't nearly get enough credit
21:26 jberger I love that the testing and the useragent and css3 selectors and json parser all work together seamlessly. Its what you get by having an integrated and consistent design
21:27 * sri nods
21:27 sri sometimes i'm a little sad we are not more opinionated about model layers
21:28 sri for the same level of seamless integration
21:29 sri but i guess that just can't be done anymore in our nosql world
21:31 sri most of our users would expect something rails/django-ish and i would actually be heading towards meteor.js :)
21:32 jberger https://twitter.com/joelaberger/status/485536632867520513
21:32 jberger seemed like about time for a tweet
21:32 jberger had to golf it a bit
21:43 * jberger has been meaning to learn haskell
22:11 jberger I see that friedo has similar thoughts on the web standards bodies:
22:11 jberger https://twitter.com/friedo/status/485545375504551936
22:31 jberger argh, latest forkcall (with ->reset) breaks on windows! http://matrix.cpantesters.org/?dist=Mojo-IOLoop-ForkCall+0.10
22:31 jberger grrrrr
22:38 d4rkie joined #mojo
22:38 batman sri: i think i will release the $_refine module later today (sunday) then :)
22:40 punter joined #mojo
22:41 sri jberger: haha, called it!
22:41 sri minion had the same problem
22:41 gatitskiy joined #mojo
22:56 jberger sri: did you figure it out?
22:56 jberger batman++
22:56 sri jberger: no, but i made it work somehow ;p
22:56 batman jberger: for what?
22:56 purl for fun.
22:57 jberger batman->$_refine(increment => sub { my $self = shift; $self->karma( $self->karma + 1 ) } );
22:58 batman haha
22:58 batman sounds like i need to release it now ;)
23:03 sri haha, lots of this applies for perl too... especially the part about promises... most people don't realize how awful things get when you mix paradigms http://notes.ericjiang.com/posts/751
23:06 sri the gospel is that promises are a silver bullet... but i love delays because they work with all kinds of apis we encounter in the wild
23:06 batman jberger: https://metacpan.org/release/JHTHORSEN/Refine-0.01
23:09 xevz batman: First draft: https://github.com/xevz/convos-notifier-firefox
23:10 xevz :)
23:18 batman xevz: there's no readme :/
23:20 xevz Yeah, I know.
23:26 xevz batman: https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Installation
23:57 klapperl_ joined #mojo

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