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

script heading

by naChoZ (Curate)
on May 06, 2003 at 12:49 UTC ( #255864=perlquestion: print w/replies, xml ) Need Help??

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

I see some people with this type of heading in their scripts:

# $Id: foo.pl,v 1.4 2003/05/06 08:10:06 andy Exp $

I know it's related to rcs/cvs which I'm familiar with, but is there some automated way of inserting/maintaining this in my scripts?

naChoZ

Replies are listed 'Best First'.
Re: script heading
by hiseldl (Priest) on May 06, 2003 at 13:58 UTC

    If you want to add a $VERSION variable to your script or package you could use something like this:

    use vars qw($VERSION); $VERSION = sprintf "%d.%03d", q$Revision: 1.12 $ =~ /(\d+)\.(\d+)/;
    When you check this out with RCS, the string between q$ $ will get updated with the RCS version, and the regexp will update your $VERSION variable.

    HTH

    --
    hiseldl
    What time is it? It's Camel Time!

Re: script heading
by derby (Abbot) on May 06, 2003 at 12:56 UTC
    Check out the man page for ident and look at the keyword section. There it tells you how to construct the meta strings for these but you're going to need some type of utility (rcs, cvs) that understands the keywords in order to expand them.

    -derby

Re: script heading
by nite_man (Deacon) on May 06, 2003 at 15:38 UTC
    If you just want to insert this in your script and you use CVS simple write on top your code or somewhere $Id$ and commite your script. After this you will see the same row in your script.
    And, of course, you can use this information as hiseldl described.
          
    --------------------------------
    SV* sv_bless(SV* sv, HV* stash);
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://255864]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2022-05-22 17:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (80 votes). Check out past polls.

    Notices?