Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Hello awwaiid!

    I hope this means you'll continue to share ideas more, in the spirit of those PM presentations of yore.

    By the way, here's my ReCAPTCHA client implementation for TinyWiki (just fixed a problem with this the other day, where their server was no longer defaulting to that Content-Type):

    sub captcha {   # optional -- uses recaptcha.net's free service; this is called from RetroWikiHeader when $actioneq 'save'; the privatekey file emits the private key (without trailing newline) when run and has its execut bits set but not read bits
        socket my $s, 2, 1, 6 or die $!; connect $s, "\x00\x02\x00\x50\x40\x22\xfb\x98\x00\x00\x00\x00\x00\x00\x00\x00" or die $!; # little endian
        $recaptcha_response_field =~ s/ /\+/g; my $postdata = join '', 'privatekey=', `/home/httpd/privatekey`, '&remoteip=', $rip, '&challenge=', $recaptcha_challenge_field, '&response=', $recaptcha_response_field;
        syswrite $s, "POST /verify HTTP/1.0\r\nContent-type: application/x-www-form-urlencoded\r\nContent-Length: " . length($postdata) . "\r\n\r\n" . $postdata; return join '', <$s>; }
    Of course, you'll have to re-pre-compute the sockaddr struct for big endian machines. (Or is it the other way around? I can never keep those straight.)

    The template for editing includes a call to the recaptcha thingie, and a call to this is inserted before save.

    -scott
    • Yeah, one day I realized that I have a bigger audience of people who might actually care here than on my own site. I'll probably cross-post some stuff.

      Interesting implementation. It shows how simple the protocol is. But I think I'll just stick with what I have (call it the lazy way, if you like) :)

      Hmm... maybe TinyWiky should have a mechanism for page-scripts to use CPAN modules... make them automatically cached or something...