Boundary - declare interface package
Declare interface package IFoo:
IFoo
package IFoo { use Boundary; requires qw(hello world); }
Implements the interface package IFoo:
package Foo { use Boundary::Impl qw(IFoo); sub hello { ... } sub world { ... } }
Use the type ImplOf:
ImplOf
use Boundary::Types -types; use Foo; my $type = ImplOf['IFoo']; my $foo = Foo->new; # implements of IFoo $type->check($foo); # pass!
This module provides a interface. Boundary declares abstract functions without implementation and defines an interface package. Bounary::Impl checks if the abstract functions are implemented at compile time.
Boundary
Bounary::Impl
The difference with Role is that the implementation cannot be reused. namespace::allclean prevents the reuse of the implementation.
Copyright (C) kfly8.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
kfly8 <kfly8@cpan.org>
To install Boundary, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Boundary
CPAN shell
perl -MCPAN -e shell install Boundary
For more information on module installation, please visit the detailed CPAN module installation guide.