package Util;
use strict;
use warnings;
our ( @EXPORT_OK, %EXPORT_TAGS );
BEGIN {
use Exporter 'import';
@EXPORT_OK = qw(foo bar baz quux);
%EXPORT_TAGS = ( all => \@EXPORT_OK );
}
# Dependencies for this Util module go here...
use namespace::clean -except => [qw(import)];
sub foo {
my ( $x, $y, @z ) = @_;
...;
}
sub bar { 42 }
sub baz { ... }
sub quux { ... }
"Derp.";
__END__
####
package Class::Util;
use Moo::Role;
sub foo {
my ( $self, $x, $y, @z ) = @_;
...;
}
has bar => ( is => 'ro', default => sub { 42 } );
...;
1;
####
package Class::Util;
use Moo::Role;
use Util ();
for my $method (@Util::EXPORT_OK) {
no strict 'refs';
*$method = sub {
my $self = shift;
my $sub = "Util::$method";
$sub->(@_);
};
}
"Derp.";