in reply to Win32::TieRegistry Error (or is it me?)

The getting of the list of values is ending with a reason other than "no more values to get". It is a bug (in the module) that this causes the module to die.

You could wrap the call to ValueNames() in eval and after that report $^E or Win32API::Registry::regLastError() to get a hint what the problem is. Let me know what that reports.

These modules don't use Win32::API so I doubt your update of it is the source of the change.

- tye        

  • Comment on Re: Win32::TieRegistry Error (or is it me?) (leads)

Replies are listed 'Best First'.
Re^2: Win32::TieRegistry Error (or is it me?) (leads)
by ChrisR (Hermit) on Sep 27, 2005 at 02:57 UTC
    I was pretty sure that it wasn't the upgrade but that was the only that changed.

    Here's what I did:

    eval { @regValues = $fieldKey->ValueNames; }; print "\$\^E: $^E\nregLastError: " . Win32API::Registry::regLastError( +) ."\n\n";
    The program did not die and here's what was printed:
    $^E: regLastError: No more data is available
    Without the eval:
    @regValues = $fieldKey->ValueNames; print "\$\^E: $^E\nregLastError: " . Win32API::Registry::regLastError( +) ."\n\n";
    the program dies and prints this:
    $^E: No more data is available regLastError: No more data is available Can't use an undefined value as an ARRAY reference at C:/Perl/site/lib +/Win32/TieRegistry.pm line 684, <DATA> line 164.
    However, I may not have used eval correctly or as you intended. If not let me know and I'll do it again.

    Thanks,
    Chris

      Okay, that makes it look like Win32::WinError got changed. What does this produce?

      perl -MWin32::WinError -le"print Win32::WinError::constant("ERROR_NO_M +ORE_ITEMS",0)" perl -MWin32::WinError=999 -e0

      - tye        

        perl -MWin32::WinError -le"print Win32::WinError::constant("ERROR_NO_M +ORE_ITEMS",0)"
        Prints 0
        perl -MWin32::WinError=999 -e0
        Prints nothing.