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 to exists, overwriting will take place only if overwrite is true. Read-only files will never be overwritten; they will need to be unlinked first.

Win32::FreeLibrary( handle )

Unloads a previously loaded DLL. handle is no longer valid after FreeLibrary( ) 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 filename with drive number and directory name. In a list context, GetFulllPathName( ) returns path and file.

Win32::GetLastError( )

Returns the last error value generated by a call to a Win32 API function.

Win32::GetLongPathName( pathname )

Returns pathname as composed of longname components.

Win32::GetProcAddress( instance , procname )

Returns the address ...

Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.