Win32 Perl Programming Errata Page |
Like everything in life some mistakes found their way into the book. The errors that
were discovered have been corrected for the second printing that took place in mid
February 1999. If you have a book from the first printing (January 1999) you may want to
consult this page for corrections.
This page uses a color scheme to point out errors and their corrections. The legend for
the scheme is:
Page |
Error |
Correction |
Page 18 Example 1.7: |
Line 7 indicates that Win32::NetResource::GetError() returns an error value. |
The function does not return an error value. Instead it populates the scalar passed in with the error number. |
$Error = Win32::NetResource::GetError(); |
Win32::NetResource::GetError( $Error );
|
|
Page 66 Example 3.1: |
Line 20 makes a reference to a USER_FULLNAME constant. |
Change the constant to USER_FULL_NAME. |
Win32::AdminMisc::UserSetMiscAttributes( $Server, $User, USER_FULLNAME => $Account{fullname} ); |
Win32::AdminMisc::UserSetMiscAttributes( $Server, $User, USER_FULL_NAME => $Account{fullname} ); |
|
Page 74 Example 3.3: |
Line 9 incorrectly calls a Win32::AdminMisc::GetUserMiscAttributes() function. There is no such function. |
Change the function to Win32::AdmiMisc::UserGetMiscAttributes(). |
Win32::AdmiMisc::GetUserMiscAttributes( "", $User, \%Attribs ); |
Win32::AdmiMisc::UserGetMiscAttributes( "", $User, \%Attribs ); |
|
Page 86 Example 3.8: |
Line 17 has a comma that should not be there. |
Remove the comma preceeding the @List variable. |
map { printf( "\t%03d) %s\n", ++$iCount, $_ ); }, @List; |
map { printf( "\t%03d) %s\n", ++$iCount, $_ ); } @List; |
|
Page 88 Example 3.10: |
Line 8 incorrectly refers to Win32::NetAdmin::GetGroupMembers(). |
The line should refer to Win32::NetAdmin::GroupGetMembers(). |
if( ! Win32::NetAdmin::GetGroupMembers( $Server, $Group, \@UserList ) ) |
if( ! Win32::NetAdmin::GroupGetMembers( $Server, $Group, \@UserList ) ) |
|
Page 102 Example 3.18: |
Line 11 refers to the $_ scalar variable. |
The @_ array should have been refereneced instead. |
my ( $Key ) = $_; |
my ( $Key ) = @_; |
|
Page 103: |
The section "Removing Registry Keys" suggests that when a registry
key is deleted using the DeleteKey() method all subkeys are deleted as well. |
The DeleteKey() method will remove the specified key and all subkeys
on Windows 95 and Windows 98. Windows NT and Windows 2000 require the explicit deletion of each subkey (which
requires each subkey's subkeys to be deleted--and so on). |
|
Page 184 Example 5.18: |
Line 3 refers to the Win32::OLE object's Range() method but incorrectly used a left brace instead of a parenthesis. |
The left brace should be a left parenthesis. |
$Cells = $Sheet->Range{ "A1:C5" ); |
$Cells = $Sheet->Range( "A1:C5" ); |
|
Page 364 |
The XS function ExtensionGetFileSizes() searches for
all files that match the the specified criteria. For each file found a memory structure is
filled out which holds the files name and size. Line 4 in Example 10.4 concatinates
this structure into a PV using sv_catpvn(). The Perl script which calls the Win32::Test::GetFileSizes()
extension in this example will need to use unpack() to access the structures. Example 10.5
shows how to unpack the data strucutes returned by a call to the example GetFileSizes()
function.
Example 10.5. Unpacking concatinated data structures from the extension in Example 10.4.
|
Example 10.27 illustrates
the use of sv_catpvn() to concatinate byte arrays. The XS function ExtensionGetFileSizes()
searches for all files that match the the specified criteria. For each file found a memory
structure is filled out which holds the files name and size (lines 138-140). Line
142 concatinates this structure into a PV using sv_catpvn(). The Perl script which
calls the Win32::Test::GetFileSizes() extension in this example will need to use unpack()
to access the structures. Example 10.5 shows how to unpack the data strucutes returned by
a call to the example GetFileSizes() function.
Example 10.5. Unpacking concatinated data structures from the extension in Example
10.27.
|
|
Page 366 |
All of the newRV() macros accept an SV
pointer which is what the new reference will point to as illustrated in Example 10.8. This
example is not as clear as if we were doing this using stright C (instead of using Perl
SVs) as in Example 10.8. This is because do illustrate
how RVs are used we need to create an RV then immediately dereference it. This
defeats createing an RV altogether but it does illustrate how one is created and
dereferenced. Line 4 creates the reference to pSV. Line 6 then dereferences pRefSV. Note
that after line 6 pDerefedSV is equal to pSV. Finally line 8 extracts the integer value
from the SV and prints it out in line 9.
|
All of the newRV() macros accept an SV
pointer which is what the new reference will point to as illustrated in Example 10.8. This
example is not as clear as if we were doing this using stright C (instead of using Perl
SVs) as in Example 10.7. This is because do
illustrate how RVs are used we need to create an RV then immediately dereference it.
This defeats createing an RV altogether but it does illustrate how one is created and
dereferenced. Line 4 creates the reference to pSV. Line 6 then dereferences pRefSV. Note
that after line 6 pDerefedSV is equal to pSV. Finally line 8 extracts the integer value
from the SV and prints it out in line 9.
|
|
Page 366 Example 10.8 |
Line 6 makes use of an incorrect (actually a nonexisting) macro: |
It should make use of the SvRV() macro: |
SV* pDerefedSV = SV ( pRefSV ); |
SV* pDerefedSV = SvRV( pRefSV ); |
|
Page 367 |
The warning block's code segment, line 4 incorrectly uses (a non existing) macro: |
It should refer to the newRV() macro: |
SV *pReference = new_RV( &svBad ); |
SV *pReference = newRV( &svBad ); |
|
Page 378 |
The last paragraph on the page incorrectly refers to Example
10.13. |
It should read Example 10.14. |
|
Page 381 |
There is a typo in the last sentence of the second paragraph. It reads: |
By removing the word is it correctly reads: |
This is stack is the equivilent to
a Perl subroutines @_ array. |
This stack is the equivilent to a Perl subroutines @_ array. |
|
Page 382 |
The fourth paragraph refers to the wrong examples: |
It should read: |
Refer to Example 10.14 for an illustration of using the ST()
macro. |
Refer to Examples 10.15 and 10.16
for an illustration of using the ST() macro. |
|
Page 384: |
The second paragraph: |
Should have appeared immediately following Example 10.15 on page 383. |
The Perl script that calls this can expect two return values:
($Text, $AvagadrosNum) = Win32::Test::MyFunction(); |
|
|
Page 386 |
The fourth paragraph incorrectly refers to Example
10.17. |
It should refer to Example 10.18 instead. |
|
Page 387 |
The second paragraph incorrectly refers to Example
10.18 |
It should refer to Example 10.19. |
|
Page 397 |
The bulleted list refers to incorrect examples: |
It should read: |
Example 10.24 is a Perl script which demonstrates how to call
the extension.
Example 10.25 is a perl module which is required to load the
extension.
Example 10.26 is the actual extension itself.
Example 10.27 is the DLL definition (.def) file. |
Example 10.25 is a Perl script which demonstrates how to
call the extension.
Example 10.26 is a perl module which is required to load
the extension.
Example 10.27 is the actual extension itself.
Example 10.28 is the DLL definition (.def) file. |
|
Page 424 |
The description of the GetComputerName()
function references a function: Win23::GetNodeName()
The reference was: |
It should read: |
This function returns the nme of the computer. This performs the same
function as the Win23::GetNodeName() found in the Win32 module.
|
This function returns the nme of the computer. This performs the same
function as the Win32::NodeName() found in the Win32 module.
|
|
Page 441 |
The description of the NetShareGetInfo()
function incorrection describes the second parameter to be a hash reference.
|
The second parameter must be a scalar. The function will populate the
scalar with a reference to a hash.
Refer to the top of page 43 for more details.
|
NetShareGetInfo( $ShareName, \%Share [, $Machine ] )
|
NetShareGetInfo( $ShareName, $Share [, $Machine ] )
|
|