The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

MOP4Import::Declare::Type - inner-type related pragmas

SYNOPSIS

  package MyApp;
  use MOP4Import::Types
    BaseUser => [
      [fields => qw/sessid/],
      [subtypes =>
        Guest => [],
        RegisteredUser => [[fields => qw/uid registered_at/]],
     ]
    ],
    AdminUser => [
      [extends => 'RegisteredUser'],
      [fields => qw/impersonation/],
    ],
    ;

DESCRIPTION

This module implements inner-type related pragmas. Usually used via MOP4Import::Types.

PRAGMAS

[subtypes => ($typename => [@spec])...]

Declare multiple inner-types which are subtypes of currently-defining inner-type by $typename => [@spec] pair list.

[extends => $typename]

Set superclass for currently-defining inner-type to $typename.

(Internal) [type => $typename, @spec]

Declare inner-type $typename based on given @spec.

(Not recommended) [extend => $typename, @spec]

Declare extended version of $typename, which is inherited from parent class, based on given @spec.

AUTHOR

Kobayashi, Hiroaki <hkoba@cpan.org>

LICENSE

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