This may sound a bit strange, but find Win32/TieRegistry.pm on your
system (I'd suggest just using "perldoc Win32::TieRegistry" it dies on me
-- I guess E<> is either old-style of perldoc needs to be
updated) and read the the "Specifying constants in your Perl code"
section. Oh heck, here it is:
Specifying constants in your Perl code
This module was written with a strong emphasis on the convenience of
the module user. Therefore, most places where you can specify a
constant like REG_SZ() also allow you to specify a string
containing the name of the constant, "REG_SZ". This is convenient
because you may not have imported that symbolic constant.
Perl also emphasizes programmer convenience so the code REG_SZ
can be used to mean REG_SZ() or "REG_SZ" or be illegal.
Note that using ®_SZ (as we've seen in much Win32 Perl code)
is not a good idea since it passes the current @_ to the
constant() routine of the module which, at the least, can give
you a warning under -w.
Although greatly a matter of style, the "safest" practice is probably
to specifically list all constants in the use Win32::TieRegistry
statement, specify use strict [or at least use strict qw(subs)],
and use bare constant names when you want the numeric value. This will
detect mispelled constant names at compile time.
use strict;
my $Registry;
use Win32::TieRegistry 0.20 (
TiedRef => \$Registry, Delimiter => "/", ArrayValues => 1,
SplitMultis => 1, AllowLoad => 1,
qw( REG_SZ REG_EXPAND_SZ REG_DWORD REG_BINARY REG_MULTI_SZ
KEY_READ KEY_WRITE KEY_ALL_ACCESS ),
);
$Registry->{"LMachine/Software/FooCorp/"}= {
"FooWriter/" => {
"/Fonts" => [ ["Times","Courier","Lucinda"], REG_MULTI_SZ
+],
"/WindowSize" => [ pack("LL",24,80), REG_BINARY ],
"/TaskBarIcon" => [ "0x0001", REG_DWORD ],
},
} or die "Can't create Software/FooCorp/: $^E\n";
If you don't want to use strict qw(subs), the second safest practice
is similar to the above but use the REG_SZ() form for constants
when possible and quoted constant names when required. Note that
qw() is a form of quoting.
use Win32::TieRegistry 0.20 qw(
TiedRef $Registry
Delimiter / ArrayValues 1 SplitMultis 1 AllowLoad 1
REG_SZ REG_EXPAND_SZ REG_DWORD REG_BINARY REG_MULTI_SZ
KEY_READ KEY_WRITE KEY_ALL_ACCESS
);
$Registry->{"LMachine/Software/FooCorp/"}= {
"FooWriter/" => {
"/Fonts" => [ ["Times","Courier","Lucinda"], REG_MULTI_SZ(
+) ],
"/WindowSize" => [ pack("LL",24,80), REG_BINARY() ],
"/TaskBarIcon" => [ "0x0001", REG_DWORD() ],
},
} or die "Can't create Software/FooCorp/: $^E\n";
The examples in this document mostly use quoted constant names
("REG_SZ") since that works regardless of which constants
you imported and whether or not you have use strict in your
script. It is not the best choice for you to use for real
scripts (vs. examples) because it is less efficient and is not
supported by most other similar modules.
(end)
So the problem is that you GROUP_TYPE_GLOBAL isn't being imported. I'd
specify it in your use statment:
use Win32::AdminMisc qw( GROUP_TYPE_GLOBAL );
so that 1) readers know where that value is supposed to come from
2) you don't have to worry whether the module exports that symbol
by default 3) you don't get a bunch of things you don't use imported
that might cause name collisions 4) you get an error if the module
doesn't in fact provide a way of exporting anything with that name.
I'd go even further and do:
use Win32::AdminMisc qw( GetGroups GROUP_TYPE_GLOBAL );
(so that you don't have to keep typing "Win32::AdminMisc" over and
over again) but a lot of Win32:: module are braindamaged in not allowing
you to do that. If this is one of those, I encourage you to complain
to the author about it.
-
tye
(but my friends call me "Tye")
|