Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

CVS web interface

by davinci (Initiate)
on Aug 09, 2000 at 21:23 UTC ( #27109=perlquestion: print w/replies, xml ) Need Help??
davinci has asked for the wisdom of the Perl Monks concerning the following question:

Is there some way to use perl to issue cvs command from a web based interface? I've tried using exec(). system(), and ``. The script works fine from the command line, but it doesn't actually execute from a web call. Any advice??

Replies are listed 'Best First'.
Re: CVS web interface
by tiny (Beadle) on Aug 09, 2000 at 22:12 UTC
    I actually wrote a nifty web-based code review tool that is built around CVS. (I might release it someday if my company will allow it :) Here is how I did the CVS part of it. This code uses IPC to talk to CVS and retrieves a specific version number out of CVS and runs it through enscript to color-code it. The enscript part is just for fun :)
    my $cobin = "/usr/local/bin/co"; my $enscript = "/usr/local/bin/enscript"; my $cvs_repos = "/path/to/cvs/repository"; my $rev = "1.1" my $file = ""; open(CVS, "$cobin -r$rev -p $cvs_repos/$file 2>&1 |"); @code = <CVS>; # write it to a temp file so enscript can use it open(TMPCVS, ">/tmp/tmpcvs.$$"); foreach (@code) { print TMPCVS $_; } close(CVS, TMPCVS); # the 2>/dev/null drops all stderr text, which is usually "output left + in -". This would have ended up either in the code # or the log file. open(ENSCRIPT, "$enscript --pretty-print=perl -G --language=html --col +or -p- /tmp/tmpcvs.$$ 2>/dev/null |"); my @source = <ENSCRIPT>; close(ENSCRIPT); unlink("/tmp/tmpcvs.$$");
    Probably a little bit more there than what you needed, but hopefully that can help answer your question. You might also want to check out the Python script ViewCVS. I fumbled my way through this in order to figure out how to use the 'co' command.
Re: CVS web interface
by KM (Priest) on Aug 09, 2000 at 21:28 UTC
    Do you get errors (what does $! say?). May be a permission problem with the web user vs. you (from the command line). I haven't used these myself, but these modules may be of use. But, I would be interested in the error messages (if any) from your system(), etc... attempts.


      I have already though about the user problem. Is there a way to set the 'User' of the script from within PERL?
        Look here for a possible solution to your problem.


RE: CVS web interface
by Anonymous Monk on Aug 09, 2000 at 22:12 UTC
    things done via the web are done as user nobody im sure you know... so maybe give user nobody permissions to read/write in your cvs writers file...might help things along...worth a shot.. of course if it worked it would be opening a large door...

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://27109]
Approved by root
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2018-01-24 06:52 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (256 votes). Check out past polls.