Re: Exporter and subroutine circular dependencies between modules
[email protected] (Diab Jerius) Sun, 13 Mar 2022 18:44:50 -0400
| Newsgroups | perl.module-authors |
|---|---|
| Message-ID | <CADpyd5CGZYt=O0fNCg9xL3ph687F3BD+u7LUQztqDVNwnC61mA@mail.gmail.com> |
--000000000000745c5e05da215041 Content-Type: text/plain; charset="UTF-8" On Sun, Mar 13, 2022, 18:19 Shawn H Corey <[email protected]> wrote: > On 2022-03-13 18:08, Diab Jerius via module-authors wrote: > > require Exporter; > our @ISA = qw( Exporter ); > our @EXPORT = qw( foo ) > > I prefer this way: > > # -------------------------------------- > # Exports > use Exporter qw( import ); > our @EXPORT = qw( foo ); > our @EXPORT_OK = qw( ); > our %EXPORT_TAGS = ( > all => [ @EXPORT, @EXPORT_OK ], > ); > > This automatically creates a tag for `:all`. > I prefer yet another fashion (everything is driven by what's in %EXPORT_TAGS), but back to the point of the OP's problem, this doesn't initialize @EXPORT until runtime, so I think will have the same issue (I'm away from keyboard at the moment). --000000000000745c5e05da215041 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"auto"><div><br><br><div class=3D"gmail_quote"><div dir=3D"ltr" = class=3D"gmail_attr">On Sun, Mar 13, 2022, 18:19 Shawn H Corey <<a href= =3D"mailto:[email protected]">[email protected]</a>> wrote:<br><= /div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-le= ft:1px #ccc solid;padding-left:1ex"> =20 =20 =20 <div> <div>On 2022-03-13 18:08, Diab Jerius via module-authors wrote:<br> </div> <blockquote type=3D"cite"> <blockquote> <p>require Exporter;<br> our @ISA=C2=A0=C2=A0=C2=A0 =3D qw( Exporter );<br> our @EXPORT=C2=A0=C2=A0=C2=A0 =3D qw( foo )</p> </blockquote> </blockquote> <p>I prefer this way:</p> <p><font face=3D"monospace"># --------------------------------------<br= > # Exports<br> use=C2=A0 Exporter=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 qw( import );<br> our @EXPORT=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D qw( foo );<br> our @EXPORT_OK=C2=A0=C2=A0 =3D qw( );<br> our %EXPORT_TAGS =3D (<br> =C2=A0=C2=A0=C2=A0 all=C2=A0 =3D> [ @EXPORT, @EXPORT_OK ],<br> );</font><br> <br> This automatically creates a tag for `:all`.<br></p></div></blockquot= e></div></div><div dir=3D"auto">I prefer yet another fashion (everything is= driven by what's in %EXPORT_TAGS), but back to the point of the OP'= ;s problem, this doesn't initialize @EXPORT until runtime, so I think w= ill have the same issue (I'm away from keyboard at the moment).</div><d= iv dir=3D"auto"><br></div><div dir=3D"auto"><div class=3D"gmail_quote"><blo= ckquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #c= cc solid;padding-left:1ex"><div><p> </p> </div> </blockquote></div></div></div> --000000000000745c5e05da215041--