NAME
Function::Interface::Impl - implements interface package
SYNOPSIS
Implements the interface package 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;
}
}
DESCRIPTION
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.
NOTES
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
code blocks are LIFO order. So, it is necessary to load in the following order: 1. Function::Interface::Impl 2. Function::Return
METHODS
assert_valid
check if the interface package is implemented, otherwise die.
info_interface($interface_package)
get the object of Function::Interface::Info.
info_params($code)
get the object of Function::Parameters.
info_return($code)
get the object of Function::Return.
check_params($params_info, $interface_function_info)
check if the arguments are implemented according to the interface info.
check_param($param, $interface_param)
check if the argument are implemented according to the interface info.
check_return($return_info, $interface_function_info)
check if the return types are implemented according to the interface info.
impl_of($package, $interface_package)
check if specified package is an implementation of specified interface package.
SEE ALSO
Function::Parameters, Function::Return
LICENSE
Copyright (C) kfly8.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
AUTHOR
kfly8 <kfly@cpan.org>