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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.