The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Articulate::Flow::LocationSwitch - case switching for location

CONFIGURATION

  - class: Articulate::Flow::LocationSwitch
    args:
      where:
        '/assets/*/*/*':
          - Enrich::Asset
      otherwise:
        - Enrich::Content

DESCRIPTION

This provides a convenient interface to a common branching pattern. When performing actions like enrich and augment, a developer will typically want to make some processes dependant on the location of the content being stored.

Rather than having to write a 'black box' provider every time, this class provides a standard way of doing it.

METHODS

enrich

    $self->enrich( $item, $request );
    $self->process_method( enrich => $item, $request );

augment

    $self->augment( $item, $request );
    $self->process_method( augment => $item, $request );

process_method

  $self->process_method( $verb, $item, $request );

Goes through each of the keys of $self->where; if the location of $item matches location specification given (see Articulate::LocationSpecification), then instantiates the value of that key and performs the same verb on the arguments.

If none of the where clauses matched, the otherwise provider, if one is specified, will be used.