Skip to content

Commit 2bc8439

Browse files
committed
perlfunc: document return behavior of require and module_true feature
1 parent 34bbffc commit 2bc8439

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ Dagfinn Ilmari Mannsåker <[email protected]> Dagfinn Ilmari Mannsåker (via RT)
232232
233233
Damian Conway <[email protected]> Damian Conway <[email protected]>
234234
235+
235236
Dan Dascalescu <[email protected]> Dan Dascalescu <[email protected]>
236237
Dan Faigin <unknown> Dan Faigin, Doug Landauer <unknown@longtimeago>
237238
Dan Jacobson <[email protected]> Dan Jacobson <[email protected]>

pod/perlfunc.pod

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7111,6 +7111,7 @@ would have semantics similar to the following:
71117111
croak $@ ? "$@Compilation failed in require"
71127112
: "Can't locate $filename: $!\n";
71137113
}
7114+
return 1 if $feature_module_true_enabled_in_file;
71147115
if (!$result) {
71157116
delete $INC{$filename};
71167117
croak "$filename did not return true value";
@@ -7136,6 +7137,11 @@ affects the compilation unit within which the feature is used, and using
71367137
it before requiring a module will not change the behavior of existing
71377138
modules that do not themselves also use it.
71387139

7140+
In this usage, the (truthy) result of the required file will be returned,
7141+
but this should not be relied upon as it will not be returned in subsequent
7142+
C<require> calls on the same file or with the 'module_true' feature enabled.
7143+
To run a file and retrieve its return value, use L<C<do>|/do EXPR>.
7144+
71397145
If EXPR is a bareword, C<require> assumes a F<.pm>
71407146
extension and replaces C<::> with C</> in the filename for you,
71417147
to make it easy to load standard modules. This form of loading of

0 commit comments

Comments
 (0)