Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; use HTTP::Request::Common; my $agent = 'Amoe\'s LiveJournaller/0.01'; my $cgi = 'http://www.livejournal.com/cgi-bin/log.cgi'; my $journaller = LWP::UserAgent->new(); $journaller->agent($agent); my %global_params; my $rc_file = 'ljer.rc'; open(RC, "<$rc_file") or die("couldn't open $rc_file: $!"); while (<RC>) { chomp; my ($key, $value) = split /\s*:\s*/, $_, 2; $global_params{$key} = $value; } close(RC); my %login = &login; my $http_res = $journaller->request(POST $cgi, \%login); die "Failed to login" unless ($http_res->is_success); my %lj_res = split("\n", $http_res->content); $lj_res{success} eq 'OK' ? print "logged in as $lj_res{name}\n" : die +"failed to log in: $lj_res{errmsg}\n"; print "server says: $lj_res{message}\n" unless (!$lj_res{message}); my %postevent = &postevent; $http_res = $journaller->request(POST $cgi, \%postevent); die "Failed to update journal" unless ($http_res->is_success); %lj_res = split("\n", $http_res->content); $lj_res{success} eq 'OK' ? print "updated journal successfully with en +try $lj_res{itemid}\n" : print "failed to update journal: $lj_res{err +msg}\n"; exit; sub login { my %params = %global_params; $params{mode} = 'login'; $params{clientversion} = $agent; return %params; } sub postevent { my %params = %global_params; $params{mode} = 'postevent'; $params{lineendings} = 'unix'; $params{security} = 'usemask'; # for public or private e +ntry, change this to 'public' or 'private' and remove '$params{allowm +ask} = 1' $params{allowmask} = 1; @params{'subject', 'event', 'prop_current_music', 'prop_current_mo +od'} = read_text(); @params{'min', 'hour', 'day', 'mon', 'year'} = (localtime(time))[1 +..5]; $params{year} += 1900; $params{mon} += 1; return %params; } sub read_text { print "please enter your subject line:\n"; chomp(my $subject = <STDIN>); my $text; print "please enter your journal entry (terminated by a period on +a single line):\n"; { local $/; $/ = "\n.\n"; chomp($text = <STDIN>); } print "please enter your current music: "; chomp(my $music = <STDIN>); print "please enter your current mood: "; chomp(my $mood = <STDIN>); return $subject, $text, $music, $mood; }

In reply to ljer.pl - command-line LiveJournal client by Amoe

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others drinking their drinks and smoking their pipes about the Monastery: (12)
    As of 2014-09-22 18:26 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (198 votes), past polls