The list that it's reading from is indeed trusted, so data security isn't an issue - But I'll try to use the more secure method as best practice.

I think I may have been a bit unclear - I already have a directory list that I'm reading in from a file, and for each entry in that list, I'm running a 'cvs co filename.xx' on it.

The list is generated by the end user, and will as such have files that aren't project specific in it. (Scratch files, ideas, temp files, etc).

What I'm looking to do is before I run the 'cvs co filename.xx', is to somehow check the 'cvs log filename.xx' command and capture the result of that, then have something along the lines of:

If: (CVS Log returns that the file is valid, version info, etc) - cvs co (the file).

Else: Print "That file's not in the tree, and Seventh asks too many silly questions on Perlmonks.org'.

Here's the whole script, what I'm looking to do is edit the read loop:
#!/usr/bin/perl -w # # Author: Chris Q # Date: 12/2004 # Desc: Common CR master util # # Key: [ ] - Not yet started # [%] - Partially complete, (known to be broken) # [!] - Complete, but undebugged # [X] - Complete # [?] - Thinking on it (don't know how yet) # [-] - Hell with it. # ToDo: # [ ] - Single character switches # [X] - Help Link # [X] - Empty Variable # # Bugs: # [ ] - # # Questions: # [ ] - use Getopt::Long; use strict; use Data::Dumper; use IO::File; my ($read,$generate,$help); # option switches GetOptions ( "help" => \$help, "read" => \$read, "generate" => \$generate, ); if (!$read && !$help && !$generate) { print "\nMissing Switch. Run with -help for options.\n"; } #################################### ## READ LOOP ## #################################### if ($read) { my $fh2 = new IO::File("; my $state2 = join("", @state2); foreach my $f (@state2) { print "File is $f\n"; # swap this with cvs co command `cvs co $f`; } } ################################### ## GEN LOOP ## ################################### if ($generate) { system ("clear"); print "Building project config.\n\n"; sub find { my ( $dir ) = @_; my $dh; my @theseFiles; + opendir $dh, $dir or return; while(my $file = readdir $dh ) { next if $file =~ /^\.{1,2}$/; my $full_file = "$dir/$file"; if ( -d $full_file ) { push(@theseFiles,find($full_file)); } else { push(@theseFiles,$full_file); } } closedir $dh; return @theseFiles; } my @files = find('.'); my @noCvsDirs; foreach my $file (@files) { push(@noCvsDirs,$file) unless(($file =~ /\/CVS\//) || ($file = +~ /\~/)); } my $state = join("\n",map { s{^\./}{}; $_} @noCvsDirs); my $fh = new IO::File(">ccrConfig.cfg"); die("Checkpoint failed for ccrConfig.cfg - $!\n") unless($fh); my $bytes = $fh->syswrite($state, length($state)); $fh->close(); unless($bytes == length($state)) { die("Checkpoint failed, incomplete write for ccrConfig.cfg\n") +; } else { print "Saved $bytes bytes into file: ccrConfig.cfg\n"; } exit; } ############################### ## Help Loop ## ############################### if ($help) { system ("clear"); print "Common Code Repository Utility v1.1\n\n"; print "|| ccrutil -generate ||\n\n"; print "Generates a project configuration file named\n"; print "ccrConfig.cfg to be included in your project.\n"; print "This file contains a list of all project files\n"; print "and related CCR includes, omitting temporary\n"; print "files and CVS control files.\n\n"; print "|| ccrutil -read ||\n\n"; print "Reads in a ccrConfig.cfg file from a project,\n"; print "and checks out any associated files.\n\n"; }
Does that make sense?

Thank you very much once again - I really appreciate the help and apologize in advance if I'm missing something blatantly obvious as a result of my inexperience. :)

In reply to Re^2: Looking to confirm a file against CVS as part of a loop by Seventh
in thread Looking to confirm a file against CVS as part of a loop by Seventh

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.