First, I think that 'use strict' would help you immensely. You have two variables, $logmsg and $log_msg in the log_msg routine, and I'm quite certain that is not what you want!

Second, you are not setting the log message properly. Since, as the documentation says, the first parameter is a reference to a scalar that should get the log message, you should be doing

${ $log_msg } = message();
(Don't put the leading ampersand on a subroutine call; this makes Perl do funny things like ignore prototypes, none of which you care about, but which could bite you at a later date. Just get out of the habit of using & on subroutines unless you're creating references to them.)

Your code as it stands seems to want to read standard input, write it to a file, and then read that back in again to set the log message. This could be loads simpler - just read it once, write it out, and then take the copy you already have to set the message:

open my $fh, '>>', $filename or die "Can't open $filename for appe +nd: $!"; my @lines = <STDIN>; print $fh @lines; close $fh; ${ $log_msg } = join("", @lines); return;
If there was some reason that you might get an error, then you'd return
return SVN::Error::create($apr_err, $child, $message);
$apr_err is documented in there somewhere, not sure where though. The default error handler should be sufficient unless you want to do something like trap errors writing to the log via eval and pass back a specific "hey, I can't log the message" error.

Leave $citem alone; you can do everything you want with just the $log_msg reference. I found all this poking at SVN::Core and SVN::Client - this much should get you considerably further than you are now.


In reply to Re^3: SVN API log_msg help by pemungkah
in thread Reaped: SVN API log_msg help by NodeReaper

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!
  • 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, details, 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, summary, 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.