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; }