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

P4 API for Perl Documentation | 2025.1

# Class P4::Resolver

## Description

`P4::Resolver` is a class for handling resolves in P4 Server. It is intended to be subclassed, and for subclasses to override the `Resolve()` method. When `P4::RunResolve()` is called with a `P4::Resolver` object, it calls the `P4::Resolver::Resolve()` method of the object once for each scheduled resolve.

## Class Methods

### $actionResolve() -> string

Enables support for resolves of branches, deletes, and file types. This method is invoked if an action resolve is required. It lets you add a callback in your Resolver implementation to determine what the resolve action should be after the automatic resolver has evaluated it. This is similar to resolves in P4V, when you are prompted to select what you want to do, given what the automatic resolver suggested. The `$resolver->ActionResolve()` method receives an argument (`mergeData`) and lets you return a string that specifies what to do. See $resolver.Resolve() for available strings.

The following example counts the number of times it has been called (line 5), stores the `mergeData` from the autoresolver (`type`, `hint`, and `info`) and returns what the automatic resolver suggested (`hint`) on line 10 as the answer.

    sub ActionResolve( $ ) {
        my $self      = shift;
        my $mergeData = shift;

        $self->{'ActionResolve'} += 1;
        $self->{'type'} = $mergeData->Type();
        $self->{'hint'} = $mergeData->MergeHint();
        $self->{'info'} = $mergeData->MergeInfo();

        return $mergeData->MergeHint();
    }

## Instance Methods

### $resolver.Resolve() -> string

Returns the resolve decision as a string. The standard P4 Server resolve strings apply:

String | Meaning
--- | ---
`ay` | Accept Yours.
`at` | Accept Theirs.
`am` | Accept Merge result.
`ae` | Accept Edited result.
`s` | Skip this merge.
`q` | Abort the merge.

By default, all automatic merges are accepted, and all merges with conflicts are skipped. The `P4::Resolver::Resolve()` method is called with a single parameter, which is a reference to a `P4::MergeData` object.

Your search for returned results