File: Exporter.html

package info (click to toggle)
perl-doc-html 5.26.0-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 39,400 kB
  • sloc: xml: 36; makefile: 7
file content (811 lines) | stat: -rw-r--r-- 51,240 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <title>Exporter - perldoc.perl.org</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta http-equiv="Content-Language" content="en-gb">
  <link rel="search" type="application/opensearchdescription+xml" title="Search perldoc.perl.org" href="/static/search.xml"/>
  <link href="static/css-20100830.css" rel="stylesheet" rev="stylesheet" type="text/css" media="screen">
  <link href="static/exploreperl.css" rel="stylesheet" rev="stylesheet" type="text/css">
</head>

<body onLoad="perldoc.startup();" onPageShow="if (event.persisted) perldoc.startup();">
    <div id="page">
      
      <div id="header">
	<div id="homepage_link">
	  <a href="index.html"></a>
	</div>
	<div id="strapline">
	  Perl Programming Documentation
	</div>
	<div id="download_link" class="download">
	  <a href="http://www.perl.org/get.html">Download Perl</a>
	</div>
	<div id="explore_link" class="download">
	  <a id="explore_anchor" href="#">Explore</a>
	</div>
      </div>
      
      <div id="body">
        <div id="left_column">
          <div class="side_group">
            
	    <div class="side_panel doc_panel">
              <p>Manual</p>
              <ul>
                <li><a href="index-overview.html">Overview</a>
                <li><a href="index-tutorials.html">Tutorials</a>
                <li><a href="index-faq.html">FAQs</a>
                <li><a href="index-history.html">History / Changes</a>
                <li><a href="index-licence.html">License</a>
              </ul>
            </div>
            <div class="side_panel doc_panel">
              <p>Reference</p>
              <ul>
                <li><a href="index-language.html">Language</a>
                <li><a href="index-functions.html">Functions</a>
                <li><a href="perlop.html">Operators</a>
                <li><a href="perlvar.html">Special Variables</a>
                <li><a href="index-pragmas.html">Pragmas</a>
                <li><a href="index-utilities.html">Utilities</a>
                <li><a href="index-internals.html">Internals</a>
                <li><a href="index-platforms.html">Platform Specific</a>
              </ul>
            </div>
            <div class="side_panel doc_panel">
              <p>Modules</p>
              <ul>
		<li>
		
                
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		
                  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		
                  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		
                  
		
                  
		    
		  
		
                  
		
                  
		
		
                    <a href="index-modules-A.html">A</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-B.html">B</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-C.html">C</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-D.html">D</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-E.html">E</a>
                    
                      
                        <li>
                      
                    
                
                    <a href="index-modules-F.html">F</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-G.html">G</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-H.html">H</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-I.html">I</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-L.html">L</a>
                    
                      
                        <li>
                      
                    
                
                    <a href="index-modules-M.html">M</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-N.html">N</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-O.html">O</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-P.html">P</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-S.html">S</a>
                    
                      
                        <li>
                      
                    
                
                    <a href="index-modules-T.html">T</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-U.html">U</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-X.html">X</a>
                    
                
              </ul>
            </div>
            
	      <div class="side_panel doc_panel">
		<p>Tools</p>
		<ul>
		  <li><a href="preferences.html">Preferences</a>
		</ul>
	      </div>
            
          </div>
        </div>
        <div id="centre_column">
          <div id="content_header">
            <div id="title_bar">
              <div id="page_name">
                <h1>Exporter</h1>
              </div>
              <div id="perl_version">
                Perl 5 version 26.0 documentation
              </div>
              <div class="page_links" id="page_links_top">
                <a href="#" onClick="toolbar.goToTop();return false;">Go to top</a>
		
              </div>
	      <div class="page_links" id="page_links_bottom">
		
                  <a href="#" id="page_index_toggle">Show page index</a> &bull;
		
                <a href="#" id="recent_pages_toggle">Show recent pages</a>		
	      </div>
	      <div id="search_form">
		<form action="search.html" method="GET" id="search">
		  <input type="text" name="q" id="search_box" alt="Search">
		</form>
	      </div>
            </div>
            <div id="breadcrumbs">
                
    <a href="index.html">Home</a> &gt;
    
      
        <a href="index-modules-E.html">Core modules (E)</a> &gt;
      
    
    Exporter
  

            </div>
          </div>
          <div id="content_body">
	    <!--[if lt IE 7]>
 <div class="noscript">
   <p>
     <strong>It looks like you're using Internet Explorer 6. This is a very old
     browser which does not offer full support for modern websites.</strong>
   </p>
   <p>
     Unfortunately this means that this website will not work on
     your computer.
   </p>
   <p>
     Don't miss out though! To view the site (and get a better experience from
     many other websites), simply upgrade to
     <a href="http://www.microsoft.com/windows/Internet-explorer/default.aspx">Internet
Explorer 8</a>
     or download an alternative browser such as
     <a href="http://www.mozilla.com/en-US/firefox/firefox.html">Firefox</a>,
     <a href="http://www.apple.com/safari/download/">Safari</a>, or
     <a href="http://www.google.co.uk/chrome">Google Chrome</a>.
   </p>
   <p>
     All of these browsers are free. If you're using a PC at work, you may
     need to contact your IT administrator.
   </p>
 </div>
<![endif]-->
	    <noscript>
	      <div class="noscript">
	      <p>
                <strong>Please note: Many features of this site require JavaScript. You appear to have JavaScript disabled,
	        or are running a non-JavaScript capable web browser.</strong>
	      </p>
	      <p>
		To get the best experience, please enable JavaScript or download a modern web browser such as <a href="http://www.microsoft.com/windows/Internet-explorer/default.aspx">Internet Explorer 8</a>, <a href="http://www.mozilla.com/en-US/firefox/firefox.html">Firefox</a>, <a href="http://www.apple.com/safari/download/">Safari</a>, or <a href="http://www.google.co.uk/chrome">Google Chrome</a>.
              </p>
	      </div>
	    </noscript>

	    <div id="recent_pages" class="hud_container">
	      <div id="recent_pages_header" class="hud_header">
		<div id="recent_pages_close" class="hud_close"><a href="#" onClick="recentPages.hide();return false;"></a></div>
		<div id="recent_pages_title" class="hud_title"><span class="hud_span_top">Recently read</span></div>
		<div id="recent_pages_topright" class="hud_topright"></div>
	      </div>
	      <div id="recent_pages_content" class="hud_content">
	      </div>
	      <div id="recent_pages_footer" class="hud_footer">
		<div id="recent_pages_bottomleft" class="hud_bottomleft"></div>
		<div id="recent_pages_bottom" class="hud_bottom"><span class="hud_span_bottom"></span></div>
		<div id="recent_pages_resize" class="hud_resize"></div>
	      </div>
	    </div>
  
	    <div id="from_search"></div>
            <h1>Exporter</h1>


  <!--    -->
<ul><li><a href="#NAME">NAME</a><li><a href="#SYNOPSIS">SYNOPSIS</a><li><a href="#DESCRIPTION">DESCRIPTION</a><ul><li><a href="#How-to-Export">How to Export</a><li><a href="#Selecting-What-to-Export">Selecting What to Export</a><li><a href="#How-to-Import">How to Import</a></ul><li><a href="#Advanced-Features">Advanced Features</a><ul><li><a href="#Specialised-Import-Lists">Specialised Import Lists</a><li><a href="#Exporting-Without-Using-Exporter's-import-Method">Exporting Without Using Exporter's import Method</a><li><a href="#Exporting-Without-Inheriting-from-Exporter">Exporting Without Inheriting from Exporter</a><li><a href="#Module-Version-Checking">Module Version Checking</a><li><a href="#Managing-Unknown-Symbols">Managing Unknown Symbols</a><li><a href="#Tag-Handling-Utility-Functions">Tag Handling Utility Functions</a><li><a href="#Generating-Combined-Tags">Generating Combined Tags</a><li><a href="#AUTOLOADed-Constants">AUTOLOADed Constants</a></ul><li><a href="#Good-Practices">Good Practices</a><ul><li><a href="#Declaring-%40EXPORT_OK-and-Friends">Declaring @EXPORT_OK and Friends</a><li><a href="#Playing-Safe">Playing Safe</a><li><a href="#What-Not-to-Export">What Not to Export</a></ul><li><a href="#SEE-ALSO">SEE ALSO</a><li><a href="#LICENSE">LICENSE</a></ul><a name="NAME"></a><h1>NAME</h1>
<p>Exporter - Implements default import method for modules</p>
<a name="SYNOPSIS"></a><h1>SYNOPSIS</h1>
<p>In module <i>YourModule.pm</i>:</p>
<pre class="verbatim"><ol><li><a name="package-YourModule"></a>  package <span class="i">YourModule</span><span class="sc">;</span></li><li>  <a class="l_k" href="functions/require.html">require</a> <span class="w">Exporter</span><span class="sc">;</span></li><li>  <span class="i">@ISA</span> = <span class="q">qw(Exporter)</span><span class="sc">;</span></li><li>  <span class="i">@EXPORT_OK</span> = <span class="q">qw(munge frobnicate)</span><span class="sc">;</span>  <span class="c"># symbols to export on request</span></li></ol></pre><p>or</p>
<pre class="verbatim"><ol><li><a name="package-YourModule"></a>  package <span class="i">YourModule</span><span class="sc">;</span></li><li>  <a class="l_k" href="functions/use.html">use</a> <span class="w">Exporter</span> <span class="q">&#39;import&#39;</span><span class="sc">;</span> <span class="c"># gives you Exporter&#39;s import() method directly</span></li><li>  <span class="i">@EXPORT_OK</span> = <span class="q">qw(munge frobnicate)</span><span class="sc">;</span>  <span class="c"># symbols to export on request</span></li></ol></pre><p>In other files which wish to use <code class="inline"><span class="w">YourModule</span></code>
:</p>
<pre class="verbatim"><ol><li>  <a class="l_k" href="functions/use.html">use</a> <span class="w">YourModule</span> <span class="q">qw(frobnicate)</span><span class="sc">;</span>      <span class="c"># import listed symbols</span></li><li>  <span class="w">frobnicate</span> <span class="s">(</span><span class="i">$left</span><span class="cm">,</span> <span class="i">$right</span><span class="s">)</span>          <span class="c"># calls YourModule::frobnicate</span></li></ol></pre><p>Take a look at <a href="#Good-Practices">Good Practices</a> for some variants
you will like to use in modern Perl code.</p>
<a name="DESCRIPTION"></a><h1>DESCRIPTION</h1>
<p>The Exporter module implements an <code class="inline"><a class="l_k" href="functions/import.html">import</a></code> method which allows a module
to export functions and variables to its users' namespaces.  Many modules
use Exporter rather than implementing their own <code class="inline"><a class="l_k" href="functions/import.html">import</a></code> method because
Exporter provides a highly flexible interface, with an implementation optimised
for the common case.</p>
<p>Perl automatically calls the <code class="inline"><a class="l_k" href="functions/import.html">import</a></code> method when processing a
<code class="inline"><a class="l_k" href="functions/use.html">use</a></code> statement for a module.  Modules and <code class="inline"><a class="l_k" href="functions/use.html">use</a></code> are documented
in <a href="perlfunc.html">perlfunc</a> and <a href="perlmod.html">perlmod</a>.  Understanding the concept of
modules and how the <code class="inline"><a class="l_k" href="functions/use.html">use</a></code> statement operates is important to
understanding the Exporter.</p>
<a name="How-to-Export"></a><h2>How to Export</h2>
<p>The arrays <code class="inline"><span class="i">@EXPORT</span></code>
 and <code class="inline"><span class="i">@EXPORT_OK</span></code>
 in a module hold lists of
symbols that are going to be exported into the users name space by
default, or which they can request to be exported, respectively.  The
symbols can represent functions, scalars, arrays, hashes, or typeglobs.
The symbols must be given by full name with the exception that the
ampersand in front of a function is optional, e.g.</p>
<pre class="verbatim"><ol><li>    <span class="i">@EXPORT</span>    = <span class="q">qw(afunc $scalar @array)</span><span class="sc">;</span>   <span class="c"># afunc is a function</span></li><li>    <span class="i">@EXPORT_OK</span> = <span class="q">qw(&amp;bfunc %hash *typeglob)</span><span class="sc">;</span> <span class="c"># explicit prefix on &amp;bfunc</span></li></ol></pre><p>If you are only exporting function names it is recommended to omit the
ampersand, as the implementation is faster this way.</p>
<a name="Selecting-What-to-Export"></a><h2>Selecting What to Export</h2>
<p>Do <b>not</b> export method names!</p>
<p>Do <b>not</b> export anything else by default without a good reason!</p>
<p>Exports pollute the namespace of the module user.  If you must export
try to use <code class="inline"><span class="i">@EXPORT_OK</span></code>
 in preference to <code class="inline"><span class="i">@EXPORT</span></code>
 and avoid short or
common symbol names to reduce the risk of name clashes.</p>
<p>Generally anything not exported is still accessible from outside the
module using the <code class="inline"><span class="w">YourModule::item_name</span></code>
 (or <code class="inline"><span class="i">$blessed_ref</span><span class="i">-&gt;method</span></code>
)
syntax.  By convention you can use a leading underscore on names to
informally indicate that they are 'internal' and not for public use.</p>
<p>(It is actually possible to get private functions by saying:</p>
<pre class="verbatim"><ol><li>  <a class="l_k" href="functions/my.html">my</a> <span class="i">$subref</span> = <a class="l_k" href="functions/sub.html">sub</a> <span class="s">{</span> ... <span class="s">}</span><span class="sc">;</span></li><li>  <span class="i">$subref</span>-&gt;<span class="s">(</span><span class="i">@args</span><span class="s">)</span><span class="sc">;</span>            <span class="c"># Call it as a function</span></li><li>  <span class="i">$obj</span><span class="i">-&gt;$subref</span><span class="s">(</span><span class="i">@args</span><span class="s">)</span><span class="sc">;</span>        <span class="c"># Use it as a method</span></li></ol></pre><p>However if you use them for methods it is up to you to figure out
how to make inheritance work.)</p>
<p>As a general rule, if the module is trying to be object oriented
then export nothing.  If it's just a collection of functions then
<code class="inline"><span class="i">@EXPORT_OK</span></code>
 anything but use <code class="inline"><span class="i">@EXPORT</span></code>
 with caution.  For function and
method names use barewords in preference to names prefixed with
ampersands for the export lists.</p>
<p>Other module design guidelines can be found in <a href="perlmod.html">perlmod</a>.</p>
<a name="How-to-Import"></a><h2>How to Import</h2>
<p>In other files which wish to use your module there are three basic ways for
them to load your module and import its symbols:</p>
<ul>
<li><a name="use-YourModule%3b"></a><b><code class="inline"><a class="l_k" href="functions/use.html">use</a> <span class="w">YourModule</span><span class="sc">;</span></code>
</b>
<p>This imports all the symbols from YourModule's <code class="inline"><span class="i">@EXPORT</span></code>
 into the namespace
of the <code class="inline"><a class="l_k" href="functions/use.html">use</a></code> statement.</p>
</li>
<li><a name="use-YourModule-()%3b"></a><b><code class="inline"><a class="l_k" href="functions/use.html">use</a> <span class="w">YourModule</span> <span class="s">(</span><span class="s">)</span><span class="sc">;</span></code>
</b>
<p>This causes perl to load your module but does not import any symbols.</p>
</li>
<li><a name="use-YourModule-qw(...)%3b"></a><b><code class="inline"><a class="l_k" href="functions/use.html">use</a> <span class="w">YourModule</span> <span class="q">qw(...)</span><span class="sc">;</span></code>
</b>
<p>This imports only the symbols listed by the caller into their namespace.
All listed symbols must be in your <code class="inline"><span class="i">@EXPORT</span></code>
 or <code class="inline"><span class="i">@EXPORT_OK</span></code>
, else an error
occurs.  The advanced export features of Exporter are accessed like this,
but with list entries that are syntactically distinct from symbol names.</p>
</li>
</ul>
<p>Unless you want to use its advanced features, this is probably all you
need to know to use Exporter.</p>
<a name="Advanced-Features"></a><h1>Advanced Features</h1>
<a name="Specialised-Import-Lists"></a><h2>Specialised Import Lists</h2>
<p>If any of the entries in an import list begins with !, : or / then
the list is treated as a series of specifications which either add to
or delete from the list of names to import.  They are processed left to
right. Specifications are in the form:</p>
<pre class="verbatim"><ol><li>    <span class="s">[</span>!<span class="s">]</span><span class="w">name</span>         <span class="w">This</span> <span class="w">name</span> <span class="w">only</span></li><li>    <span class="s">[</span>!<span class="s">]</span><span class="co">:</span><span class="w">DEFAULT</span>     <span class="w">All</span> <span class="w">names</span> <span class="w">in</span> <span class="i">@EXPORT</span></li><li>    [!]<span class="co">:</span><span class="w">tag</span>         <span class="w">All</span> <span class="w">names</span> <span class="w">in</span> <span class="i">$EXPORT_TAGS</span>{<span class="w">tag</span>} <span class="w">anonymous</span> <span class="w">array</span></li><li>    <span class="s">[</span>!<span class="s">]</span><span class="q">/pattern/</span>    <span class="w">All</span> <span class="w">names</span> <span class="w">in</span> <span class="i">@EXPORT</span> <a class="l_k" href="functions/and.html">and</a> <span class="i">@EXPORT_OK</span> <span class="w">which</span> <span class="w">match</span></li></ol></pre><p>A leading ! indicates that matching names should be deleted from the
list of names to import.  If the first specification is a deletion it
is treated as though preceded by :DEFAULT.  If you just want to import
extra names in addition to the default set you will still need to
include :DEFAULT explicitly.</p>
<p>e.g., <i>Module.pm</i> defines:</p>
<pre class="verbatim"><ol><li>    <span class="i">@EXPORT</span>      = <span class="q">qw(A1 A2 A3 A4 A5)</span><span class="sc">;</span></li><li>    <span class="i">@EXPORT_OK</span>   = <span class="q">qw(B1 B2 B3 B4 B5)</span><span class="sc">;</span></li><li>    <span class="i">%EXPORT_TAGS</span> = <span class="s">(</span><span class="w">T1</span> <span class="cm">=&gt;</span> <span class="s">[</span><span class="q">qw(A1 A2 B1 B2)</span><span class="s">]</span><span class="cm">,</span> <span class="w">T2</span> <span class="cm">=&gt;</span> <span class="s">[</span><span class="q">qw(A1 A2 B3 B4)</span><span class="s">]</span><span class="s">)</span><span class="sc">;</span></li></ol></pre><p>Note that you cannot use tags in @EXPORT or @EXPORT_OK.</p>
<p>Names in EXPORT_TAGS must also appear in @EXPORT or @EXPORT_OK.</p>
<p>An application using Module can say something like:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/use.html">use</a> <span class="w">Module</span> <span class="q">qw(:DEFAULT :T2 !B3 A3)</span><span class="sc">;</span></li></ol></pre><p>Other examples include:</p>
<pre class="verbatim"><ol><li>    <a class="l_k" href="functions/use.html">use</a> <span class="w">Socket</span> <span class="q">qw(!/^[AP]F_/ !SOMAXCONN !SOL_SOCKET)</span><span class="sc">;</span></li><li>    <a class="l_k" href="functions/use.html">use</a> <span class="w">POSIX</span>  <span class="q">qw(:errno_h :termios_h !TCSADRAIN !/^EXIT/)</span><span class="sc">;</span></li></ol></pre><p>Remember that most patterns (using //) will need to be anchored
with a leading ^, e.g., <code class="inline"><span class="q">/^EXIT/</span></code>
 rather than <code class="inline"><span class="q">/EXIT/</span></code>
.</p>
<p>You can say <code class="inline">BEGIN <span class="s">{</span> <span class="i">$Exporter::Verbose</span>=<span class="n">1</span> <span class="s">}</span></code>
 to see how the
specifications are being processed and what is actually being imported
into modules.</p>
<a name="Exporting-Without-Using-Exporter's-import-Method"></a><h2>Exporting Without Using Exporter's import Method</h2>
<p>Exporter has a special method, 'export_to_level' which is used in situations
where you can't directly call Exporter's
import method.  The export_to_level
method looks like:</p>
<pre class="verbatim"><ol><li>    <span class="w">MyPackage</span><span class="w">-&gt;export_to_level</span><span class="s">(</span></li><li>	<span class="i">$where_to_export</span><span class="cm">,</span> <span class="i">$package</span><span class="cm">,</span> <span class="i">@what_to_export</span></li><li>    <span class="s">)</span><span class="sc">;</span></li></ol></pre><p>where <code class="inline"><span class="i">$where_to_export</span></code>
 is an integer telling how far up the calling stack
to export your symbols, and <code class="inline"><span class="i">@what_to_export</span></code>
 is an array telling what
symbols *to* export (usually this is <code class="inline"><span class="i">@_</span></code>
).  The <code class="inline"><span class="i">$package</span></code>
 argument is
currently unused.</p>
<p>For example, suppose that you have a module, A, which already has an
import function:</p>
<pre class="verbatim"><ol><li><a name="package-A"></a>    package <span class="i">A</span><span class="sc">;</span></li><li></li><li>    <span class="i">@ISA</span> = <span class="q">qw(Exporter)</span><span class="sc">;</span></li><li>    <span class="i">@EXPORT_OK</span> = <span class="q">qw($b)</span><span class="sc">;</span></li><li></li><li><a name="import"></a>    sub <span class="m">import</span></li><li>    <span class="s">{</span></li><li>	<span class="i">$A::b</span> = <span class="n">1</span><span class="sc">;</span>     <span class="c"># not a very useful import method</span></li><li>    <span class="s">}</span></li></ol></pre><p>and you want to Export symbol <code class="inline"><span class="i">$A::b</span></code>
 back to the module that called 
package A.  Since Exporter relies on the import method to work, via 
inheritance, as it stands Exporter::import() will never get called. 
Instead, say the following:</p>
<pre class="verbatim"><ol><li><a name="package-A"></a>    package <span class="i">A</span><span class="sc">;</span></li><li>    <span class="i">@ISA</span> = <span class="q">qw(Exporter)</span><span class="sc">;</span></li><li>    <span class="i">@EXPORT_OK</span> = <span class="q">qw($b)</span><span class="sc">;</span></li><li></li><li><a name="import"></a>    sub <span class="m">import</span></li><li>    <span class="s">{</span></li><li>	<span class="i">$A::b</span> = <span class="n">1</span><span class="sc">;</span></li><li>	<span class="w">A</span><span class="w">-&gt;export_to_level</span><span class="s">(</span><span class="n">1</span><span class="cm">,</span> <span class="i">@_</span><span class="s">)</span><span class="sc">;</span></li><li>    <span class="s">}</span></li></ol></pre><p>This will export the symbols one level 'above' the current package - ie: to 
the program or module that used package A.</p>
<p>Note: Be careful not to modify <code class="inline"><span class="i">@_</span></code>
 at all before you call export_to_level
- or people using your package will get very unexplained results!</p>
<a name="Exporting-Without-Inheriting-from-Exporter"></a><h2>Exporting Without Inheriting from Exporter</h2>
<p>By including Exporter in your <code class="inline"><span class="i">@ISA</span></code>
 you inherit an Exporter's import() method
but you also inherit several other helper methods which you probably don't
want.  To avoid this you can do:</p>
<pre class="verbatim"><ol><li><a name="package-YourModule"></a>  package <span class="i">YourModule</span><span class="sc">;</span></li><li>  <a class="l_k" href="functions/use.html">use</a> <span class="w">Exporter</span> <span class="q">qw(import)</span><span class="sc">;</span></li></ol></pre><p>which will export Exporter's own import() method into YourModule.
Everything will work as before but you won't need to include Exporter in
<code class="inline"><span class="i">@YourModule::ISA</span></code>
.</p>
<p>Note: This feature was introduced in version 5.57
of Exporter, released with perl 5.8.3.</p>
<a name="Module-Version-Checking"></a><h2>Module Version Checking</h2>
<p>The Exporter module will convert an attempt to import a number from a
module into a call to <code class="inline"><span class="i">$module_name</span><span class="i">-&gt;VERSION</span><span class="s">(</span><span class="i">$value</span><span class="s">)</span></code>
.  This can
be used to validate that the version of the module being used is
greater than or equal to the required version.</p>
<p>For historical reasons, Exporter supplies a <code class="inline"><span class="w">require_version</span></code>
 method that
simply delegates to <code class="inline"><span class="w">VERSION</span></code>
.  Originally, before <code class="inline"><span class="w">UNIVERSAL::VERSION</span></code>

existed, Exporter would call <code class="inline"><span class="w">require_version</span></code>
.</p>
<p>Since the <code class="inline"><span class="w">UNIVERSAL::VERSION</span></code>
 method treats the <code class="inline"><span class="i">$VERSION</span></code>
 number as
a simple numeric value it will regard version 1.10 as lower than
1.9.  For this reason it is strongly recommended that you use numbers
with at least two decimal places, e.g., 1.09.</p>
<a name="Managing-Unknown-Symbols"></a><h2>Managing Unknown Symbols</h2>
<p>In some situations you may want to prevent certain symbols from being
exported.  Typically this applies to extensions which have functions
or constants that may not exist on some systems.</p>
<p>The names of any symbols that cannot be exported should be listed
in the <code class="inline"><span class="i">@EXPORT_FAIL</span></code>
 array.</p>
<p>If a module attempts to import any of these symbols the Exporter
will give the module an opportunity to handle the situation before
generating an error.  The Exporter will call an export_fail method
with a list of the failed symbols:</p>
<pre class="verbatim"><ol><li>  <span class="i">@failed_symbols</span> = <span class="i">$module_name</span><span class="i">-&gt;export_fail</span><span class="s">(</span><span class="i">@failed_symbols</span><span class="s">)</span><span class="sc">;</span></li></ol></pre><p>If the <code class="inline"><span class="w">export_fail</span></code>
 method returns an empty list then no error is
recorded and all the requested symbols are exported.  If the returned
list is not empty then an error is generated for each symbol and the
export fails.  The Exporter provides a default <code class="inline"><span class="w">export_fail</span></code>
 method which
simply returns the list unchanged.</p>
<p>Uses for the <code class="inline"><span class="w">export_fail</span></code>
 method include giving better error messages
for some symbols and performing lazy architectural checks (put more
symbols into <code class="inline"><span class="i">@EXPORT_FAIL</span></code>
 by default and then take them out if someone
actually tries to use them and an expensive check shows that they are
usable on that platform).</p>
<a name="Tag-Handling-Utility-Functions"></a><h2>Tag Handling Utility Functions</h2>
<p>Since the symbols listed within <code class="inline"><span class="i">%EXPORT_TAGS</span></code>
 must also appear in either
<code class="inline"><span class="i">@EXPORT</span></code>
 or <code class="inline"><span class="i">@EXPORT_OK</span></code>
, two utility functions are provided which allow
you to easily add tagged sets of symbols to <code class="inline"><span class="i">@EXPORT</span></code>
 or <code class="inline"><span class="i">@EXPORT_OK</span></code>
:</p>
<pre class="verbatim"><ol><li>  <span class="i">%EXPORT_TAGS</span> = <span class="s">(</span><span class="w">foo</span> <span class="cm">=&gt;</span> <span class="s">[</span><span class="q">qw(aa bb cc)</span><span class="s">]</span><span class="cm">,</span> <span class="w">bar</span> <span class="cm">=&gt;</span> <span class="s">[</span><span class="q">qw(aa cc dd)</span><span class="s">]</span><span class="s">)</span><span class="sc">;</span></li><li></li><li>  <span class="i">Exporter::export_tags</span><span class="s">(</span><span class="q">&#39;foo&#39;</span><span class="s">)</span><span class="sc">;</span>     <span class="c"># add aa, bb and cc to @EXPORT</span></li><li>  <span class="i">Exporter::export_ok_tags</span><span class="s">(</span><span class="q">&#39;bar&#39;</span><span class="s">)</span><span class="sc">;</span>  <span class="c"># add aa, cc and dd to @EXPORT_OK</span></li></ol></pre><p>Any names which are not tags are added to <code class="inline"><span class="i">@EXPORT</span></code>
 or <code class="inline"><span class="i">@EXPORT_OK</span></code>

unchanged but will trigger a warning (with <code class="inline">-w</code>
) to avoid misspelt tags
names being silently added to <code class="inline"><span class="i">@EXPORT</span></code>
 or <code class="inline"><span class="i">@EXPORT_OK</span></code>
.  Future versions
may make this a fatal error.</p>
<a name="Generating-Combined-Tags"></a><h2>Generating Combined Tags</h2>
<p>If several symbol categories exist in <code class="inline"><span class="i">%EXPORT_TAGS</span></code>
, it's usually
useful to create the utility ":all" to simplify "use" statements.</p>
<p>The simplest way to do this is:</p>
<pre class="verbatim"><ol><li>  <span class="i">%EXPORT_TAGS</span> = <span class="s">(</span><span class="w">foo</span> <span class="cm">=&gt;</span> <span class="s">[</span><span class="q">qw(aa bb cc)</span><span class="s">]</span><span class="cm">,</span> <span class="w">bar</span> <span class="cm">=&gt;</span> <span class="s">[</span><span class="q">qw(aa cc dd)</span><span class="s">]</span><span class="s">)</span><span class="sc">;</span></li><li></li><li>  <span class="c"># add all the other &quot;:class&quot; tags to the &quot;:all&quot; class,</span></li><li>  <span class="c"># deleting duplicates</span></li><li>  <span class="s">{</span></li><li>    <a class="l_k" href="functions/my.html">my</a> <span class="i">%seen</span><span class="sc">;</span></li><li></li><li>    <a class="l_k" href="functions/push.html">push</a> <span class="i">@</span>{<span class="i">$EXPORT_TAGS</span>{<span class="w">all</span>}}<span class="cm">,</span></li><li>      <a class="l_k" href="functions/grep.html">grep</a> <span class="s">{</span>!<span class="i">$seen</span>{<span class="i">$_</span>}++<span class="s">}</span> <span class="i">@</span>{<span class="i">$EXPORT_TAGS</span>{<span class="i">$_</span>}} foreach <a class="l_k" href="functions/keys.html">keys</a> <span class="i">%EXPORT_TAGS</span><span class="sc">;</span></li><li>  <span class="s">}</span></li></ol></pre><p><i>CGI.pm</i> creates an ":all" tag which contains some (but not really
all) of its categories.  That could be done with one small
change:</p>
<pre class="verbatim"><ol><li>  <span class="c"># add some of the other &quot;:class&quot; tags to the &quot;:all&quot; class,</span></li><li>  <span class="c"># deleting duplicates</span></li><li>  <span class="s">{</span></li><li>    <a class="l_k" href="functions/my.html">my</a> <span class="i">%seen</span><span class="sc">;</span></li><li></li><li>    <a class="l_k" href="functions/push.html">push</a> <span class="i">@</span>{<span class="i">$EXPORT_TAGS</span>{<span class="w">all</span>}}<span class="cm">,</span></li><li>      <a class="l_k" href="functions/grep.html">grep</a> <span class="s">{</span>!<span class="i">$seen</span>{<span class="i">$_</span>}++<span class="s">}</span> <span class="i">@</span>{<span class="i">$EXPORT_TAGS</span>{<span class="i">$_</span>}}</li><li>        foreach <span class="q">qw/html2 html3 netscape form cgi internal/</span><span class="sc">;</span></li><li>  <span class="s">}</span></li></ol></pre><p>Note that the tag names in <code class="inline"><span class="i">%EXPORT_TAGS</span></code>
 don't have the leading ':'.</p>
<a name="AUTOLOADed-Constants"></a><h2><code class="inline">AUTOLOAD</code>
ed Constants</h2>
<p>Many modules make use of <code class="inline">AUTOLOAD</code>
ing for constant subroutines to
avoid having to compile and waste memory on rarely used values (see
<a href="perlsub.html">perlsub</a> for details on constant subroutines).  Calls to such
constant subroutines are not optimized away at compile time because
they can't be checked at compile time for constancy.</p>
<p>Even if a prototype is available at compile time, the body of the
subroutine is not (it hasn't been <code class="inline">AUTOLOAD</code>
ed yet).  perl needs to
examine both the <code class="inline"><span class="s">(</span><span class="s">)</span></code>
 prototype and the body of a subroutine at
compile time to detect that it can safely replace calls to that
subroutine with the constant value.</p>
<p>A workaround for this is to call the constants once in a <code class="inline">BEGIN</code>
 block:</p>
<pre class="verbatim"><ol><li><a name="package-My"></a>   package <span class="i">My</span> <span class="sc">;</span></li><li></li><li>   <a class="l_k" href="functions/use.html">use</a> <span class="w">Socket</span> <span class="sc">;</span></li><li></li><li>   <span class="i">foo</span><span class="s">(</span> <span class="w">SO_LINGER</span> <span class="s">)</span><span class="sc">;</span>  <span class="c">## SO_LINGER NOT optimized away; called at runtime</span></li><li>   <a class="l_k" href="functions/BEGIN.html">BEGIN</a> <span class="s">{</span> <span class="w">SO_LINGER</span> <span class="s">}</span></li><li>   <span class="i">foo</span><span class="s">(</span> <span class="w">SO_LINGER</span> <span class="s">)</span><span class="sc">;</span>  <span class="c">## SO_LINGER optimized away at compile time.</span></li></ol></pre><p>This forces the <code class="inline">AUTOLOAD</code>
 for <code class="inline"><span class="w">SO_LINGER</span></code>
 to take place before
SO_LINGER is encountered later in <code class="inline"><span class="w">My</span></code>
 package.</p>
<p>If you are writing a package that <code class="inline">AUTOLOAD</code>
s, consider forcing
an <code class="inline">AUTOLOAD</code>
 for any constants explicitly imported by other packages
or which are usually used when your package is <code class="inline"><a class="l_k" href="functions/use.html">use</a></code>d.</p>
<a name="Good-Practices"></a><h1>Good Practices</h1>
<a name="Declaring-%40EXPORT_OK-and-Friends"></a><h2>Declaring <code class="inline"><span class="i">@EXPORT_OK</span></code>
 and Friends</h2>
<p>When using <code class="inline"><span class="w">Exporter</span></code>
 with the standard <code class="inline"><span class="w">strict</span></code>
 and <code class="inline"><span class="w">warnings</span></code>

pragmas, the <code class="inline"><a class="l_k" href="functions/our.html">our</a></code> keyword is needed to declare the package
variables <code class="inline"><span class="i">@EXPORT_OK</span></code>
, <code class="inline"><span class="i">@EXPORT</span></code>
, <code class="inline"><span class="i">@ISA</span></code>
, etc.</p>
<pre class="verbatim"><ol><li>  <a class="l_k" href="functions/our.html">our</a> <span class="i">@ISA</span> = <span class="q">qw(Exporter)</span><span class="sc">;</span></li><li>  <a class="l_k" href="functions/our.html">our</a> <span class="i">@EXPORT_OK</span> = <span class="q">qw(munge frobnicate)</span><span class="sc">;</span></li></ol></pre><p>If backward compatibility for Perls under 5.6 is important,
one must write instead a <code class="inline"><a class="l_k" href="functions/use.html">use</a> <span class="w">vars</span></code>
 statement.</p>
<pre class="verbatim"><ol><li>  <a class="l_k" href="functions/use.html">use</a> <span class="w">vars</span> <span class="q">qw(@ISA @EXPORT_OK)</span><span class="sc">;</span></li><li>  <span class="i">@ISA</span> = <span class="q">qw(Exporter)</span><span class="sc">;</span></li><li>  <span class="i">@EXPORT_OK</span> = <span class="q">qw(munge frobnicate)</span><span class="sc">;</span></li></ol></pre><a name="Playing-Safe"></a><h2>Playing Safe</h2>
<p>There are some caveats with the use of runtime statements
like <code class="inline"><a class="l_k" href="functions/require.html">require</a> <span class="w">Exporter</span></code>
 and the assignment to package
variables, which can be very subtle for the unaware programmer.
This may happen for instance with mutually recursive
modules, which are affected by the time the relevant
constructions are executed.</p>
<p>The ideal (but a bit ugly) way to never have to think
about that is to use <code class="inline">BEGIN</code>
 blocks.  So the first part
of the <a href="#SYNOPSIS">SYNOPSIS</a> code could be rewritten as:</p>
<pre class="verbatim"><ol><li><a name="package-YourModule"></a>  package <span class="i">YourModule</span><span class="sc">;</span></li><li></li><li>  <a class="l_k" href="functions/use.html">use</a> <span class="w">strict</span><span class="sc">;</span></li><li>  <a class="l_k" href="functions/use.html">use</a> <span class="w">warnings</span><span class="sc">;</span></li><li></li><li>  <a class="l_k" href="functions/our.html">our</a> <span class="s">(</span><span class="i">@ISA</span><span class="cm">,</span> <span class="i">@EXPORT_OK</span><span class="s">)</span><span class="sc">;</span></li><li>  BEGIN <span class="s">{</span></li><li>     <a class="l_k" href="functions/require.html">require</a> <span class="w">Exporter</span><span class="sc">;</span></li><li>     <span class="i">@ISA</span> = <span class="q">qw(Exporter)</span><span class="sc">;</span></li><li>     <span class="i">@EXPORT_OK</span> = <span class="q">qw(munge frobnicate)</span><span class="sc">;</span>  <span class="c"># symbols to export on request</span></li><li>  <span class="s">}</span></li></ol></pre><p>The <code class="inline">BEGIN</code>
 will assure that the loading of <i>Exporter.pm</i>
and the assignments to <code class="inline"><span class="i">@ISA</span></code>
 and <code class="inline"><span class="i">@EXPORT_OK</span></code>
 happen
immediately, leaving no room for something to get awry
or just plain wrong.</p>
<p>With respect to loading <code class="inline"><span class="w">Exporter</span></code>
 and inheriting, there
are alternatives with the use of modules like <code class="inline"><span class="w">base</span></code>
 and <code class="inline"><span class="w">parent</span></code>
.</p>
<pre class="verbatim"><ol><li>  <a class="l_k" href="functions/use.html">use</a> <span class="w">base</span> <span class="q">qw(Exporter)</span><span class="sc">;</span></li><li>  <span class="c"># or</span></li><li>  <a class="l_k" href="functions/use.html">use</a> <span class="w">parent</span> <span class="q">qw(Exporter)</span><span class="sc">;</span></li></ol></pre><p>Any of these statements are nice replacements for
<code class="inline">BEGIN <span class="s">{</span> <a class="l_k" href="functions/require.html">require</a> <span class="w">Exporter</span><span class="sc">;</span> <span class="i">@ISA</span> = <span class="q">qw(Exporter)</span><span class="sc">;</span> <span class="s">}</span></code>

with the same compile-time effect.  The basic difference
is that <code class="inline"><span class="w">base</span></code>
 code interacts with declared <code class="inline"><span class="w">fields</span></code>

while <code class="inline"><span class="w">parent</span></code>
 is a streamlined version of the older
<code class="inline"><span class="w">base</span></code>
 code to just establish the IS-A relationship.</p>
<p>For more details, see the documentation and code of
<a href="base.html">base</a> and <a href="parent.html">parent</a>.</p>
<p>Another thorough remedy to that runtime
vs. compile-time trap is to use <a href="http://search.cpan.org/perldoc/Exporter::Easy">Exporter::Easy</a>,
which is a wrapper of Exporter that allows all
boilerplate code at a single gulp in the
use statement.</p>
<pre class="verbatim"><ol><li>   <a class="l_k" href="functions/use.html">use</a> <span class="w">Exporter::Easy</span> <span class="s">(</span></li><li>       <span class="w">OK</span> <span class="cm">=&gt;</span> <span class="s">[</span> <span class="q">qw(munge frobnicate)</span> <span class="s">]</span><span class="cm">,</span></li><li>   <span class="s">)</span><span class="sc">;</span></li><li>   <span class="c"># @ISA setup is automatic</span></li><li>   <span class="c"># all assignments happen at compile time</span></li></ol></pre><a name="What-Not-to-Export"></a><h2>What Not to Export</h2>
<p>You have been warned already in <a href="#Selecting-What-to-Export">Selecting What to Export</a>
to not export:</p>
<ul>
<li>
<p>method names (because you don't need to
and that's likely to not do what you want),</p>
</li>
<li>
<p>anything by default (because you don't want to surprise your users...
badly)</p>
</li>
<li>
<p>anything you don't need to (because less is more)</p>
</li>
</ul>
<p>There's one more item to add to this list.  Do <b>not</b>
export variable names.  Just because <code class="inline"><span class="w">Exporter</span></code>
 lets you
do that, it does not mean you should.</p>
<pre class="verbatim"><ol><li>  <span class="i">@EXPORT_OK</span> = <span class="q">qw($svar @avar %hvar)</span><span class="sc">;</span> <span class="c"># DON&#39;T!</span></li></ol></pre><p>Exporting variables is not a good idea.  They can
change under the hood, provoking horrible
effects at-a-distance that are too hard to track
and to fix.  Trust me: they are not worth it.</p>
<p>To provide the capability to set/get class-wide
settings, it is best instead to provide accessors
as subroutines or class methods instead.</p>
<a name="SEE-ALSO"></a><h1>SEE ALSO</h1>
<p><code class="inline"><span class="w">Exporter</span></code>
 is definitely not the only module with
symbol exporter capabilities.  At CPAN, you may find
a bunch of them.  Some are lighter.  Some
provide improved APIs and features.  Pick the one
that fits your needs.  The following is
a sample list of such modules.</p>
<pre class="verbatim"><ol><li>    <span class="w">Exporter::Easy</span></li><li>    <span class="w">Exporter::Lite</span></li><li>    <span class="w">Exporter::Renaming</span></li><li>    <span class="w">Exporter::Tidy</span></li><li>    <span class="w">Sub::Exporter</span> / <span class="w">Sub::Installer</span></li><li>    <span class="w">Perl6::Export</span> / <span class="w">Perl6::Export::Attrs</span></li></ol></pre><a name="LICENSE"></a><h1>LICENSE</h1>
<p>This library is free software.  You can redistribute it
and/or modify it under the same terms as Perl itself.</p>




  <div id="page_index" class="hud_container">
    <div id="page_index_header" class="hud_header">
      <div id="page_index_close" class="hud_close"><a href="#" onClick="pageIndex.hide();return false;"></a></div>
      <div id="page_index_title" class="hud_title"><span class="hud_span_top">Page index</span></div>
      <div id="page_index_topright" class="hud_topright"></div>
    </div>
    <div id="page_index_content" class="hud_content">
      <ul><li><a href="#NAME">NAME</a><li><a href="#SYNOPSIS">SYNOPSIS</a><li><a href="#DESCRIPTION">DESCRIPTION</a><ul><li><a href="#How-to-Export">How to Export</a><li><a href="#Selecting-What-to-Export">Selecting What to Export</a><li><a href="#How-to-Import">How to Import</a></ul><li><a href="#Advanced-Features">Advanced Features</a><ul><li><a href="#Specialised-Import-Lists">Specialised Import Lists</a><li><a href="#Exporting-Without-Using-Exporter's-import-Method">Exporting Without Using Exporter's import Method</a><li><a href="#Exporting-Without-Inheriting-from-Exporter">Exporting Without Inheriting from Exporter</a><li><a href="#Module-Version-Checking">Module Version Checking</a><li><a href="#Managing-Unknown-Symbols">Managing Unknown Symbols</a><li><a href="#Tag-Handling-Utility-Functions">Tag Handling Utility Functions</a><li><a href="#Generating-Combined-Tags">Generating Combined Tags</a><li><a href="#AUTOLOADed-Constants">AUTOLOADed Constants</a></ul><li><a href="#Good-Practices">Good Practices</a><ul><li><a href="#Declaring-%40EXPORT_OK-and-Friends">Declaring @EXPORT_OK and Friends</a><li><a href="#Playing-Safe">Playing Safe</a><li><a href="#What-Not-to-Export">What Not to Export</a></ul><li><a href="#SEE-ALSO">SEE ALSO</a><li><a href="#LICENSE">LICENSE</a></ul>
    </div>
    <div id="page_index_footer" class="hud_footer">
      <div id="page_index_bottomleft" class="hud_bottomleft"></div>
      <div id="page_index_bottom" class="hud_bottom"><span class="hud_span_bottom"></span></div>
      <div id="page_index_resize" class="hud_resize"></div>
    </div>
  </div>


	    &nbsp;
          </div>
          <div id="content_footer">
          </div>
        </div>
        <div class="clear"></div>
      </div>
      
    <div id="footer">
      <div id="footer_content">
        <div id="footer_strapline">
          perldoc.perl.org - Official documentation for the Perl programming language
        </div>
        <div id="footer_links">
          <div id="address">
            <p class="name">Contact details</p>
            <p class="address">
	      Site maintained by <a href="mailto:jj@jonallen.info">Jon Allen (JJ)</a><br>
	    </p>
            <p class="contact">
              Documentation maintained by the <a href="http://lists.cpan.org/showlist.cgi?name=perl5-porters">Perl 5 Porters</a>
            </p>
          </div>
          <ul class="f1">
            <li>Manual
              <ul class="f2">
                <li><a href="index-overview.html">Overview</a>
                <li><a href="index-tutorials.html">Tutorials</a>
                <li><a href="index-faq.html">FAQs</a>
                <li><a href="index-history.html">Changes</a>
              </ul>
            <li>Reference
              <ul class="f2">
                <li><a href="index-language.html">Language</a>
                <li><a href="index-functions.html">Functions</a>
                <li><a href="perlop.html">Operators</a>
                <li><a href="perlvar.html">Variables</a>
              </ul>
            <li>Modules
              <ul class="f2">
                <li><a href="index-modules-A.html">Modules</a>
                <li><a href="index-pragmas.html">Pragmas</a>
                <li><a href="index-utilities.html">Utilities</a>
              </ul>
            <li>Misc
              <ul class="f2">
                <li><a href="index-licence.html">License</a>
                <li><a href="index-internals.html">Internals</a>
                <li><a href="index-platforms.html">Platforms</a>
              </ul>          </ul>
          <div class="clear"></div>
        </div>
      </div>
      <div id="footer_end">
      </div>
    </div>
      
    </div>
      <script language="JavaScript" type="text/javascript" src="static/exploreperl.js"></script>
      <script language="JavaScript" src="static/combined-20100403.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">
  perldoc.setPath(0);
  perldoc.pageName    = 'Exporter';
  perldoc.pageAddress = 'Exporter.html';
  perldoc.contentPage = 1;
  explorePerl.render();
  explorePerl.addEvents('explore_anchor');
</script>
    
  </body>
</html>