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);
In reply to Re: use inside a package
by johnnywang
in thread use inside a package
by citron
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |