When this type of question comes up, I find I'm rather quick to "use the source".
sub Load { my $this= shift(@_); my $tied= ref($this) && tied(%$this); $this= tied(%$this) if $tied; my( $file, $subKey, $opts )= @_; if( 2 == @_ && "HASH" eq ref($subKey) ) { $opts= $subKey; undef $subKey; } @_ < 1 || 3 < @_ || defined($opts) && "HASH" ne ref($opts) and croak "Usage: \$key= ", "${PACK}->Load( \$fileName, [\$newSubKey,] {OPT=>VAL...} +);\n", " options: @Load_Opts @new_Opts\nCalled"; if( defined($opts) && exists($opts->{NewSubKey}) ) { $subKey= delete $opts->{NewSubKey}; } if( ! defined( $subKey ) ) { if( "" ne $this->Machine ) { ( $this )= $this->_connect( [$this->Machine,"LMachine"] ); } else { ( $this )= $this->_rootKey( "LMachine" ); # Could also +be "Users" } $subKey= "PerlTie:$$." . ++$Load_Cnt; } $this->RegLoadKey( $subKey, $file ) or return (); my $self= $this->new( $subKey, defined($opts) ? $opts : () ); if( ! defined( $self ) ) { { my $err= Win32::GetLastError(); #{ local( $^E ); #} $this->RegUnLoadKey( $subKey ) or carp "Can't unload $subKey from ", $this->Path, ": ", _ErrMsg +, "\n"; Win32::SetLastError($err); } return (); } $self->{UNLOADME}= [ $this, $subKey, $file ]; $self= $self->TiedRef if $tied; return $self; }
Which boils down to a whole lot of error checking and DWIM and other nonsense and
$this->RegLoadKey( $subKey, $file )
so just do that. See Win32API::Registry for more on this method (note that you can use nearly any Win32API::Registry method directly on a Win32::TieRegistry object, as documented).
- tye
In reply to Re: Win32::TieRegistry and Load() (hack)
by tye
in thread Win32::TieRegistry and Load()
by Belmonts
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |