describe.pl #1

  • //
  • guest/
  • ian_barberi/
  • scripts/
  • describe.pl
  • View
  • Commits
  • Open Download .zip Download (2 KB)
use CGI qw(:standard);
use strict;
my $script = new CGI;

#
# Get the Changelist
#

my $choose = 0; #set to let user pick the changelist
if (!$script->param('changenum')) { #see if parameters are sent to the script via the link, like "...describe.pl?changenum=100" overrides all
    $choose++;
}

#
# Provide a form for the user to enter the raw subdoc
#

if ($choose){

    print $script->header();
    print $script->start_html(-title=>"Please enter a changelist number to describe");
    print qq(<font size="5" face="Minion Web">Please enter a changelist number to describe:</font>);
    
    print qq(<FORM METHOD="POST" ACTION="http://$ENV{'SERVER_NAME'}$ENV{'SCRIPT_NAME'}">);

    print p(textfield      (-name    =>'changenum',
                            -size    => 8,
    ));

    print qq(<INPUT TYPE=SUBMIT VALUE="Submit">);
    print qq(</FORM>);
    print $script->end_html;
    exit;


#
# Provide a form for the user to enter the raw subdoc
#
} else {

    my $changenum = $script->param('changenum');
    print $script->header();
    print $script->start_html(-title=>"Description of changelist $changenum");
    print qq(<font size="5" face="Minion Web">Description of changelist $changenum</font><br><br>);
    system qq(p4 -u {your username} -P {password} describe -s $changenum > c:\\temp\\describe.tmp);
    open (DESCRIBE, "c:\\temp\\describe.tmp");
    my $describe;
    while (<DESCRIBE>) {
      $describe = $describe . $_ . "<br>";
    }
    close DESCRIBE;
    print qq($describe);
    print $script->end_html;
    exit;
}

# Change User Description Committed
#1 5229 Ian Barberi Adding perl CGI script to output "p4 describe" of a changelist.

Useful for people who do not have a Perforce account and yet want to see the submission description.