Win32 Extensions

In addition to the modules listed above, 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 they return the value (or values) of the requested information, unless otherwise noted.

Win32::GetLastError()

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

Win32::OLELastError()

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

Win32::BuildNumber()

Returns the build number of Perl for Win32.

Win32::LoginName()

Returns the username of the owner of the current Perl process.

Win32::NodeName()

Returns the Microsoft network node-name of the current machine.

Win32::DomainName()

Returns the name of the Microsoft network domain that the owner of the current Perl process is logged into.

Win32::FsType()

Returns a string naming the filesystem type of the currently active drive.

Win32::GetCwd()

Returns the current active drive and directory. This function does not return a UNC path, since the functionality required for such a feature is not available under Windows 95.

Win32::SetCwd(newdir)

Sets the current active drive and directory to newdir. This function does not work with UNC paths, since the functionality required for such a feature is not available under Windows 95.

Win32::GetOSVersion() ...

Get Perl in a Nutshell now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.