---
name: "MooseX::FunctionParametersInfo"
section: "3pm"
platform: "linux"
package: "libmoops-perl"
version: "0.036-1"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/MooseX::FunctionParametersInfo"
---

# MooseX::FunctionParametersInfo(3pm)

make Function::Parameters::info() data available within the meta object protocol

## NAME

MooseX::FunctionParametersInfo - make Function::Parameters::info() data available within the meta object protocol

## SYNOPSIS

```
   package Foo {
      use Function::Parameters;
      use Moose;
      use MooseX::FunctionParametersInfo;

      method bar (Str $x, Int $y) {
         ...;
      }
   }

   my $method = Class::MOP::class_of('Foo')->get_method('bar');
   printf("%s %s\n", $_->type, $_->name)
      for $method->positional_parameters;

   __END__
   Str $x
   Int $y
```

## DESCRIPTION

Function::Parameters provides declarative sugar for processing arguments to subs, and provides a small API to query the declarations.

Moose provides a comprehensive introspection API for Perl classes.

MooseX::FunctionParametersInfo marries them together, injecting information from Function::Parameters into Moose's meta objects.

MooseX::FunctionParametersInfo is currently distributed as part of Moops, but is fairly independent of the rest of it, and may be spun off as a separate release in the future.

### Methods

MooseX::FunctionParametersInfo adds the following methods to the Moose::Meta::Method objects for your class. If your method is wrapped, it is the info from the original (wrapped) method that is reported; not the info from the wrapper. If your method was not declared via Function::Parameters (e.g. it was declared using the Perl built-in `"sub"` keyword) then we make a best guess.

Methods that return parameters, return Function::Parameters::Parameter objects, which have `"name"` and `"type"` methods. The type (if any) will be a blessed type constraint object, such as a Moose::Meta::TypeConstraint or Type::Tiny object.

- "declaration\_keyword"

  Returns the name of the keyword used to declare the method; e.g. `"sub"` or `"method"`.

- "slurpy\_parameter"

  The array parameter into which additional arguments will be slurped, or undef.

- "invocant\_parameter"

  The parameter which is the method's invocant (typically, `$self` or `$class`), or undef.

- "positional\_required\_parameters", "positional\_optional\_parameters" "named\_required\_parameters", "named\_optional\_parameters"

  Returns the appropriate parameters as a list.

- "positional\_parameters", "named\_parameters"

  A list of the required parameters followed by optional parameters.

- "minimum\_parameters", "maximum\_parameters"

  The minimum and maximum number of parameters the method can take.

## BUGS

Please report any bugs to \<http://rt.cpan.org/Dist/Display.html?Queue=Moops\>.

## SEE ALSO

Moose, Function::Parameters, Function::Parameters::Info.

Moops.

## AUTHOR

Toby Inkster \<tobyink@cpan.org\>.

## COPYRIGHT AND LICENCE

This software is copyright (c) 2013-2014 by Toby Inkster.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

## DISCLAIMER OF WARRANTIES

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
