From jacoby at purdue.edu Tue Jan 11 12:31:23 2011 From: jacoby at purdue.edu (Dave Jacoby) Date: Tue, 11 Jan 2011 15:31:23 -0500 Subject: [Purdue-pm] One Week Warning - Perl Mongers on Jan 18 Message-ID: <4D2CBE1B.2060007@purdue.edu> That's the day after MLK Day, so we won't have a working Monday to prepare and remind. We can usually fill up the time with something, but it's good to have something planned. Even if we ignore it. To throw something into the mix, I mention this: http://googlesystem.blogspot.com/2011/01/google-goggles-solves-sudoku-puzzles.html Google Goggles solves Sudoku. How long before it becomes SkyNet? -- Dave Jacoby Address: WSLR S049 Code Maker Mail: jacoby at purdue.edu Purdue University Phone: 765.49.67368 From jacoby at purdue.edu Wed Jan 19 07:05:49 2011 From: jacoby at purdue.edu (Dave Jacoby) Date: Wed, 19 Jan 2011 10:05:49 -0500 Subject: [Purdue-pm] Simple Web Service Message-ID: <4D36FDCD.9020507@purdue.edu> Yesterday, I said that someone should be able to make a simple web service that could handle addition in ten minutes. I didn't time how long it took me to code this but it is 40 lines long and about 10 or 15 are lines I use most everywhere in CGI programs. As written, this would only work on the server it was written for. There is a simple, nearly one-line fix for this to handle cross-site work, but I don't recall the specifics right now. I have client-side code calling it (for now) on my work website (http://www.genomics.purdue.edu/~jacoby/). ---8<-------------------- #!/usr/bin/perl use 5.010 ; use strict ; use warnings ; use CGI ; use CGI::Carp qw( fatalsToBrowser ) ; use Data::Dumper ; use JSON ; use LWP::UserAgent ; my $cgi = new CGI ; my $params ; %$params = map { $_, $cgi->param( $_ ) } $cgi->param() ; say 'content-type: text/plain' ; say '' ; my $x = $params->{ x } ; my $y = $params->{ y } ; $x =~ s/[A-Za-z\s]//gmx ; $y =~ s/[A-Za-z\s]//gmx ; $x = $x eq '' ? 2 : $x ; $y = $y eq '' ? 2 : $y ; my $out ; $out->{ x } = $x ; $out->{ y } = $y ; $out->{ result } = $x + $y ; if ( $params->{ d } ) { say Dumper $out ; } else { say JSON::to_json( $out ) ; } exit ; ---8<-------------------- -- Dave Jacoby Address: WSLR S049 Code Maker Mail: jacoby at purdue.edu Purdue University Phone: 765.49.67368 From gizmo at purdue.edu Thu Jan 27 08:46:19 2011 From: gizmo at purdue.edu (Joe Kline) Date: Thu, 27 Jan 2011 11:46:19 -0500 Subject: [Purdue-pm] perl 5.12.3 released Message-ID: <4D41A15B.10701@purdue.edu> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I was talking to Mark the other day and mentioned that Perl 5.12.3 was released. I didn't think there was much that was really interesting in the release, but there is 1 thing: http://search.cpan.org/dist/perl-5.12.3/pod/perl5123delta.pod The keys, values, and each function work on arrays now and not just hashes anymore. keys and values aren't too interesting since they just return the indices and values for an array. each should be cool since it returns the index and the value. joe -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with Red Hat - http://enigmail.mozdev.org/ iD8DBQFNQaFYb0mzA2gRTpkRAuMeAJ49FQ8o+p4HgHeZp9tYBVwardGKhQCdFNFv IrKdtZxNXxRztTxDqRxSgjo= =D/wd -----END PGP SIGNATURE-----