Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
#!/usr/bin/perl -w use strict; use subs 'make_cookie'; use Getopt::Std; use Digest::MD5 'md5_hex'; use HTTP::Cookies; use SOAP::Lite; use XML::RSS; my (%opts, $title, $discuss, $readfh, $body, $host, $uri, $proxy, $cookie_file, $cookie_jar, $journal, $result); getopts('c:m:f:C:', \%opts) or die <<"USAGE"; Usage: $0 [ -m title ] [ -f file ] [ -c yes|no ] [ -C user:pass ] where: -m title Provide title for the journal entry (default is command name-based) -f file Read the journal entry from FILE instead of STDIN -c yes|no Allow or disallow comments (default is to let your default stand) -C user:pass Provide authentication credentials in place of (or in absence of) Netscape cookie authentication. User in this case is UID, not nickname. USAGE $title = $opts{'m'} || "Generated by $0"; $discuss = (exists $opts{c} && $opts{c} =~ /no/i) ? 0 : 1; if ($opts{f}) { open(FILE, "< $opts{f}") or die "$0: Error opening $opts{f}: $!\n" +; $readfh = \*FILE; } else { $readfh = \*STDIN; } $body = join('', "<!-- posted by $0 -->\n", <$readfh>); $host = ''; $uri = "http://$host/Slash/Journal/SOAP"; $proxy = "http://$host/"; $cookie_file = "$ENV{HOME}/.netscape/cookies"; if ($opts{C}) { $cookie_jar = HTTP::Cookies->new; $cookie_jar->set_cookie(0, user => make_cookie(split /:/, $opts{C}, 2 +), '/', $host); } elsif (-f $cookie_file) { $cookie_jar = HTTP::Cookies::Netscape->new(File => $cookie_file); } else { die "$0: No authentication data found, cannot continue"; } $journal = SOAP::Lite ->uri($uri) ->proxy($proxy, cookie_jar => $cookie_jar); die "$0: Error creating SOAP::Lite client, cannot continue" unless $journal; $result = $journal->add_entry(subject => $title, body => $body, discuss => $discuss); if ($result->fault) { die "$0: Operation failed: " . $result->faultstring . "\n"; } else { printf "New entry added as %s\n", $result->result; } exit; # Taken from the Slash codebase sub make_cookie { my ($uid, $passwd) = @_; my $cookie = $uid . '::' . md5_hex($passwd); $cookie =~ s/(.)/sprintf("%%%02x", ord($1))/ge; $cookie =~ s/%/%25/g; $cookie; } __END__

In reply to Post a journal entry to by rjray

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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?

    What's my password?
    Create A New User
    [1nickt]: ... the end of the afternoon. marto How are you, snowed in? Mum and Dad expecting snow today in Surrey. (Have 5" on the ground here in NJ. And my son's high school in SOCal closed until after Xmas due to fires.)
    [Corion]: 1nickt: In a sense the meta-bullshit might even be beneficial to you as you get to hear the cow-orkers talk (or not talk) about the issues you perceive. I think Agile is mostly about the meta ;)
    [Corion]: 1nickt: On Sunday maybe 10cm of snow fell, and the airport closed, and the trains stopped running etc :) It always comes as a surprise that snow falls here during the winter...
    [marto]: 1nickt, no snow, just some ice on the roads and the usual idiocy associated with humans and driving in less than ideal conditions

    How do I use this? | Other CB clients
    Other Users?
    Others meditating upon the Monastery: (5)
    As of 2017-12-11 11:49 GMT
    Find Nodes?
      Voting Booth?
      What programming language do you hate the most?

      Results (289 votes). Check out past polls.