develooper Front page | perl.perl6.users | Postings from September 2019

Dynamic export/import of symbols into global namespace

Thread Next
From:
Paul Procacci
Date:
September 20, 2019 19:32
Subject:
Dynamic export/import of symbols into global namespace
Message ID:
CAFbbPui=1d-CzDLmUwVey4edvmSsGnskYyQ25a+66WoVq=cwcA@mail.gmail.com
As the subject suggests, I'd like to dynamically export/import symbols from
a source file into the global scope of the program.  How would one
accomplish this?

Given the below, it yields an error _which I expect_.  How do I dynamically
pull in the subset 'What'?


File: Testing.pm6
--------------------------

subset What of Str;
class Testing {}



File: main.pl
--------------------------
{
my $c = 'Testing';
require ::($c);
my $t = ::($c).new;
}

my What $x = 'Blah'


-- 
__________________

:(){ :|:& };:

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About