Skip Menu |
Report information
Id: 131142
Status: new
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: kencotterill [at] netspace.net.au
Cc:
AdminCc:

Operating System: (no value)
PatchStatus: (no value)
Severity: low
Type: unknown
Perl Version: (no value)
Fixed In: (no value)



To: perlbug - RT for Perl <perlbug [...] perl.org>
Subject: "if" pragma POD addition for modules with an empty import list
From: Ken Cotterill <kencotterill [...] netspace.net.au>
Date: Thu, 13 Apr 2017 13:18:18 +1000
Download (untitled) / with headers
text/plain 900b
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. --- 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>:


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org