Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 API for Perl Documentation | 2025.2

# Class P4::Spec

## Description

`P4::Spec` objects provide easy access to the attributes of the fields in a P4 Server form.

The `P4::Spec` class uses Perl’s AutoLoader to simplify form manipulation. Form fields can be accessed by calling a method with the same name as the field prefixed by an underscore (`_`).

## Class Methods

### $spec = new P4::Spec( $fieldMap ) -> array

Constructs a new `P4::Spec` object for a form containing the specified fields. (The object also contains a `fields` member that stores a list of field names that are valid in forms of this type.)

## Instance Methods

### $spec->_<fieldname> -> string

Returns the value associated with the field named <fieldname>.

    $client = $p4->FetchClient( $clientname );
    $client->_Root();    # Get client root

### $spec->_<fieldname>( $string )-> string

Updates the value of the named field in the spec.

    $client = $p4->FetchClient( $clientname );
    $client->_Root( $newroot );    # Set client root

### $spec->PermittedFields() -> array

Returns an array containing the names of fields that are valid in this spec object. This does not imply that values for all of these fields are actually set in this object, merely that you may choose to set values for any of these fields if you want to.

    my $client = $p4->FetchClient( $clientname );
    my @permitted = $client->PermittedFields();
    foreach $field (@permitted) {
      print "$field\n";
    }

Your search for returned results