#!/usr/bin/perl -w # -*- perl -*- use P4CGI ; use strict ; # ################################################################# # CONFIGURATION INFORMATION # All config info should be in P4CGI.pm # ################################################################# # # P4 special file viewer for HTML, JPEG and GIF files # View a "special" file # ################################################################# # Get type arg my $type = P4CGI::cgi()->param("TYPE") ; &P4CGI::bail("No file type specified") unless defined $type ; # Get file spec argument my $file = P4CGI::cgi()->param("FSPC") ; &P4CGI::bail("No file specified") unless defined $file ; my $revision = P4CGI::cgi()->param("REV") ; &P4CGI::bail("No revision specified") unless defined $revision ; if($type eq "HTML") { print "Content-type: text/html\n\n" ; local *P4 ; &P4CGI::p4call( *P4, "print $file#$revision" ); <P4> ; while(<P4>) { print ; } ; } elsif($type eq "GIF") { print "Content-type: image/gif\n\n" ; local *P4 ; &P4CGI::p4call( *P4, "print $file#$revision" ); <P4> ; while(<P4>) { print ; } ; } elsif($type eq "JPEG") { print "Content-type: image/jpeg\n\n" ; local *P4 ; &P4CGI::p4call( *P4, "print $file#$revision" ); <P4> ; while(<P4>) { print ; } ; } else { &P4CGI::bail("Unknown type $type!") ; } ; # # That's it folks #
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 2778 | Jay Han | creating guest branch per tutorial http://public.perforce.com/public/tutorial.html | ||
//guest/perforce_software/utils/p4db/P4DB_0/sfv.cgi | |||||
#1 | 1885 | rmg |
For posterity: Make the old version appear in a "P4DB_0" subdirectory. (I'd have called it 0.99, but I'm not sure it really *is* 0.99!) |
||
//guest/perforce_software/utils/p4db/sfv.cgi | |||||
#1 | 11 | Perforce maintenance | Add Fredric Fredricson's depot browser, P4DB. |