develooper Front page | perl.perl5.porters | Postings from September 2022

Re: module loading built-in

Thread Previous | Thread Next
From:
Branislav Zahradník
Date:
September 19, 2022 17:45
Subject:
Re: module loading built-in
Message ID:
CAB=rbOmYmh+BXzEgtx-WQK+S8kLhPP8ZE6qYd0RcZCe2dHizTg@mail.gmail.com
On Mon, 19 Sept 2022 at 18:36, Aaron Priven <aaron@priven.com> wrote:
>
> I wonder if it wouldn’t be more flexible to have
>
> module_file_of (‘Foo::Bar’);

+1

this is not bad idea

>
> and then allow that to be loaded into require or used for any other desired purpose, rather than having a special “load” routine.
>
> e.g.,
>
>         my $x = module_name_of('Foo::Bar');
>         require $x;
>
> would be equivalent to
>
>         require Foo::Bar;
>

if I understand it correctly, load should behave like:
my $loaded = eval { require $x; 1 }

Thread Previous | 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