[p4perl] Trigger Script Issue

Scott Lavender Scott.Lavender at visiprise.com
Tue Sep 2 06:24:26 PDT 2008


I have a problem with part of my trigger script. It runs fine from the
command line, but fails for some unknown reason when run by the server
by a trigger event. I have a trigger associated with submits to verify
that the user has associated a valid job/incident. This has worked in
the past(2006.1 - 7003.2), but has not worked since moving to 2007.3.
 
p4 info
User name: build
Client name: build_P4Admin
Client host: perforce.visiprise.com
Client root: /export/perforce/admin
Current directory: /export/perforce
Client address: 127.0.0.1:60058
Server address: perforce.visiprise.com:1666
Server root: /export/perforce/root
Server date: 2008/09/02 08:23:54 -0400 EDT
Server version: P4D/LINUX26X86/2007.3/152469 (2008/04/24)
Server license: Visiprise Inc 154 users (support ends 2009/05/11)

Triggers:
 checkForFixes change-submit //...
"/export/perforce/admin/triggers/test/verifyFixes.pl %change% %user%"
 
I have done some troubleshooting and determined that the call to
FetchJob is failing only when run as a trigger. Here is the subroutine
that I call from my job/incident validation routine, getJob(). There is
a call to commandStatus immediately after the call to FetchJob. I did
this to hopefully trap any warnings or errors. If I run my script from
the command line, everything flows as expected. But, when used as a
trigger, the script terminates and the trigger completes with a return
of '1'. This causes all of my incident validation to be short circuited.
None of the validation takes place. Any ideas?
 
sub getJob {
    my ( $job ) = @_;
 
    my $jobHashRef = $p4->FetchJob( $job );
    commandStatus();
 
    return( $jobHashRef );
}
 
#------------------------------------------------
# Error handling subroutines
#------------------------------------------------
sub commandStatus {
 
    if ( $p4->WarningCount() )
    {
        displayWarnings();
    }
 
    if ( $p4->ErrorCount() )
    {
        displayErrors();
    }
}
 
sub displayWarnings {
    my $warnings = $p4->Warnings();
 
    foreach $warning ( @{$warnings} )
    {
        ScriptBase::warningMessage( $warning );
    }
 
    return $warnings;
}
 
sub displayErrors {
    my $errors = $p4->Errors();
 
    foreach $error ( @{$errors} )
    {
        ScriptBase::errorMessage( $error );
    }
 
    return $errors;
}




Scott Lavender | SCM Specialist | Visiprise | office: 770.619.4166 |
www.visiprise.com <http://www.visiprise.com/> 
 
It is our company policy not to accept email of any data controlled by
the International Traffic in Arms Regulations (ITAR). Please direct
inquiries to ITAR at visiprise.com for instructions and authorization to
transmit such data.

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.perforce.com/pipermail/p4perl/attachments/20080902/3ae17f4f/attachment-0001.html>


More information about the p4perl mailing list