in reply to use inside a package
By the way, Win32::Registry is obsolete, the doc suggests one to use Win32::TieRegistryuse strict; use Win32::Registry; package myPackage; print $::HKEY_LOCAL_MACHINE; # not $HKEY_LOCAL_MACHINE
Updated: I went to look at the code in Win32::Registry.pm, and found the following segment, which should explain this issue pretty well.
#define the basic registry objects to be exported. #these had to be hardwired unfortunately. # XXX Yuck! { package main; use vars qw( $HKEY_CLASSES_ROOT $HKEY_CURRENT_USER $HKEY_LOCAL_MACHINE $HKEY_USERS $HKEY_PERFORMANCE_DATA $HKEY_CURRENT_CONFIG $HKEY_DYN_DATA ); } $::HKEY_CLASSES_ROOT = _new(&HKEY_CLASSES_ROOT); $::HKEY_CURRENT_USER = _new(&HKEY_CURRENT_USER); $::HKEY_LOCAL_MACHINE = _new(&HKEY_LOCAL_MACHINE); $::HKEY_USERS = _new(&HKEY_USERS); $::HKEY_PERFORMANCE_DATA = _new(&HKEY_PERFORMANCE_DATA); $::HKEY_CURRENT_CONFIG = _new(&HKEY_CURRENT_CONFIG); $::HKEY_DYN_DATA = _new(&HKEY_DYN_DATA);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: use inside a package
by tye (Sage) on Dec 16, 2004 at 09:41 UTC | |
|
Re^2: use inside a package
by citron (Initiate) on Dec 16, 2004 at 07:04 UTC |