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 The variable $PDL::AutoLoader::Rescan controls whether files are
43 automatically re-scanned for changes at the "perldl" command line.
44
45 If "$PDL::AutoLoader::Rescan == 1" and the file is changed then the new
46 definition is reloaded auto-matically before executing the "perldl"
47 command line. Which means in practice you can edit files, save changes
48 and have "perldl" see the changes automatically.
49
50 The default is '0' - i.e. to have this feature disabled.
51
52 As this feature is only pertinent to the "perldl" shell it imposes no
53 overhead on PDL scripts. Yes Bob you can have your cake and eat it too!
54
55 Note: files are only re-evaled if they are determined to have been
56 changed according to their date/time stamp.
57
58 No doubt this interface could be improved upon some more. :-)
59
60 Sample file:
61 sub foo { # file 'foo.pdl' - define the 'foo' function
62 my $x=shift;
63 return sqrt($x**2 + $x**3 + 2);
64 }
65 1; # File returns true (i.e. loaded successfully)
66
68 Copyright(C) 1997 Karl Glazebrook (kgb@aaoepp.aao.gov.au); several
69 extensions by Craig DeForest (deforest@boulder.swri.edu) All rights
70 reserved. There is no warranty. You are allowed to redistribute this
71 software / documentation under certain conditions. For details, see the
72 file COPYING in the PDL distribution. If this file is separated from
73 the PDL distribution, the copyright notice should be included in the
74 file.
75
77 No doubt this interface could be improved upon some more. :-)
78
79 Will probably be quite slow if "$PDL::AutoLoader::Rescan == 1" and
80 thousands of functions have been autoloaded.
81
82 There could be a race condition in which the file changes while the
83 internal autoloader code is being executed but it should be harmless.
84
85 Probably has not been tested enough!
86
87 PDL::AutoLoader::expand_path
88 Expand a compactified path into a dir list
89
90 You supply a pathlist and leading '+' and '~' characters get expanded
91 into full directories. Normally you don't want to use this -- it's
92 internal to the autoloader -- but some utilities, like the online
93 documentation searcher, need to be able to use it.
94
95
96
97perl v5.12.3 2009-10-17 AutoLoader(3)