Saint Nobody (saintnobody) wrote in lj_dev,
Saint Nobody
saintnobody
lj_dev

Zawinski's Law and the Perl Client...

``Every program attempts to expand until it can read mail. Those programs which cannot so expand are replaced by ones which can.'' -- Jamie Zawinski

anywho, we in the slackware community were discussing the idea of autoposting stuff from the slack-announce and slack-security lists. this would require an email->lj gateway. so last night i sat down with the camel book and the official perl lj client. i made a few minor changes for the sake of anal-retentiveness (it now has 'use strict' and runs with no warnings from the -w flag) i also made a few changes for the sake of feature creep. i gave it an actual interface rather than just checking if it has arguments and posting the first argument as an event (or stdin, if the argument is '-')... anywho, now, in my hacked to pieces version, the following parameters are accepted (pillaged from the new spiffy pod2usage-generated help text):

Usage:
    lj [options] [event-text]
 
Options:
    --rcfile file
            specify an alternate rc file
 
    -S,--smtp-mode
            parse the event as an smtp message and look for LJ-related
            headers (useful with procmail(1))
 
    -d,--debug
            print debugging information
 
    --set-field name=value
            set fields to submit to the server.
 
    -h,--help
            show a help message

see that smtp-mode up there? it causes the event to be read as if it was an smtp message. everything before the first line is iterpreted as headers, and certain headers will translate to fields to be submitted to the server, such as, obviously, Subject. most of the others can be set with a one or two word abbreviation with 'X-' prepended to it (let's obey those rfc's people :-) ) effectively, this creates the email->lj gateway i wanted, suitable for use with procmail.

i also added some POD to it that generates the usage message and can be used to create a man page. i didn't put too much effort into it though. it's pretty minimal.

other ideas i've been kicking around as for what else should go in it are things like having an option that just checks what journals you're allowed to post to. if anybody else has ideas, feel free to drop a comment.

while i'm ranting about using perl and lj, i might as well mention that i've been debating writing coldsync conduits for palmlj. if anybody else is interested in those, let me know.

Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 4 comments