Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/perl/bin/perl print "Content-type: text/html\n\n\n\n"; ### Get the name of the file being requested. #my $Temp = $ENV{'REQUEST_URI'}; my $Temp = "../dcheck.pl"; my $Cvs = $Temp; ### Split the url by "/". my (@Junk) = split(/\//, $Cvs); ### Get the end of the url, which is the filename. my $File = pop @Junk; $Cvs =~ s/[^\/]+$//g; ### Attach the document root directory so we get the complete path t +o the ### file on our computer server. Also, attach the CVS/Entries name s +o that ### we get the CVS information. $Cvs = $ENV{'DOCUMENT_ROOT'} . $Cvs . "CVS/Entries"; ### Open the file, and if we find a match, record it to $Match my $Match = ""; open(FILE,$Cvs); while (my $Line = <FILE>) { if ($Line =~ /$File/) {$Match = $Line; chomp $Line} } close FILE; ### If match is not found, print not found, otherwise get the infor +mation. if ($Match eq "") {print "No CVS information found. '$File'\n";} else { ### Get the information we want and print it out. my ($Junk,$File,$Version,$Date,@Junk) = split(/\//, $Match); print "Version <b>$Version</b> : Date Last Changed <b>$Date</b>\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CVS Version of a File
by planetscape (Chancellor) on Jul 06, 2006 at 20:13 UTC | |
|
Re: CVS Version of a File
by starbolin (Hermit) on Jul 07, 2006 at 07:01 UTC |