[p4perl] P4Perl in 2007.3

G Barthelemy gb.perforce at googlemail.com
Fri Jun 20 11:28:59 PDT 2008

FetchGroup ($groupName) should return a hashref in 2007.3.

P4::FetchGroup($groupName) is not the same as P4::RunGroup("-o",
$groupName), although both are a shorthand for P4::Run(group, "-o",
$groupName) which now returns either an array or a reference to an
array in scalar context (array of hashes to be more precise). However
P4::FetchGroup only returns the first element of this array of hashes,
in the form of a hashref, so it's adequate for commands that return
just one item such as p4 group -o, p4 user -o, p4 change -o.

Remove the equal sign to the right of your return statement, though.

Anyway, if in doubt you can always use ref() (see
http://perldoc.perl.org/functions/ref.html) to determine the type of
reference returned by a method.


2008/6/20 Scott Lavender <Scott.Lavender at visiprise.com>:
> I know there were changes when P4Perl was rolled into 2007.3. How did the
> return for Fetch change. I have a subroutine that expects it to be a has
> reference. Somehow it has changed to an array, or string. I'm not sure.
> sub getGroup {
>     my ( $groupName ) = @_;
>     return = $p4->FetchGroup( $groupName );
> }
> Can someone explain how I should alter my scripts to account for this? I
> tried using ParseSpec to convert to a hash, but started getting errors. Any
> help would be appreciated.
> Thanks.....
> Scott Lavender | SCM Specialist | Visiprise | office: 770.619.4166 |
> 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.
> _______________________________________________
> p4perl mailing list
> p4perl at perforce.com
> http://maillist.perforce.com/mailman/listinfo/p4perl

More information about the p4perl mailing list