PDL::AutoLoader(3pm)
πΈ NAME πΈ
PDL::AutoLoader β it's giving MatLab style AutoLoader for PDL, bestie π
Like, the manual page is PDL::AutoLoader(3pm) and it's part of the User Contributed Perl Documentation, and honestly? It's a whole vibe.
β¨ SYNOPSIS β¨
use PDL::AutoLoader;
$x = func1(...); # Load file func1.pdl
$y = func2(...); # Load file func2.pdl
$PDL::AutoLoader::Rescan = 1; # Enable re-scanning
π¦ DESCRIPTION π¦
Okay so. This module implements a MatLab style AutoLoader for PDL. The way it works is iconic: if some unknown function func() gets called, PDL goes looking for a file called func.pdl. And if it finds one? It compiles the file and then calls the function func. No cap. π«Ά
The list of directories it searches in is given by the shell environment variable PDLLIB. That's a colon-separated list of directories. And on MSWindows systems, is it a semicolon-separated list of directories. (Different separator, same energy.)
For example, in csh:
setenv PDLLIB "/home/joe/pdllib:/local/pdllib"
Note: this variable is unrelated to Perl's PERL5LIB. Like, not even cousins.
If you add a leading '+' on a directory name, PDL will search the entire directory tree below that point. Internally, PDL stores the directory list in the variable @PDLLIB, which can be modified at run time. Very main character of it.
For example, in csh:
setenv PDLLIB "+/home/joe/PDL"
...will search /home/joe/PDL and all its subdirectories for .pdl files. Obsessed. π
π AUTO-SCANNING π
The variable $PDL::AutoLoader::Rescan controls whether files are automatically re-scanned for changes at the "perldl" command line.
If "$PDL::AutoLoader::Rescan == 1" and the file is changed, then the new definition is reloaded automatically before executing the "perldl" command line. Which means in practice you can edit files, save changes, and have "perldl" see the changes automatically. Literally the dream workflow. β¨
The default is '0' β i.e. to have this feature disabled. π
As this feature is only pertinent to the PDL shell, it imposes no overhead on PDL scripts. Yes Bob, you can have your cake and eat it too! π
Note: files are only re-evaled if they are determined to have been changed according to their date/time stamp. That's the vibe check.
No doubt this interface could be improved upon some more. :-)
π Sample file π
sub foo { # file 'foo.pdl' - define the 'foo' function
my $x=shift;
return sqrt($x**2 + $x**3 + 2);
}
1; # File returns true (i.e. loaded successfully)
π 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 COPYING in the PDL distribution. If this file is separated from the PDL distribution, the copyright notice should be included in the file. Periodt. π
π BUGS π
No doubt this interface could be improved upon some more. :-)
Will probably be quite slow if "$PDL::AutoLoader::Rescan == 1" and thousands of functions have been autoloaded. π
There could be a race condition in which the file changes while the internal autoloader code is being executed β but it should be harmless. Ngl, we're choosing to trust it.
Probably has not been tested enough! π
π SEE ALSO π
For an alternative approach to managing a personal collection of modules and functions, see local::lib. Cute, right?
π§ PDL::AutoLoader::expand_path π§
Expand a compactified path into a dir list.
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. iykyk. π
And that's the whole page, bestie! This little masterpiece is perl v5.42.3, dated 2026-08-20, and it lives under the name PDL::AutoLoader(3pm). Slay, stay loading those .pdl files, and don't forget to thank the documentation for its service. πβ¨π¦
π¦ where this page comes from
- ubuntu stonking: pdl 1:2.106-1build1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms