Function::Interface::Impl - implements interface package
Implements the interface package IFoo:
IFoo
package Foo { use Function::Interface::Impl qw(IFoo); use Types::Standard -types; fun hello(Str $msg) :Return(Str) { return "HELLO $msg"; } fun add(Int $a, Int $b) :Return(Int) { return $a + $b; } }
Function::Interface::Impl is for implementing interface package. This module checks if the abstract functions are implemented at compile time and imports Function::Parameters and Function::Return into the implementing package.
Function::Interface must be loaded before Function::Return.
You need to call CHECK code blocks in the following order: 1. Function::Return#CHECK (to get return info) 2. Function::Interface::Impl#CHECK (to check implements)
CHECK
CHECK code blocks are LIFO order. So, it is necessary to load in the following order: 1. Function::Interface::Impl 2. Function::Return
check if the interface package is implemented, otherwise die.
get the object of Function::Interface::Info.
get the object of Function::Parameters.
get the object of Function::Return.
check if the arguments are implemented according to the interface info.
check if the argument are implemented according to the interface info.
check if the return types are implemented according to the interface info.
check if specified package is an implementation of specified interface package.
Function::Parameters, Function::Return
Copyright (C) kfly8.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
kfly8 <kfly@cpan.org>
To install Function::Interface, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Function::Interface
CPAN shell
perl -MCPAN -e shell install Function::Interface
For more information on module installation, please visit the detailed CPAN module installation guide.