1AutoLoader(3) User Contributed Perl Documentation AutoLoader(3)
2
3
4
6 PDL::AutoLoader - MatLab style AutoLoader for PDL
7
9 use PDL::AutoLoader;
10 $a = func1(...); # Load file func1.pdl
11 $b = func2(...); # Load file func2.pdl
12
13 $PDL::AutoLoader::Rescan = 1; # Enable re-scanning
14
16 This module implements a MatLab style AutoLoader for PDL. If a unknown
17 function 'func()' is called then a file 'func.pdl' is searched for and
18 if found is read in to define 'func()' which is then executed.
19
20 Files are seached for using the directories in seach path @PDLLIB,
21 which is initialised from the shell environment variable "PDLLIB" which
22 is a colon seperated list of directories.
23
24 e.g. in csh
25
26 setenv PDLLIB "/home/kgb/pdllib:/local/pdllib"
27
28 Note this is kept seperate from "PERL5LIB" just in case.
29
30 As an added bonus, you can use a leading '+' on a directory name to
31 search not just that directory but the entire directory tree under it
32 (excluding symlinks). The subdirs are determined by explicit search,
33 and searches occur at startup and again each time you change the number
34 of elements in @PDLLIB.
35
36 For example,
37 setenv PDLLIB "+~kgb/PDL"
38
39 will search /home/kgb/PDL and all its subdirectories for .pdl files.
40
41 AUTO-SCANNING
42
43 The variable $PDL::AutoLoader::Rescan controls whether files are auto‐
44 matically re-scanned for changes at the "perldl" command line.
45
46 If "$PDL::AutoLoader::Rescan == 1" and the file is changed then the new
47 definition is reloaded auto-matically before executing the "perldl"
48 command line. Which means in practice you can edit files, save changes
49 and have "perldl" see the changes automatically.
50
51 The default is '0' - i.e. to have this feature disabled.
52
53 As this feature is only pertinent to the "perldl" shell it imposes no
54 overhead on PDL scripts. Yes Bob you can have your cake and eat it too!
55
56 Note: files are only re-evaled if they are determined to have been
57 changed according to their date/time stamp.
58
59 No doubt this interface could be improved upon some more. :-)
60
61 Sample file:
62
63 sub foo { # file 'foo.pdl' - define the 'foo' function
64 my $x=shift;
65 return sqrt($x**2 + $x**3 + 2);
66 }
67 1; # File returns true (i.e. loaded successfully)
68
70 Copyright(C) 1997 Karl Glazebrook (kgb@aaoepp.aao.gov.au); several
71 extensions by Craig DeForest (deforest@boulder.swri.edu) All rights
72 reserved. There is no warranty. You are allowed to redistribute this
73 software / documentation under certain conditions. For details, see the
74 file COPYING in the PDL distribution. If this file is separated from
75 the PDL distribution, the copyright notice should be included in the
76 file.
77
79 No doubt this interface could be improved upon some more. :-)
80
81 Will probably be quite slow if "$PDL::AutoLoader::Rescan == 1" and
82 thousands of functions have been autoloaded.
83
84 There could be a race condition in which the file changes while the
85 internal autoloader code is being executed but it should be harmless.
86
87 Probably has not been tested enough!
88
89 PDL::AutoLoader::expand_path
90
91 Expand a compactified path into a dir list
92
93 You supply a pathlist and leading '+' and '~' characters get expanded
94 into full directories. Normally you don't want to use this -- it's
95 internal to the autoloader -- but some utilities, like the online docu‐
96 mentation searcher, need to be able to use it.
97
98
99
100perl v5.8.8 2004-09-07 AutoLoader(3)