Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"if" pragma POD addition for modules with an empty import list #15950

Closed
p5pRT opened this issue Apr 13, 2017 · 8 comments
Closed

"if" pragma POD addition for modules with an empty import list #15950

p5pRT opened this issue Apr 13, 2017 · 8 comments

Comments

@p5pRT
Copy link

p5pRT commented Apr 13, 2017

Migrated from rt.perl.org#131142 (status was 'resolved')

Searchable as RT131142$

@p5pRT
Copy link
Author

p5pRT commented Apr 13, 2017

From kencotterill@netspace.net.au

This relates to if.pm (version​: 0.0606).

The current documentation refers to loading modules
with or without ARGUMENTS (i.e. for import()).

It doesn't mention using an empty import list
which is not possible with the current implementation.

This patch adds a few lines to the POD to
explain this; it also suggests a workaround.

Inline Patch
--- if.pm	2017-04-12 08:26:15.000000000 +1000
+++ if-new.pm	2017-04-12 09:31:05.000000000 +1000
@@ -50,6 +50,15 @@
  If you don't use the fat comma (eg you don't have any ARGUMENTS),
  then you'll need to quote the MODULE.
  
+If you wanted ARGUMENTS to be an empty list, i.e. have the effect of:
+
+    use MODULE ();
+
+you can't do this with the C<if> pragma; however, you can achieve
+exactly this effect, at compile time, with:
+
+    BEGIN { require MODULE if CONDITION }
+
  =head2 EXAMPLES
  
  The following line is taken from the testsuite for L<File::Map>:

@p5pRT
Copy link
Author

p5pRT commented May 11, 2017

From @khwilliamson

On Wed, 12 Apr 2017 20​:21​:58 -0700, kencotterill@​netspace.net.au wrote​:

This relates to if.pm (version​: 0.0606).

The current documentation refers to loading modules
with or without ARGUMENTS (i.e. for import()).

It doesn't mention using an empty import list
which is not possible with the current implementation.

This patch adds a few lines to the POD to
explain this; it also suggests a workaround.

Thanks, I'll look into this for 5.27

--- if.pm 2017-04-12 08​:26​:15.000000000 +1000
+++ if-new.pm 2017-04-12 09​:31​:05.000000000 +1000
@​@​ -50,6 +50,15 @​@​
If you don't use the fat comma (eg you don't have any ARGUMENTS),
then you'll need to quote the MODULE.

+If you wanted ARGUMENTS to be an empty list, i.e. have the effect of​:
+
+ use MODULE ();
+
+you can't do this with the C<if> pragma; however, you can achieve
+exactly this effect, at compile time, with​:
+
+ BEGIN { require MODULE if CONDITION }
+
=head2 EXAMPLES

The following line is taken from the testsuite for L<File​::Map>​:

--
Karl Williamson

@p5pRT
Copy link
Author

p5pRT commented May 11, 2017

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Jun 1, 2017

From @jkeenan

On Thu, 11 May 2017 15​:25​:50 GMT, khw wrote​:

On Wed, 12 Apr 2017 20​:21​:58 -0700, kencotterill@​netspace.net.au wrote​:

This relates to if.pm (version​: 0.0606).

The current documentation refers to loading modules
with or without ARGUMENTS (i.e. for import()).

It doesn't mention using an empty import list
which is not possible with the current implementation.

This patch adds a few lines to the POD to
explain this; it also suggests a workaround.

Thanks, I'll look into this for 5.27

Karl, would you like to move forward with the discussion of this request?

Thank you very much.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Jun 1, 2017

From @khwilliamson

Thanks, applied as
1627961

It makes it easier on us if you attach the patch to the ticket, instead of inlining it.
--
Karl Williamson

@p5pRT
Copy link
Author

p5pRT commented Jun 1, 2017

@khwilliamson - Status changed from 'open' to 'pending release'

@p5pRT
Copy link
Author

p5pRT commented Jun 23, 2018

From @khwilliamson

Thank you for filing this report. You have helped make Perl better.

With the release yesterday of Perl 5.28.0, this and 185 other issues have been
resolved.

Perl 5.28.0 may be downloaded via​:
https://metacpan.org/release/XSAWYERX/perl-5.28.0

If you find that the problem persists, feel free to reopen this ticket.

@p5pRT
Copy link
Author

p5pRT commented Jun 23, 2018

@khwilliamson - Status changed from 'pending release' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant