develooper Front page | perl.perl6.users | Postings from March 2021

Find Packages with prefix ...

Thread Next
From:
Paul Procacci
Date:
March 7, 2021 02:36
Subject:
Find Packages with prefix ...
Message ID:
CAFbbPujP7rZX0_tt6wA2NO=Cque1ZqX7wdNMWB_cjYHoVygiAg@mail.gmail.com
Hey Gents,

I was toying with an idea of writing a program (shocker!) and in the design
of said program I wanted to give the ability to other module writers to
extend functionality of the base program.

The main program would live in bin/ as per normal and claim a namespace of
its own.  Call it: SuperDuperProgram

Within this namespace, I would ideally designate SuperDuperProgram::Modules
to be the namespace that modules would live under.  These modules would
have their own git repos and depend on SuperDuperProgram being installed.

Given this, I'd like the main program to perform a prefix search of
installed modules with that namespace as a prefix, load said modules it
finds, perform callbacks that I would designate as being required to
successfully load the module, etc.

I've read various resources which include the zef source code, the raku
docs, etc., yet am still unable to wrap my head around this.

Any pointers in the right direction as welcomed.

A mock up of what I had in mind:

./bin/SuperDuperProgram
###############################
#!/usr/bin/env raku

my @modules_with_prefix =
search_installed_modules_with_prefix('SuperDuperProgram::Modules');

for @modules_with_prefix {
  # require module
  # perform init callbacks - new() for example
  # whatever else
}

-- 
__________________

:(){ :|:& };:

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