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

IRC log for #mojo, 2014-01-11

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

All times shown according to UTC.

Time Nick Message
00:03 dsteinbrunner sri: ok, I'm working with the latest in git and your one-liner
00:08 marty joined #mojo
00:08 dsteinbrunner I would as the fist one should say, tap for context or insight
00:08 dsteinbrunner while the other two do more and less
00:09 ki0 joined #mojo
00:12 dsteinbrunner of course you could be more descriptive and have show x, hide x
00:13 dsteinbrunner and show context, show insight
00:16 jack joined #mojo
00:23 rem_lex|pivo joined #mojo
00:30 rem_lex| joined #mojo
00:36 rem_lex joined #mojo
00:36 russum joined #mojo
00:42 jnbek^dt joined #mojo
00:54 jason_ can I render json from a string?
00:54 jason_ my $jsonString = "{something=> 'this', somethingElse=> 'that'}";
00:55 jason_ $self->render(json => $jsonString); ???
00:56 jason_ i guess i could just render text huh
00:56 jason_ but, is there a way to append items to a json string easily? or do I have to do it all manually
00:57 tianon why not decode the JSON string into a hash?
01:00 jason_ ive got to pass it to a javascript function
01:01 jason_ but i really dont want to manually append everything with the appropriate syntax to the json string
01:02 jason_ I have an array of objects that require the use of a property method to decode that I want to send to a js function
01:05 jason_ this is the object -> http://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.powercli.cmdletref.doc/VirtualMachine.html?resultof=%2522%2576%2569%2572%2574%2575%2561%256c%256d%2561%2563%2568%2569%256e%2565%2522%2520%2522%2576%2569%2572%2574%2575%2561%256c%256d%2561%2563%2568%2569%256e%2522%2520
01:06 jason_ I have an array of those received by this function -> http://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.perlsdk.pg.doc_50%2Fviperl_subroutineref.6.4.html
01:06 jason_ i want to take certain properties of those objects and pass them on using the render(json) method
01:10 tianon yes, so take that string, decode it, do whatever "munging" you need to, then render(json => $decoded_munged_object)
01:22 good_news_everyone joined #mojo
01:22 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/IPt4oQ
01:22 good_news_everyone mojo/master 205bfd7 Sebastian Riedel: change labels on exception page dynamically
01:22 good_news_everyone left #mojo
01:23 sri dunno if that's really better
01:24 jason_ tianon can you elaborate just a little please?
01:24 tianon jason_: https://metacpan.org/pod/Mojo::JSON
01:25 tianon ;)
01:25 tianon that has everything you need
01:25 tianon Mojo::JSON <3
01:25 tianon (the engine behind render(json => ...))
01:26 jason_ :-/
01:26 jason_ can you give me an example of a decoded munged object lol
01:27 jason_ ive already seen the docs on this
01:27 jason_ i cannot comprehend how it applies to this scenario
01:33 jason_ i just started perl like 4 days ago man
01:33 Adurah Perhaps provide a more simple example of what you want done.
01:33 jnbek jason_: I'd like to take this time to introduce you to the Data::Dumper CORE module
01:34 jnbek it's a very useful tool for seeing objects/hashes/etc how Perl sees them
01:36 tianon jason_: https://gist.github.com/tianon/8365844
01:36 tianon completely untested - it gets you the general idea, however
01:38 good_news_everyone joined #mojo
01:38 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/iwRqdQ
01:38 good_news_everyone mojo/master d709ad1 Sebastian Riedel: turn all RFC references into links
01:38 good_news_everyone left #mojo
01:38 tianon doh
01:38 tianon now it's tested, and I forget that it returns a hashref
01:39 jnbek yea
01:39 tianon fixed
01:39 jnbek I was about to say :)
01:47 jason_ thanks tianon
01:47 tianon oh man, just noticed that latest commit; sri++!  that's a very nice addition :)
01:48 sri \o/
01:48 tianon I've always been selecting them to right-click and search google :)
01:48 tianon this is much easier :D
01:51 * sri always forgets the tools.ietf address... and google only finds the plain text versions :)
01:58 KindTwo joined #mojo
02:16 wingfold_ joined #mojo
02:47 klapperl_ joined #mojo
02:57 wingfold joined #mojo
03:09 KindTwo joined #mojo
03:13 jason_ tianon, sorry if this is something too simple I could have figured out (I've been working for 12 hours already), but how can I use your same method from that gist to get a similar outcome to this: http://pastebin.com/TWuvEu8S
03:14 jason_ I've tried messing with it but i cannot seem to get it
03:24 jason_ j() does not seem to work for me either
03:25 jason_ nvm, i figured that one out
03:37 jason_ cannot figure out how to pass an array to the function and have it append that way though :-/
03:55 d4rkie joined #mojo
04:05 good_news_everyone joined #mojo
04:05 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/KzfYRw
04:05 good_news_everyone mojo/master cc3c0dd Sebastian Riedel: include moniker in exception page
04:05 good_news_everyone left #mojo
04:31 preflex_ joined #mojo
04:43 good_news_everyone joined #mojo
04:43 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/dCXkQw
04:43 good_news_everyone mojo/master 16cdcde Sebastian Riedel: include application configuration in exception page
04:43 good_news_everyone left #mojo
04:48 voegelas joined #mojo
04:50 tianon jason_: you probably want to be reading bits of Modern Perl if you're new to Perl: http://modernperlbooks.com/books/modern_perl/chapter_03.html (great chapter that talks about variables, including a bit about lists vs arrays)
04:52 tianon and by reading bits, I mean you ought to read it cover to cover :)
06:09 crab the bits between the covers :-)
06:34 Vandal joined #mojo
06:46 rem_lex|pivo joined #mojo
06:57 jnbek^dt joined #mojo
07:03 hummeleBop joined #mojo
07:32 basiliscos joined #mojo
08:07 hesperaux joined #mojo
08:07 sh4 joined #mojo
08:28 nornagest joined #mojo
09:17 moritz good morning
09:17 purl Lies!
09:18 moritz how do I use validation with file uploads?
09:18 moritz I have %= file_field 'file'; # in the template
09:18 moritz and in the controller, $validation->required('file');
09:19 moritz and it always hilights the file field (well, actually the label for it) in red, meaning the validation failed
09:19 moritz for the non-file input fields it works as expected
09:20 moritz how do I marry the two?
09:35 moritz I now have  unless ($self->req->upload('file')) { $validation->required('file') }
09:35 moritz but IMHO it would be nice if just   $validation->required('file') worked out of the box
10:09 batman moritz: it might me a missing feature, but what you can do is to do $validation->error(upload_field => ['too_big']) if $upload->size > 42;
10:10 batman and then use %= "too big!" if $validation->error('upload_field') # in the template
10:10 batman oops
10:11 batman and then use %= "too big!" if $validation->error('upload_field')->[0] eq 'too_big' # in the template
10:11 batman that code might give uniitialized warning, but you probably get the idea..?
10:21 denis_boyun joined #mojo
10:49 moritz batman: yes, I get the idea, thanks
10:57 mire__ joined #mojo
11:08 batman :)
11:09 preflex_ joined #mojo
11:17 batman someone who understand why dsteinburner said "tap for less FTW, right?" i don't get it :(
11:17 batman sri: acceptors looks interesting. i will dig deeper to see if that would actually work for what i want. thanks for letting me know! :)
11:21 batman sri: stop giving me solutions! i got too many things to do!
11:21 batman ;)
11:21 batman hehehe
11:21 batman j/k
11:28 dvinciguerra joined #mojo
11:30 dsteinbrunner joined #mojo
11:36 trone joined #mojo
11:40 rem_lex| joined #mojo
11:41 batman i'm considering creating a new object and then delegating the work instead of subclassing the module
11:42 D4RK-PH0ENiX joined #mojo
12:29 dsteinbrunner joined #mojo
12:48 dod joined #mojo
12:56 dod joined #mojo
12:59 batman sri: https://github.com/jhthorsen/mojo-server-tcp/pull/1 # what do you think?
13:09 d4rkie joined #mojo
13:09 amirite_ joined #mojo
13:18 hrupp joined #mojo
13:28 jack joined #mojo
14:19 hellyna joined #mojo
14:41 sri moritz: patches welcome
14:41 purl patches welcome is probably always true or unless for metacpan.org or swahili for "Put up or shut up."
14:53 TitanOfOld joined #mojo
14:56 sri but of course nobody even mentions how upload validation is supposed to work...
15:00 batman $validation->require('file')->like(qr{FAIL}) # check if the content of the file has the string FAIL
15:00 batman FAIL!
15:00 batman :)
15:02 sri batman: that would be quite an epic fail
15:03 sri LETS JUST LOAD THIS 1TB UPLOAD INTO MEMORY FOR A LIKE CHECK... WHAT COULD EVER GO WRONG
15:03 batman hahaha :D
15:04 batman reminds me of mr. upload the other day...
15:07 sri i'm serious, how the hell am i supposed to add upload validation if you don't even have a clue how it's supposed to work?
15:13 mire__ joined #mojo
15:14 Adurah He's also trolling.
15:15 sri but nobody ever thinks that far... and $validation->error(upload_field => ['too_big']) is bullshit... file_field doesn't have tag_with_error support
15:15 moritz but the label for file_field has :-)
15:15 moritz *label_for
15:26 sri oh well... to the trash with this upload validation patch... http://pastie.org/8623847
15:33 sri for the record... today i am a little upset
15:36 batman sri: sorry, i was just joking. and my "too_big" works, since it was manually in use in the template.
15:36 sri no it doesn't, file_field has no validation support... just the label
15:36 batman sri: i seriously don't think you should add validation for file. sorry if i made the impression that i thought it was a good idea :(
15:36 batman sri: i did this: %= "too big!" if $validation->error('upload_field')->[0] eq 'too_big'
15:38 sri so it only works *for you* because you don't style failing input fileds
15:38 batman right. not perfect.
15:39 batman but anyhow. let's not discuss that. i just want to say i agree on not adding validation for file fields.
15:39 batman at least not without anyone giving an example of how it should work.
15:39 batman ...as you said
15:41 batman sri: do you have time to look at https://github.com/jhthorsen/mojo-server-tcp/blob/delegated/lib/Mojo/Server/TCP.pm ?
15:42 batman i'm wondering if i'm stepping on any internals here as well....
15:43 batman i'm also considering passing on $id instead of $stream to the event handlers.
16:23 sri if you're not using _methods you should be fine
16:30 sri so pause is still down :(
17:02 good_news_everyone joined #mojo
17:02 good_news_everyone [mojo] kraih tagged v4.67 at d1cf925: http://git.io/pXU-DA
17:02 good_news_everyone left #mojo
17:03 batman okey.
17:03 meshl joined #mojo
17:05 sri pause might be back, lets see if i got the first release :)
17:07 batman \o/
17:08 sri hmmm... something still doesn't work
17:09 avenj https://pause.perl.org/pause/authenquery?ACTION=tail_logfile
17:09 avenj Alert: nosuccesscount[0] error[LWP::Protocol::MyFTP: connect: Connection refused] (paused:676)
17:09 * sri nods
17:11 batman got email from cpan now for my Cloudinary module...
17:11 batman ....has entered CPAN as
17:11 mst batman wins.
17:12 batman yay! it is indexed :)
17:12 batman wins?
17:12 purl MENTALITY!
17:12 batman https://twitter.com/cpan_new/status/422052805067563008 :)
17:12 batman *food*
17:21 jberger joined #mojo
17:23 jberger o/
17:25 sri \o
17:27 * jberger is itching to work on some mojo projects!
17:27 * jberger considers working on: https://github.com/jberger/Mojo-FriendFeed
17:27 * jberger considers working on: https://github.com/jberger/Mojolicious-Command-nopaste
17:28 * jberger considers working on: https://github.com/jberger/Mojo-IOLoop-ForkCall
17:28 jberger hmmmmm
17:28 jberger I think I need to remove Child.pm from my ForkCall implementation
17:29 jberger I think I need to more closely port AE::Util::fork_call
17:30 jberger sri: on naming, do you like Mojo::Command::nopaste (as it is a port of App::nopaste) or to do you think I should just name it Mojo::Command::paste?
17:33 KindTwo joined #mojo
17:40 good_news_everyone joined #mojo
17:40 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/G6EBXQ
17:40 good_news_everyone mojo/master 3be2733 Sebastian Riedel: more RFC links
17:40 good_news_everyone left #mojo
17:42 jason_ tianon, i still cannot figure out how to properly pass the array to get it to look right in the json :-/
17:42 sri jberger: i have no opinion on that
17:43 jberger sri: the problem is ... I don't either :-/
17:43 jberger jason_ you need to json encode an array reference, not an array
17:43 jberger c.f. http://p3rl.org/reftut
17:44 * jberger considers ^^ the most important tutorial for Perl
17:44 jason_ jberger,
17:44 jason_ THANK YOU!
17:44 jason_ worked like a charm
17:44 jason_ wow...
17:46 jberger n.b. I consider http://p3rl.org/dsc to be the worst (as it doesn't teach you to fish, just hands you one that you don't understand)
17:46 jason_ jberger, do you know how i would get an output similar to this? http://pastebin.com/TWuvEu8S
17:47 jason_ sorry, jberger, http://pastebin.com/iifMH8ni
17:47 jberger hehe, ummmm, well, perl -E 'say' :-P
17:47 jason_ yeah, i have it printing to console in a test script right now, but i dunno how to format it like that
17:47 jason_ i was able to pass the array reference as you suggested, and it got me a lot closer
17:48 jberger my 'say' comment was in response to your broken link
17:48 jberger are you trying to encode a structure like that?
17:49 jason_ oh, lol
17:49 jberger just convert all the : to =>
17:49 jason_ yes, but from an array of objects that contain non scalar properties
17:49 jberger note that the formatting (otherwise known as pretty-printing) doesn't matter
17:50 jason_ I use this function to get the array of objects: http://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.perlsdk.pg.doc_50%2Fviperl_subroutineref.6.4.html
17:50 jason_ and this is the object that is in the array: http://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.powercli.cmdletref.doc/VirtualMachine.html?resultof=%2522%2576%2569%2572%2574%2575%2561%256c%256d%2561%2563%2568%2569%256e%2565%2522%2520%2522%2576%2569%2572%2574%2575%2561%256c%256d%2561%2563%2568%2569%256e%2522%2520
17:50 jberger I have no idea what any of that is
17:51 jberger but its all just data right?
17:51 jason_ yeah, but im not going to know how many objects are in the array, and each array contains multiple properties that i have to get by doing something like $obj->get_property('name')
17:51 jberger ?
17:52 jberger first, do you mean objects, like perl objects or like javascript objects (meaning a perl hash)
17:54 jason_ I'm pretty sure its a perl object
17:54 denisboyun joined #mojo
17:54 jason_ my $vm_views = Vim::find_entity_views(view_type => "VirtualMachine",
17:54 jason_ properties => ['name', 'runtime.powerState', 'runtime.connectionState'])
17:54 jason_ that is how my object is defined
17:55 jason_ it returns an array of objects
17:58 jberger jason_, this is the best as I can do for you unless you show something closer to a real example, I have no idea what you are attempting to do
17:58 jberger http://pastie.org/8624162
18:00 jason_ jberger, thats what i want it to look like, but i need it to be from an array of those objects... can I do a for each loop inside the string definition?
18:01 jberger jason_, please read perlreftut, carefully, and I think your questions will be answered
18:02 stl joined #mojo
18:03 jberger btw, $data in my paste contains a structure we call a 'hash reference' in Perl, an object is something else (which might be implemented as a hashref or it might not)
18:09 jason_ so the answer is no?
18:10 batman the answer is probably: you don't need to.
18:10 jberger jason_, you want to make several of the $data structures, and pack them into an array?
18:11 jberger $aref = [ $data, $data ]; say j $data
18:11 jason_ i HAVE an array. I want to convert it to JSON
18:11 jason_ but each object inside the array contains multiple properties
18:11 jberger oops that was supposed to be 'say j $aref'
18:11 stl joined #mojo
18:23 mire__ joined #mojo
18:25 jason_ jberger, this is what im dealing with, that i want to convert to that JSON syntax
18:25 jason_ http://pastie.org/private/pwgjooj2hxhhkvl4mcm9g
18:27 jberger jason_, so can you build an array reference of those values in the loop, rather than just printing them?
18:27 jberger otherwise, if your object contains a TO_JSON method, Mojo::JSON will properly serialize it
18:32 jberger jason_, obviously I can't run this: http://pastie.org/8624235
18:48 jason_ yeah you need the vSphere SDK for perl, jberger
18:48 jason_ and on top of that, you would need to have a vSphere server to connect it to
18:54 jason_ that worked out wonderfully jberger
18:54 jason_ thank you so much
19:04 KindOne joined #mojo
19:16 jberger jason_, glad to help
19:17 russum1 joined #mojo
19:18 zivester joined #mojo
19:40 denis_boyun__ joined #mojo
19:57 jberger batman: https://github.com/jberger/Mojo-IOLoop-ForkCall/tree/nochild
19:57 denis_boyun joined #mojo
20:04 jberger jason_, just because I'm a geek, try this one out: http://pastie.org/8624444
20:05 jason_ haha, okay, ill take a look
20:06 jberger probably shouldn't determine the class name on the fly, but other than that ...
20:10 batman jberger: i'm kind og busy now...
20:10 batman i can hopefully look at it tomorrow
20:16 voegelas joined #mojo
20:18 sri for anyone who wants to learn more about http/2 http://mirror.linux.org.au/linux.conf.au/2014/Wednesday/51-HTTP2.0_And_You_-_Mark_Nottingham.mp4
20:26 sri bummer... apparently chrome and firefox have already stated that they will require tls for http/2 :o
20:28 KindTwo joined #mojo
20:30 meshl sri: why bummer? is that a bad thing?
20:31 hesperaux_ joined #mojo
20:31 rem_lex|pivo joined #mojo
20:32 D4RK-PH0ENiX joined #mojo
20:32 jason__ joined #mojo
20:32 wingfold_ joined #mojo
20:32 gedge joined #mojo
20:33 sycobuny2 joined #mojo
20:34 sri it means that there will be no http/2 without tls
20:34 sri which again requires the alpn exptension of tls, which is only available on the absolutely latest versions of openssl
20:34 suy joined #mojo
20:34 dsteinbrunner_ joined #mojo
20:34 preflex joined #mojo
20:34 inokenty joined #mojo
20:34 augensalat joined #mojo
20:34 firnsy joined #mojo
20:34 denis_boyun joined #mojo
20:35 hrupp joined #mojo
20:35 diegok joined #mojo
20:35 basiliscos joined #mojo
20:35 bowtie joined #mojo
20:35 jzawodn joined #mojo
20:35 tardisx joined #mojo
20:36 KindOne joined #mojo
20:36 robinsmidsrod joined #mojo
20:37 stephan48 tls with ca issued certificates(comodo, verisign etc) or will there also be a mechanism for self signed certs?
20:38 sri it's just the same system we have now for https
20:39 kwa joined #mojo
20:39 bc547 joined #mojo
20:39 sri having to buy/make your own certs for backend servers will be fun!
20:42 sri mojolicious having a hard dependency on IO::Socket::SSL, Net::SSLeay and OpenSSL 1.x will be great too
20:44 sri python has quite the advantage, since it's shipping with tls support
20:44 sri oh, ruby too
20:45 mire__ joined #mojo
20:45 sri node.js too
20:48 stephan48 wouldn't that effectively mean mojolicious can not be installed without a working compiler(on a "fresh" perl)?
20:48 meshl yeah, understood, quite crazy... big brother is watching us, for sure!
20:51 meshl besides the technical concerns, I guess it's the end of anonymity on the web... everything will be controlled, we will carry with us an ID for whatever we do / develop on the internet. It'll be much easier for authorities to control everything...
20:53 Adurah Encryption is bad now?
20:54 meshl certs = IDs
20:55 meshl encryption really just gives a false sense of security/anonymity
21:02 * sri makes some noise in #p5p... but doesn't have high hopes
21:09 sri well...fuck
21:10 sri there is actually a licensing incompatibility between perl and openssl, so they can't be shipped together
21:10 sri https://people.gnome.org/~markmc/openssl-and-the-gpl.html
21:11 sri ruby and node.js are bsd, and python has a custom license... which are compatible
21:12 meshl sh*t
21:15 meshl btw, sri (and all who care about Mojo::IOLoop), regarding my comments on the on_finish double-call (see http://irclog.perlgeek.de/mojo/2014-01-09), jberger and I actually found out it's a Firefox issue. Firefox actually issues a double-request when it does not receive data for a while. Crazy stuff. Nothing to do with Mojo::IOLoop and Windows. Just an FYI...
21:15 * sri wonders what the tls situation in perl6 land is
21:15 * sri pokes moritz
21:16 Kulag joined #mojo
21:18 sri it's a little sad that i'm starting to hope for http/2 to fail again
21:22 * meshl worries about http/2 and perl, and leaves for dinner with a cloudy brain
21:24 sri well, worst case... mojolicious requires a C compiler to install
21:25 Adurah There's always gnutls.
21:26 Adurah Unless there's something wrong with that.
22:02 KindTwo joined #mojo
22:27 * jberger proposes artistic license v3, with OpenSSL exemption
22:29 jberger I wonder if some large body, say google, will host a clearing house for self-signed certs
22:29 stephan48 clearing house?
22:30 jberger if they are pushing for this, and possibly rightly so, it would be a shame if all small sites trigger a certificate warning
22:30 jberger register your self-signed cert with the clearing house, your browser verifies there
22:30 stephan48 in theory they could suppport DANE which would allow publishing certificate info in DNS
22:31 stephan48 like selfsigned with no further verification, must be a cert from a certain ca and so on
22:31 jberger I really don't know more than how the current system works, in which browsers recognize the big-name certificate companies cert
22:32 jberger I'm just saying it would be nice if your browser had a good way to verify your self-signed cert for your site
22:33 stephan48 DANE could f.e. backed with DNSEC to make forging records harder
22:33 jberger if what I'm saying makes no sense, then chalk it up to me having no idea what I'm talking about
22:33 jberger stephan48, I'd love to say that I will go read up on those things, but I probably won't :-P
22:33 stephan48 hehe
22:33 jberger I probably should, but ... hey cat videos
22:34 stephan48 DNSSEC is basically a chain of trust from the root zone down to your dns zone, which should provide some temper resistence
22:34 stephan48 chain of validation*
22:34 jberger seems sane
22:36 stephan48 my problem is just, i dont like big central institutions governing about what pages my users see with or without a fat ugly certification warning :) seems almost as bad to me as the current Certificate Authority concept
22:37 jberger I'm not saying I like it any better, still it would be bad if there were no way to avoid the fat ugly warning without paying
22:37 stephan48 jup
22:37 stephan48 i think we can agree on that
22:37 jberger \o/
22:38 jberger purl botsnack
22:38 purl thanks jberger :)
23:28 Adura joined #mojo
23:37 jason_ joined #mojo
23:51 jberger sri: I'm wondering, in Mojo::IOLoop::ForkCall, in the child, is there some way to try to stop and remove the event loop?
23:53 sri doubt it, we depend on them not being fork safe now

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