.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "AutoLoader 3pm" .TH AutoLoader 3pm "2023-06-17" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" PDL::AutoLoader \- MatLab style AutoLoader for PDL .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& use PDL::AutoLoader; \& $x = func1(...); # Load file func1.pdl \& $y = func2(...); # Load file func2.pdl \& \& $PDL::AutoLoader::Rescan = 1; # Enable re\-scanning .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module implements a MatLab style AutoLoader for \s-1PDL.\s0 If an unknown function \f(CW\*(C`func()\*(C'\fR is called, \s-1PDL\s0 looks for a file called \f(CW\*(C`func.pdl\*(C'\fR. If it finds one, it compiles the file and calls the function \f(CW\*(C`func\*(C'\fR. .PP The list of directories to search in is given by the shell environment variable \f(CW\*(C`PDLLIB\*(C'\fR. This is a colon-separated list of directories. On MSWindows systems, is it a \fIsemicolon\fR \-separated list of directories. .PP For example, in csh: .PP .Vb 1 \& setenv PDLLIB "/home/joe/pdllib:/local/pdllib" .Ve .PP \&\fBNote\fR: This variable is unrelated to Perl's \f(CW\*(C`PERL5LIB\*(C'\fR. .PP If you add a leading '+' on a directory name, \s-1PDL\s0 will search the entire directory tree below that point. Internally, \s-1PDL\s0 stores the directory list in the variable \f(CW@PDLLIB\fR, which can be modified at run time. .PP For example, in csh: .PP .Vb 1 \& setenv PDLLIB "+/home/joe/PDL" .Ve .PP will search /home/joe/PDL and all its subdirectories for .pdl files. .SS "AUTO-SCANNING" .IX Subsection "AUTO-SCANNING" The variable \f(CW$PDL::AutoLoader::Rescan\fR controls whether files are automatically re-scanned for changes at the \f(CW\*(C`perldl\*(C'\fR or \&\f(CW\*(C`pdl2\*(C'\fR command line. .PP If \f(CW\*(C`$PDL::AutoLoader::Rescan == 1\*(C'\fR and the file is changed then the new definition is reloaded auto-matically before executing the \f(CW\*(C`perldl\*(C'\fR or \f(CW\*(C`pdl2\*(C'\fR command line. Which means in practice you can edit files, save changes and have \f(CW\*(C`perldl\*(C'\fR or \f(CW\*(C`pdl2\*(C'\fR see the changes automatically. .PP The default is '0' \- i.e. to have this feature disabled. .PP As this feature is only pertinent to the \s-1PDL\s0 shell it imposes no overhead on \s-1PDL\s0 scripts. Yes Bob you can have your cake and eat it too! .PP Note: files are only re-evaled if they are determined to have been changed according to their date/time stamp. .PP No doubt this interface could be improved upon some more. :\-) .SS "Sample file:" .IX Subsection "Sample file:" .Vb 5 \& sub foo { # file \*(Aqfoo.pdl\*(Aq \- define the \*(Aqfoo\*(Aq function \& my $x=shift; \& return sqrt($x**2 + $x**3 + 2); \& } \& 1; # File returns true (i.e. loaded successfully) .Ve .SH "AUTHOR" .IX Header "AUTHOR" Copyright(C) 1997 Karl Glazebrook (kgb@aaoepp.aao.gov.au); several extensions by Craig DeForest (deforest@boulder.swri.edu) All rights reserved. There is no warranty. You are allowed to redistribute this software / documentation under certain conditions. For details, see the file \s-1COPYING\s0 in the \s-1PDL\s0 distribution. If this file is separated from the \s-1PDL\s0 distribution, the copyright notice should be included in the file. .SH "BUGS" .IX Header "BUGS" No doubt this interface could be improved upon some more. :\-) .PP Will probably be quite slow if \f(CW\*(C`$PDL::AutoLoader::Rescan == 1\*(C'\fR and thousands of functions have been autoloaded. .PP There could be a race condition in which the file changes while the internal autoloader code is being executed but it should be harmless. .PP Probably has not been tested enough! .SH "SEE ALSO" .IX Header "SEE ALSO" For an alternative approach to managing a personal collaction of modules and functions, see local::lib. .SS "PDL::AutoLoader::expand_path" .IX Subsection "PDL::AutoLoader::expand_path" Expand a compactified path into a dir list .PP You supply a pathlist and leading '+' and '~' characters get expanded into full directories. Normally you don't want to use this \*(-- it's internal to the autoloader \*(-- but some utilities, like the online documentation searcher, need to be able to use it.