Skip to content
This repository
Browse code

spec both ::() and :file() require forms

  • Loading branch information...
commit 65c3a065922fabfd992d051d661e1795b7703e32 1 parent 1ccffdd
Larry Wall authored September 04, 2012

Showing 1 changed file with 17 additions and 2 deletions. Show diff stats Hide diff stats

  1. 19  S11-modules.pod
19  S11-modules.pod
Source Rendered
@@ -13,8 +13,8 @@ Synopsis 11: Modules
13 13
 
14 14
     Created: 27 Oct 2004
15 15
 
16  
-    Last Modified: 15 Jun 2011
17  
-    Version: 36
  16
+    Last Modified: 04 Sep 2012
  17
+    Version: 37
18 18
 
19 19
 =head1 Overview
20 20
 
@@ -312,6 +312,21 @@ to the package scope instead:
312 312
 
313 313
 (Such a routine I<may> rebind existing lexicals, however.)
314 314
 
  315
+When you pass a string, C<require> always assumes the string contains a filename.
  316
+To specify both a module name and a filename, use a colonpair modifier:
  317
+
  318
+    require Sense:file("/home/non/Sense.pm") <common @horse>;
  319
+
  320
+At mininum, this will create the C<Sense> package at compile time,
  321
+even if the C<require> never puts anything into it at run time.
  322
+
  323
+It is also possible to specify both module name and filename by
  324
+strings, though in this case the compiler will have no idea what your
  325
+module is actually going to be called.
  326
+
  327
+    my $sense = "Sense";
  328
+    require ::($sense):file("/home/non/Sense.pm") <common @horse>;
  329
+
315 330
 =head1 Importing from a pseudo-package
316 331
 
317 332
 You may also import symbols from the various pseudo-packages listed in S02.

0 notes on commit 65c3a06

Please sign in to comment.
Something went wrong with that request. Please try again.