[p4] perl trigger

Robert McKenna robertm at bioware.com
Mon Nov 27 15:21:36 PST 2006


Wrapping the trigger command in a shell script has resolved the original
problem.

Rob McKenna   

-----Original Message-----
From: perforce-user-bounces at perforce.com
[mailto:perforce-user-bounces at perforce.com] On Behalf Of David Alban
Sent: Monday, November 27, 2006 1:48 PM
To: perforce-user at perforce.com
Subject: Re: [p4] perl trigger

Mea culpa!  You did say:

  change this to ... or ...

Sorry!  I misread it as:

  change this ... to this ...

-- 
David Alban <dalban at stubhub.com>
Release Engineering Tools
http://StubHub.com/

-----Original Message-----
From: Ken.Williams at thomson.com [mailto:Ken.Williams at thomson.com] 
Sent: Tuesday, November 21, 2006 4:13 PM
To: David Alban; perforce-user at perforce.com
Subject: RE: [p4] perl trigger

 

> -----Original Message-----
> From: perforce-user-bounces at perforce.com 
> [mailto:perforce-user-bounces at perforce.com] On Behalf Of David Alban
> Sent: Friday, November 17, 2006 11:55 AM
> To: perforce-user at perforce.com
> Subject: Re: [p4] perl trigger
> 
> > You've got an operator precedence problem there.  Change to this:
> > 
> >    @FILES = `ls -l /perforce/triggers` or die("Bombed");
> > 
> > Or this:
> > 
> >   (@FILES = `ls -l /perforce/triggers`) || die("Bombed");
> 
> There is no operator precedence problem in either statement. 
> Changing from the first statement above to the second does not change
> the behavior of the code.

The operator precedence problem was in the original code Rob posted:

  @FILES = `ls -l /perforce/triggers` || die("Bombed");


Try that in a one-liner and you'll see the problem:

% perl -le '@F = `ls -l` || die(); print "Files: ". at F'
Files: 1

% perl -le '@F = `ls -l` or die(); print "Files: ". at F'
Files: 96

There are 96 files in that directory, but the first version of the code
concatenates them into one big string because the precedence problem
forces a scalar context for the backticks.

 -Ken

_______________________________________________
perforce-user mailing list  -  perforce-user at perforce.com
http://maillist.perforce.com/mailman/listinfo/perforce-user




More information about the perforce-user mailing list