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

Venus::Core::Role - Role Base Class

ABSTRACT

Role Base Class for Perl 5

SYNOPSIS

  package Person;

  use base 'Venus::Core::Role';

  package User;

  use base 'Venus::Core::Class';

  package main;

  my $user = User->ROLE('Person')->new(
    fname => 'Elliot',
    lname => 'Alderson',
  );

  # bless({fname => 'Elliot', lname => 'Alderson'}, 'User')

DESCRIPTION

This package provides a role base class with role building and object construction lifecycle hooks.

INHERITS

This package inherits behaviors from:

Venus::Core

METHODS

This package provides the following methods:

does

  does(Str $name) (Bool)

The does method returns true if the object is composed of the role provided.

Since 1.00

does example 1
  package Employee;

  use base 'Venus::Core::Role';

  Employee->ROLE('Person');

  package main;

  my $user = User->ROLE('Employee')->new(
    fname => 'Elliot',
    lname => 'Alderson',
  );

  my $does = Employee->does('Person');

  # 1

meta

  meta() (Meta)

The meta method returns a Venus::Meta objects which describes the package's configuration.

Since 1.00

meta example 1
  package main;

  my $user = User->ROLE('Person')->new(
    fname => 'Elliot',
    lname => 'Alderson',
  );

  my $meta = Person->meta;

  # bless({...}, 'Venus::Meta')

AUTHORS

Awncorp, awncorp@cpan.org

LICENSE

Copyright (C) 2000, Al Newkirk.

This program is free software, you can redistribute it and/or modify it under the terms of the Apache license version 2.0.