in reply to perl 5 suggestions?
This hack shows how to define ONE module (here "Classy" YMMV) which creates as many types and package variables in the callers package as you want to.
use strict; use warnings; use lib '.'; use Classy ; my Str $a ="Goliath"; # no compilation error $var //= 'Philistine'; # no compilation error print $var;
module
package Classy; use strict; use warnings; sub import { my $pkg = (caller())[0]; eval 'require Str'; no strict 'refs'; *{"${pkg}::var"} = \(my $var); } 1;
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
|
|---|