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

I am looking for way way to capture the out put generated by "svn stat" command which list the status of the files, I am writing the script which run svn stat command and if any of the file is modified prompt the user with the file name So my question is when I run "svn stat" it list the file which is modified with "M" at the front so is there any way to capture this "M" and filename? Any suggestion please, Cheers

Replies are listed 'Best First'.
Re: perl capture svn stat
by ELISHEVA (Prior) on Jul 16, 2009 at 08:49 UTC

    RFC: Automating subversion with perl is a bit dense (Zen comments it needs a tutorial and he/she is right) but it contains a list of all of the CPAN subversion modules as of last fall along with a brief summary of the capabilities of each and how they interact with subversion. Maybe it will help.

    Best, beth

Re: perl capture svn stat
by jbt (Chaplain) on Jul 16, 2009 at 03:04 UTC
    You could use SVN::Agent or write a script like:

    open(my $fh, "svn stat |") or die "Can't run svn: $!\n"; while (<$fh>) { if (/^ M/) { my @array = split; my $filename = $array[-1]; } } close $fh;
      Can any one direct me or guide me how "|" works in
      open(my $fh, "svn stat |")
      Cheers

        The documentation for open perhaps? Or even perlopentut?

        The cake is a lie.
        The cake is a lie.
        The cake is a lie.

Re: perl capture svn stat
by Anonymous Monk on Jul 16, 2009 at 03:12 UTC