On Wednesday 02 August 2006 13:19, Scott Lavender wrote:
> Can anyone tell me why the Client field of the Client
record is referenced
> as all lower case, while the rest of the fields have
their first letter
> capitalized?
Backwards compatibility with the output of older releases I
think. It
certainly goes back to 99.2 when tagged output for 'p4
clients', 'p4 labels'
and 'p4 branches' was introduced.
> It took me a while to realize this, after several hours
debugging this
> code:
>
> my $clients = $p4->Clients();
>
> my userClients = ();
> foreach my $client ( {$clients} )
> {
> if ( $client->{ 'Owner' } eq $user )
> {
> push ( userClients, $client->{
'client' } );
> }
> }
>
> Originally, I had used $client->{ 'Client' }
instead of $client->{ 'client'
> } ...
Yes, it's an unfortunate anachronism and easy to be caught
by. Unfortunately,
there are plenty of scripts out there that depend on it, so
changing it now
would break a lot of things for a lot of people.
Note that if you call 'FetchClient()', then the field is
called 'Client'. You
can see this yourself by running:
p4 -ztag clients
p4 -ztag client -o (with a 2005.2, or later, server)
Note that the same duality is present for labels and
branches too (i.e.
'label' vs. 'Label' etc.); also a vestige of the 99.2
tagged support for
these commands.
Regards,
Tony
_______________________________________________
p4perl mailing list
p4perl perforce.com
http://maillist.perforce.com/mailman/listinfo/p4perl
|