Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Win32::tieRegistry question

by aquacade (Scribe)
on Jul 22, 2001 at 20:42 UTC ( #98838=note: print w/replies, xml ) Need Help??


in reply to Win32::tieRegistry question

I had this same error message using DBI. See bug reports at http://bugs.activestate.com/ using link for "5.6 and later" and search on both 1486 and TieRegistry.pm individually to see this error message has been a long standing "feature" in TieRegistry.pm module.

Someone on the DC Perl Mongers mailing list found a reference for me (which I cannot direct you to at the moment, but will look for it) which suggested that the warnings code logic within TieRegistry.pm has a snarl and by *gasp* not using the -w during production (but using -w faithfully in development) I could suppress this *bogus I hope* error message. This informant also observed that since Perl automagically cleans up that this error, while seeming alarming, doesn't seem to effect the processing.

Since this error occurs 12 times for me when each of 12 DBI-using Perl programs I run as a batch finish execution, I have painstaking confirmed (at least to my satifaction and in my case) that I can safely ignore this error during my production runs (and safely hide it by not using -w).

Update (minutes after your update):   I see you found a solution WHILE I was writing this response. I'll make sure I'm in 5.6.1 at work as well and hope this fixes my error message in TieRegistry.pm while using DBI! Thanks!

Replies are listed 'Best First'.
(tye)Re: Win32::tieRegistry question
by tye (Sage) on Jul 23, 2001 at 03:42 UTC

    Actually, it is a feature of how Perl's global destruction is not done in an orderly manner in order to save time. Whether or not you get the error depends on some rather random things.

    I don't see how not using -w would help as trying to call a method on an undefined value does not require -w in order to trigger. Perhaps you are just getting lucky.

    You don't have to upgrade Perl to solve this problem. Simply upgrade Win32::TieRegistry. If you go to http://search.cpan.org/ and search for "TieRegistry", you'll find version 0.24. Click on the very first link and then click on the Changes file to see:

    Revision history for Perl extension Win32::TieRegistry.
    
    0.24  2001-02-06 19:00
            - Silenced error that could appear "at random" during "cleanup":
                    (Can't call method "FETCH" on an undefined value)
    
    (Well, when I did that I got an error which I'm hoping is a temporary problem with the web site.)

    In any case, I was able to download the module. Then unzip the file and install it like any CPAN module (or, if you don't have a version of "make", run the included Install.bat). The latest version may also be available in PPM form from some repository (I don't keep track much since I don't seem to have the ability to affect what gets made available).

    As for the error being harmless, you are mostly correct. The only thing related to that error that is a problem is fairly minor, especially considering that it only affects a feature that is rarely used. From the Bugs section of manual:

    Current implementations of Perl's "global destruction" phase can cause objects returned by Load() to be destroyed while keys within the hive are still open, if the objects still exist when the script starts to exit. When this happens, the automatic UnLoad() will report a failure and the hive will remain loaded in the Registry.

            - tye (but my friends call me "Tye")

      Thank you Brother Tye for an excellent exposition of the root problem! I only received this error when exiting each program. I do have a follow-on question for you:

      Do I now have to manually delete entries from my registry (using regedit) to clean it up? Your last sentence indicates "the hive will remain loaded in the Registry?" Thanks!

        No. You can get the error once for each Registry key object that you (or anyone) stored in a global variable. But you can only run into the bug if you used the Load() in such a way that you expected the module to automatically unload once you close the key (and also in such a way that the error could be triggered for that key or some key within the hive you Load()ed). Since you probably didn't Load() any keys at all, then there would be no chance of leaving any keys loaded.

        If you'd left keys loaded, it is easy to notice when you run regedt32 (there'd be some unexpected keys with names that include "TieRegistry" and some sequence number hanging out). Other than the clutter, leaving the keys loaded does little harm (it leaves the hive file locked) and the "problem" goes away when you reboot.

                - tye (but my friends call me "Tye")

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://98838]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2022-10-01 18:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred way to holiday/vacation is:











    Results (3 votes). Check out past polls.

    Notices?