Win32 Extensions
In addition to the modules listed previously, Perl for Win32 can use an additional set of functions from the Win32 extension. These functions provide useful tools for some Windows-specific tasks that don’t require their own modules. They are exported from the Win32 package with:
use Win32;
Many of these functions do not take arguments and return the value (or values) of the requested information, unless otherwise noted.
Win32::CopyFile(from,to,overwrite)Copies an existing file to a new file, while preserving all attributes of the original file, except the security information. If
toexists, overwriting will take place only ifoverwriteis true. Read-only files will never be overwritten; they will need to beunlinked first.Win32::FreeLibrary(handle)Unloads a previously loaded DLL.
handleis no longer valid afterFreeLibrary( )is called.Win32::GetArchName( )Has been deprecated in favor of
$ENV{PROCESSOR_ARCHITECTURE}.Win32::GetChipName( )Returns the processor type of the machine under which the perl process is running. This string will be represented as 386, 486, 586, etc.
Win32::GetFullPathName(filename)Combines
filenamewith drive number and directory name. In a list context,GetFulllPathName( )returnspathandfile.Win32::GetLastError( )Returns the last error value generated by a call to a Win32 API function.
Win32::GetLongPathName(pathname)Returns
pathnameas composed of longname components.Win32::GetProcAddress(instance,procname)Returns the address ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access