Re: iterate over the use-d modules
Andy Bach <[email protected]> Tue, 1 Oct 2024 10:31:07 -0500
| Newsgroups | gmane.comp.lang.perl.beginners |
|---|---|
| Message-ID | <CACV6rWJdA7rq5ogca0Gcn+cf32YfiW95DXk+BTQOb=ka_LZBnA@mail.gmail.com> |
--000000000000504c1106236c0335 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Look at perldoc for "require" but I believe what you want is @INC in place of your @used. Hmm, maybe not % perl -E 'use strict; say for ( @INC );' /Library/Perl/5.34/darwin-thread-multi-2level /Library/Perl/5.34 /Network/Library/Perl/5.34/darwin-thread-multi-2level /Network/Library/Perl/5.34 /Library/Perl/Updates/5.34.1 /System/Library/Perl/5.34/darwin-thread-multi-2level /System/Library/Perl/5.34 /System/Library/Perl/Extras/5.34/darwin-thread-multi-2level /System/Library/Perl/Extras/5.34 On Tue, Oct 1, 2024 at 5:20=E2=80=AFAM Luca Ferrari <[email protected]> w= rote: > Hi all, > is there a way to iterate over the used modules, I mean every symbol > loaded with use? > I would like to do something like: > > use Foo; > use Bar; > > say ${ $_ }::VERSION for ( @used ); > > and get something like > > say $Foo::VERSION; > say $Bar::VERSION; > > > Thanks, > Luca > > -- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > http://learn.perl.org/ > > > --=20 a Andy Bach, [email protected] 608 658-1890 cell 608 261-5738 wk --000000000000504c1106236c0335 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Look at perldoc for "require" but I believe=C2= =A0what you want is=C2=A0@INC in place of your=C2=A0@used.=C2=A0 Hmm, maybe= not<div>% perl -E 'use strict; say =C2=A0for ( @INC );' <br>/Libra= ry/Perl/5.34/darwin-thread-multi-2level<br>/Library/Perl/5.34<br>/Network/L= ibrary/Perl/5.34/darwin-thread-multi-2level<br>/Network/Library/Perl/5.34<b= r>/Library/Perl/Updates/5.34.1<br>/System/Library/Perl/5.34/darwin-thread-m= ulti-2level<br>/System/Library/Perl/5.34<br>/System/Library/Perl/Extras/5.3= 4/darwin-thread-multi-2level<br>/System/Library/Perl/Extras/5.34<br></div><= /div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">O= n Tue, Oct 1, 2024 at 5:20=E2=80=AFAM Luca Ferrari <<a href=3D"mailto:fl= [email protected]">[email protected]</a>> wrote:<br></div><blockquote = class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px sol= id rgb(204,204,204);padding-left:1ex">Hi all,<br> is there a way to iterate over the used modules, I mean every symbol<br> loaded with use?<br> I would like to do something like:<br> <br> use Foo;<br> use Bar;<br> <br> say ${ $_ }::VERSION for ( @used );<br> <br> and get something like<br> <br> say $Foo::VERSION;<br> say $Bar::VERSION;<br> <br> <br> Thanks,<br> Luca<br> <br> -- <br> To unsubscribe, e-mail: <a href=3D"mailto:[email protected]" t= arget=3D"_blank">[email protected]</a><br> For additional commands, e-mail: <a href=3D"mailto:[email protected]"= target=3D"_blank">[email protected]</a><br> <a href=3D"http://learn.perl.org/" rel=3D"noreferrer" target=3D"_blank">htt= p://learn.perl.org/</a><br> <br> <br> </blockquote></div><br clear=3D"all"><div><br></div><span class=3D"gmail_si= gnature_prefix">-- </span><br><div dir=3D"ltr" class=3D"gmail_signature"><b= r>a<br><br>Andy Bach,<br><a href=3D"mailto:[email protected]" target=3D"_bla= nk">[email protected]</a><br>608 658-1890 cell<br>608 261-5738 wk</div> --000000000000504c1106236c0335--