[p4perl] Problem Running P4Perl Based Triggers After LinuxSystemUpdate

Scott Lavender Scott.Lavender at visiprise.com
Fri May 9 07:21:33 PDT 2008


Ah! This returns a reference to an array of hash table references....
That's a mouth full.

So, I was able to get at the Jobs using this version:

# Try getting list of all Jobs
my @jobs = $p4->RunJobs();
if ( $#jobs >= 0 )
{
    foreach $job ( @jobs )
    {
        print "$job->{ 'Job' }\n";
    }
}
else
{
    print "There are no jobs...\n";
}

Thanks.....Scott...

-----Original Message-----
From: Peter Prymmer [mailto:PPrymmer at factset.com] 
Sent: Friday, May 09, 2008 10:06 AM
To: Scott Lavender
Cc: p4perl at perforce.com; p4perl-bounces at perforce.com; Tony Smith
Subject: Re: [p4perl] Problem Running P4Perl Based Triggers After
LinuxSystemUpdate

p4perl-bounces at perforce.com wrote on 05/09/2008 09:21:42 AM:

> "Scott Lavender" <Scott.Lavender at visiprise.com> 
> Sent by: p4perl-bounces at perforce.com
> 
> 05/09/2008 09:21 AM
> 
> To
> 
> "Peter Prymmer" <PPrymmer at factset.com>
> 
> cc
> 
> p4perl at perforce.com, Tony Smith <tony at smee.org>
> 
> Subject
> 
> Re: [p4perl] Problem Running P4Perl Based Triggers After 
LinuxSystemUpdate
> 
> This is usually how I do things with P4Perl. Usually these return a
> scalar reference to an array or hash that can be dereferenced later.
> Maybe Tony can set me straight... ;) 

If it is a scalar reference to an array (admittedly I should consult 
the docs to discern) then perhaps you intended to
dereference the array when accessing it.  That is, instead of:

my $jobs = $p4->RunJobs();
if ( $#jobs >= 0 )
{
    foreach $job ( @jobs )
    {
        print "$job\n";
    }
}
else
{
    print "There are no jobs...\n";
}

Perhaps you wanted to write (note the extra $jobs in two places below):

my $jobs = $p4->RunJobs();
if ( $#$jobs >= 0 )
{
    foreach $job ( @$jobs )
    {
        print "$job\n";
    }
}
else
{
    print "There are no jobs...\n";
}

Peter Prymmer




More information about the p4perl mailing list