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 $x = func1(...); # Load file func1.pdl
11 $y = 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 an unknown
17 function func() is called, PDL looks for a file called "func.pdl". If
18 it finds one, it compiles the file and calls the function "func".
19
20 The list of directories to search in is given by the shell environment
21 variable "PDLLIB". This is a colon-separated list of directories. On
22 MSWindows systems, is it a semicolon -separated list of directories.
23
24 For example, in csh:
25
26 setenv PDLLIB "/home/joe/pdllib:/local/pdllib"
27
28 Note: This variable is unrelated to Perl's "PERL5LIB".
29
30 If you add a leading '+' on a directory name, PDL will search the
31 entire directory tree below that point. Internally, PDL stores the
32 directory list in the variable @PDLLIB, which can be modified at run
33 time.
34
35 For example, in csh:
36
37 setenv PDLLIB "+/home/joe/PDL"
38
39 will search /home/joe/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" or "pdl2" command
44 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" or
48 "pdl2" command line. Which means in practice you can edit files, save
49 changes and have "perldl" or "pdl2" 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 PDL 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 sub foo { # file 'foo.pdl' - define the 'foo' function
63 my $x=shift;
64 return sqrt($x**2 + $x**3 + 2);
65 }
66 1; # File returns true (i.e. loaded successfully)
67
69 Copyright(C) 1997 Karl Glazebrook (kgb@aaoepp.aao.gov.au); several
70 extensions by Craig DeForest (deforest@boulder.swri.edu) All rights
71 reserved. There is no warranty. You are allowed to redistribute this
72 software / documentation under certain conditions. For details, see the
73 file COPYING in the PDL distribution. If this file is separated from
74 the PDL distribution, the copyright notice should be included in the
75 file.
76
78 No doubt this interface could be improved upon some more. :-)
79
80 Will probably be quite slow if "$PDL::AutoLoader::Rescan == 1" and
81 thousands of functions have been autoloaded.
82
83 There could be a race condition in which the file changes while the
84 internal autoloader code is being executed but it should be harmless.
85
86 Probably has not been tested enough!
87
89 For an alternative approach to managing a personal collaction of
90 modules and functions, see local::lib.
91
92 PDL::AutoLoader::expand_path
93 Expand a compactified path into a dir list
94
95 You supply a pathlist and leading '+' and '~' characters get expanded
96 into full directories. Normally you don't want to use this -- it's
97 internal to the autoloader -- but some utilities, like the online
98 documentation searcher, need to be able to use it.
99
100
101
102perl v5.36.0 2023-01-20 AutoLoader(3)