List Info

Thread: Client Field References




Client Field References
user name
2006-08-02 12:19:02
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?
 
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' } ...
 
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 visiprise.com">ITARvisiprise.com for instructions and authorization to transmit such data.

 
Client Field References
user name
2006-08-02 15:09:23
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
p4perlperforce.com

http://maillist.perforce.com/mailman/listinfo/p4perl
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )