The constants are defined as perl subroutines.
Main entry point.
URL to depot tree browser.
URL to change browser.
URL to change viewer.
URL to file viewer.
URL to special file viewer.
URL to special file viewer for HTML
URL to file log viewer.
URL to file diff viewer.
URL to label diff viewer.
URL to search for file.
URL to list all users.
URL to view a user.
URL to list all branches.
URL to list all labels.
URL to view a labels.
Return CGI reference
Example:
my $file = P4CGI::cgi()->param("file") ; print "Parameter \"file\" value: $file\n" ;
Request data from p4. Calls p4 with command command and returns data in result.
This function is really three different functions depeding in the type of the result parameter.
This parameter can be of three different types:
Data from command can be read from filehandle. NOTE! File must be closed by caller.
Returns result from command in array (newlines stripped)
Returns result from command in scalar. (lines separated by newline)
Any other type of parameter will abort operation
Command to send to p4 command line client.
Example:
my $d ; &P4CGI::p4call(\$d,"changes -m 1") ; $d =~ /Change (\d+)/ or &bail("No contact with P4 server") ; $currentChangeLevel=$1 ;
Start a page. Print http header and first part of HTML.
Title of page
Short help text to be displayed at top of page
Example:
my $start = P4CGI::start_page("Title of page", &P4CGI::dl_list("This","Goto this", "That","Goto that")) ; print $start ;
End a page. Print HTML trailer.
Example:
print P4CGI::end_page() ;
Report an error. This routine will emit HTML code for an error message and exit.
Example:
unless(defined $must_be_defined) { &P4CGI::bail("was not defined") ; } ;
Start a table with optional table attributes
This text will be inserted as attributes to table tag
Example:
print P4CGI::start_table("align=center border") ;
Return end of table string. (trivial function included mostly for symmetry)
Insert a row in table.
A list of key/value pairs (a hash will do just fine) containing options for the row.
The key must start with a ``-''.
Most key/value pairs are treated as attributes to the <TR>-tag. The following keys are recognized as special:
Type of cells. Default is <TD>-type.
anykey will be assumed to be a row option and will be inserted in the TR-tag. The value for the option is the key value, unless value is empty or undefined, in which case the option anykey is assumed to have no value.
Row data. Remaining values are assumed to be data for each cell. The data is typically the text in the cell but can also be:
An undefined value indicates that the next cell spans more than one column.
The has contains two keys: ``-text'' for cell text and ``-type'' for cell type. All other key/value pairs are treated as attributes to the <TD> or <TH> tag.
Example:
print P4CGI::start_table("align=center") ; ### print header row print P4CGI::table_row(-type => "th", -valign => "top", -align => "left", "Heading 1","Heading 2",undef,"Heading 3") ; ### print data my %h = (-text => "text in hash", -bgcolor => "blue") ; print P4CGI::table_row(-valign => "top", -bgcolor => "white", "Cell 1", {-text => "Cell 2", -bgcolor => "red"}, \%h, "Cell 3-2") ; print P4CGI::end_table() ;
Return a bulleted list.
Lits of data to print as bulleted list
Example:
print P4CGI::ul_list("This","is","a","bulleted","list") ;
Returns a definition list.
List of data pairs to print as a definition list. A hash will do just fine, only that You have no control of the order in the list.
Example:
print P4CGI::dl_list("This","Description of this", "That","Description of that") ;
Convert all '>' to ``&gt;
'', '<' to ``&lt;
'' and '&' to ``&amp;
''.
String to convert
Example:
my $cvstr = &P4CGI::fixSpecChar("String containing <,> and &") ;
Convert tabs to spaces
String to convert
Create a <A HREF...>...</A> tag pair.
Optional list of option-value pairs. Valid options are:
Url for link. Default is current.
Anchor in url. Default is none.
Any non-valid option marks the end of the options
Optional list of parameters for link.
The last parameter is used as text for link.
Example:
print &P4CGI::ahref("Back to myself") ; # link to this. No parameters.
print &P4CGI::ahref("-url","www.perforce.com", "To perforce") ; # link to perforce
print &P4CGI::ahref("-anchor","THERE", "Go there") ; # link to anchor THERE
print &P4CGI::ahref("-url","chb.cgi", "FSPC=//.../doc/...", "Changes for all documentation") ; # url with parameter
Substitutes magic phrases in text with links.
Currently the pattern ``change number'' is replaced with a link to the change browser.
Example:
my $t = "This change is the same as change 4711, but with a twist" ;
print &P4CGI::magic($t) ; # inserts a link to change 4711
Return parameter with spaces substituted with %20
Example:
my $t = "/File with spaces" ;
print &P4CGI::fixspaces($t) ; # prints: /File%20with%20spaces