info-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: trying to add a perl script file


From: Keith Thompson
Subject: Re: trying to add a perl script file
Date: Fri, 07 Oct 2005 01:43:28 GMT
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

"DHARNA, AJAY [AG/1000]" <address@hidden> writes:
> I have a perl script file that contains the following code:
>
>     name    => \$appender_name,
>                 level   => \$Log::Log4perl::Level::L4P_TO_LD{\$level},   
>                 message => \$message,
>
> When I do an add selection on this file, CVS converts this code to become
> this:
>
>           name    => \$appender_name,
>                 level   => \$Log: Logger.pm,v $
>                 level   => \Revision 1.3  2005/10/04 20:15:21  ardharn
>                 level   => \no message
>                 level   => \level},   
>                 message => \$message,
>
> Is there any way of adding this file as it is to the CVS repository without
> it doing this.

Mark D. Baushke has explained how to suppress keyword expansion for a
file using "-ko", but that's a problem if you want to have keywords
expanded at, say, the top of the file.  You can usually tweak the Perl
code so it doesn't look like a CVS keyword.  In this case, you can try
this:
========================================================================
# $Id:$
# $Source:$
...

    name    => \$appender_name,
    level   => \$Log
                    ::Log4perl::Level::L4P_TO_LD{\$level},
    message => \$message,
========================================================================

The Id and Source keywords are expanded; Log is not because the
trailing '$' is on the next line.

I often run into a similar problem with Perl code like this:

    open FILE, $file or die "$file: $!\n";

There's no keyword to expand, but the "ident" command (part of RCS,
not CVS) picks up the "$file: $".  I avoid this by changing it to:

    open FILE, $file or die "${file}: $!\n";

-- 
Keith Thompson (The_Other_Keith) address@hidden  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center             <*>  <http://users.sdsc.edu/~kst>
We must do something.  This is something.  Therefore, we must do this.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]