water has asked for the wisdom of the Perl Monks concerning the following question:

Dumb question: without flagging the file as binary, how can I change this subroutine so that (1) it still does the same thing, and (2) CVS no longer intermittently mangles the $Log comment (yup, really!)?

# code snipped from L:L4p FAQ $SIG{__WARN__} = sub { local $Log::Log4perl::caller_depth; $Log::Log4perl::caller_depth = $Log::Log4perl::caller_depth + 1; $logger->logconfess(@_); };
Thanks --

Wa#$Header: /home/MYCVSROOT/mycode/lib/MyLog.pm,v 1.8 2004/06/04 04:20:57 team Exp $ter

that sig was a joke, problem is real

Replies are listed 'Best First'.
Re: CVS mangles $Log statement (dumb)
by broquaint (Abbot) on Jun 05, 2004 at 10:55 UTC
    Just delimit the variables with braces i.e
    $SIG{__WARN__} = sub { local ${Log::Log4perl::caller_depth}; ${Log::Log4perl::caller_depth} = ${Log::Log4perl::caller_depth} + 1; $logger->logconfess(@_); };
    HTH

    _________
    broquaint

Re: CVS mangles $Log statement (dumb)
by robartes (Priest) on Jun 05, 2004 at 12:05 UTC
    As an alternative to broquaint's suggestion, you could always pass -ko to the cvs commands. This quickly becomes a pain though, so perhaps a wrapper script around the cvs binary that adds this flag to each incantation might help. broquaint's solution, however, is the more elegant one.

    CU
    Robartes-

      You only need to do this once, by using the 'cvs admin' command. This sets the file to not expand keywords when checked out. It only needs to be set once, instead of with every checkout command.

      This alleviates having to make a wrapper script, or putting it into .cvsrc, either of which really mean you have to decide to expand keywords (or not) globally. Setting it via 'cvs admin' means you can decide file by file, which is often much more correct for the contents of your repository.

      Instead of a wrapper script, one could make use of the $HOME/.cvsrc configuration file:
      cvs -ko # any other command specific options here