Moose::Meta::Role::Attribute(3) User Contributed Perl Documentation Moose::Meta::Role::Attribute(3)

# [DESCRIPTION](#DESCRIPTION)

This class implements the API for attributes in roles. Attributes in roles are more like attribute prototypes than full blown attributes. While they are introspectable, they have very little behavior.

# [METHODS](#METHODS)

## [Moose::Meta::Role::Attribute-&gt;new(...)](#Moose::Meta::Role::Attribute)

This method accepts all the options that would be passed to the constructor for Moose::Meta::Attribute.

## [$attr-&gt;metaclass](#$attr)

## [$attr-&gt;is](#$attr~2)

Returns the option as passed to the constructor.

## [$attr-&gt;associated\_role](#$attr~3)

Returns the Moose::Meta::Role to which this attribute belongs, if any.

## [$attr-&gt;original\_role](#$attr~4)

Returns the Moose::Meta::Role in which this attribute was first defined. This may not be the same as the value of associated\_role() for attributes in a composite role, or when one role consumes other roles.

## [$attr-&gt;original\_options](#$attr~5)

Returns a hash reference of options passed to the constructor. This is used when creating a Moose::Meta::Attribute object from this object.

## [$attr-&gt;attach\_to\_role($role)](#$attr~6)

Attaches the attribute to the given Moose::Meta::Role.

## [$attr-&gt;attribute\_for\_class($metaclass)](#$attr~7)

Given an attribute metaclass name, this method calls "$metaclass-&gt;interpolate\_class\_and\_new" to construct an attribute object which can be added to a Moose::Meta::Class.

## [$attr-&gt;clone](#$attr~8)

Creates a new object identical to the object on which the method is called.

## [$attr-&gt;is\_same\_as($other\_attr)](#$attr~9)

Compares two role attributes and returns true if they are identical.

In addition, this class implements all informational predicates implements by Moose::Meta::Attribute (and Class::MOP::Attribute).

# [BUGS](#BUGS)

See "BUGS" in Moose for details on reporting bugs.

2026-08-29 perl v5.44.0

---

Document: Moose::Meta::Role::Attribute(3pm) from perl-moose 2.4000-r4 (Chainguard OS)
Source: https://github.com/moose/Moose
