use Sub::Util qw/set_prototype/;
(*Hello, *Hi) = map { set_prototype '\@\@' => $_ } map { my $var = $_; sub { $_; } } qw/Hello Hi/;
####
use attributes();
sub Hi { "Hi" };
attributes::->import(__PACKAGE__, *{$_}{CODE}, 'prototype(\@\@)') for *Hi;
####
use v5.14;
use attributes();
use Data::Dumper;
my $Hi;
sub Hi:lvalue {
$Hi;
}
my $Hello;
sub Hello {
$Hello;
}
BEGIN { attributes::->import(__PACKAGE__, \&Hello, 'lvalue'); }
Hi = 'monks'; # It kind of looks like a sigil-less variable actually :)
Hello = 'world'; # There would be a warning here without the BEGIN block
say "Hi: ", Hi;
say "Hello: ", Hello;
__END__
Hi: monks
Hello: