GraphQL::MaybeTypeCheck(3pm)

GraphQL::MaybeTypeCheck3pm

Conditional type-checking at runtime

Usage

  use GraphQL::MaybeTypeCheck;
  method foo(
    $arg1 Str,
    $arg2 Int
  ) :ReturnType(Map[Str, Int]) {
    # ...
  }

Overview

This module optionally enables type-checking in the caller as implemented by Function::Parameters and Return::Type depending on whether Devel::StrictMode is activated.

"Devel::StrictMode" ON

When Devel::StrictMode is active, this module will import Function::Parameters into the caller with its default configuration. As of writing, this includes checking both argument count and type.

When in strict mode this also "require"s Return::Type which registers the "ReturnType" attribute.

"Devel::StrictMode" OFF

When strict mode is inactive this module still imports "Function::Parameters" into the caller however it sets "fun" and "method" to lax mode and disables argument type checking.

This also installs a no-op "ReturnType" attribute so the existing syntax isn't broken.

Releases

Unchanged in 2 releases since Debian 12 (Bookworm).

  1. 12–13

From libgraphql-perl 0.54-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.