{{Project|Pre-Submit Trigger Examples|
curator=Jeff Bowles|
path=//guest/perforce_software/triggers/|
language=various|
download=//guest/perforce_software/triggers|
brief=Example Perforce pre-submit triggers}}
== Example Perforce pre-submit triggers ==
===Description===
The following scripts were written and contributed by {{DepotFile|//guest/jeff_bowles/jab.html|Jeff Bowles}} and {{DepotFile|//guest/wes_peters/pcp.html|Wes Peters}}. These scripts are all "submit"-type triggers and were written prior to the introduction of other trigger types, such as form triggers. More recent and varied trigger examples can be found in the [http://www.perforce.com/perforce/doc.current/manuals/p4sag/06_scripting.html Perforce System Administrator's Guide].
{| cellspacing=0
|-
| style="width:100px;" | '''Script Name'''
|'''Description'''
|- class=zebra
|{{DepotBrief|//guest/perforce_software/triggers/Jobs.pl}}
|Example trigger to enforce a rule "submissions must be associated with a job.".
|-
|{{DepotBrief|//guest/perforce_software/triggers/Jobs.sh}}
|Similar to above, but contributed by {{DepotFile|//guest/wes_peters/pcp.html|Wes Peters}} and written in Unix "shell". ''Takes a different approach to the problem, running "p4 fixes" to determine whether you're fixing something with this submission.''
|- class=zebra
|{{DepotBrief|//guest/perforce_software/triggers/Pairs.pl}}
|Example trigger to enforce a rule "files of suffix .x/.y need to be checked in as pairs".
|-
|{{DepotBrief|//guest/perforce_software/triggers/Binary.pl}}
|Example trigger to enforce a rule "submissions of .gif must binary files and .sh files should be text and...."
|- class=zebra
|{{DepotBrief|//guest/perforce_software/triggers/simple.cmd}}
|Classroom example of writing a trigger using the Windows/NT command shell, a.k.a. "a ''.cmd'' script". (It checks that "Bug:" is included in the change description.) Doesn't do a lot, but gets the idea across.
|}
[[Category:Perl]]
[[Category:Shell]]
[[Category:Perforce administrative tools]]