Quoth Joost Diepenmaat said:
AFAIK if you don't explicitly import specific functions, they'll only be
loaded when you actually use them. See AutoLoader. This does slow down
the first call to such a function a bit.
AutoLoading only happens on first call, regardless of imports:
~/src/perl% ktrace perl -MPOSIX=errno
-e'open my $F, ">", "test-errno"; errno;'
~/src/perl% kdump -tn | grep errno
2127 perl NAMI "test-errno"
2127 perl NAMI "/usr/local/lib/perl5/5.8.8/mach/auto/POSIX/errno.al"
2127 perl NAMI "/usr/local/lib/perl5/5.8.8/mach/auto/POSIX/errno.al"
2127 perl NAMI "/usr/local/lib/perl5/5.8.8/mach/auto/POSIX/errno.al"
perl doesn't even look for the .al until after it's opened the file.
Whether functions are AutoLoaded or not depends entirely on the module:
most of POSIX's useful functions (including strftime) are written in C,
so they can't be, except insofar as your OS will only page in the
relevant parts of the .so when they are needed
.
Ben