NAME

Venus::Role::Superable - Superable Role

ABSTRACT

Superable Role for Perl 5

SYNOPSIS

package Example;

use Venus::Class;

with 'Venus::Role::Superable';

package main;

my $example = Example->new;

# $example->super;

DESCRIPTION

This package modifies the consuming package and provides methods for dispatching to superclasses using "next::method" in mro.

METHODS

This package provides the following methods:

super

super(any @args) (any)

The super method dispatches to superclasses uses the C3 method resolution order to get better consistency in multiple inheritance situations.

Since 3.55

super example 1
package Example::A;

use Venus::Class;

sub test {
  my ($self, @args) = @_;

  return [$self, @args];
}

package Example::B;

use Venus::Class;

base 'Example::A';

with 'Venus::Role::Superable';

sub test {
  my ($self) = @_;

  return $self->super(1..4);
}

package main;

my $example = Example::B->new;

my $result = $example->test;

AUTHORS

Awncorp, awncorp@cpan.org

LICENSE

Copyright (C) 2022, Awncorp, awncorp@cpan.org.

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