I can't guess why you think that your other methods should work. STORE methods do not set values by returning a value nor by overwriting the $key parameter.

Now, if you get anything to work, consider yourself lucky and worry about in what release of Perl it will break. %SIG is magical (yes, that is the real term for it). So when you set values of %SIG, C code inside of Perl gets run in order to set up actual signal handlers. What triggers this C code is called "magic" and you'll have to go read "perldoc perlguts" (and then some) if you want to know more about it.

If I were going to try this, I'd keep a reference to the original %SIG handy and then replace %SIG with my tied hash:

my $realSig= \%::SIG; *::SIG= {}; tie %::SIG, ...
which I have some hope would separate the magic from the tiedness. But I can't offer any guarantees.

(I don't know if the "::"s are of any use in the above code. The "SIG" is special to Perl such that it knows to always find it in package "main", but I'm not certain that this specialness would always be triggered in the above code so I'm trying not to rely upon it.)

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

In reply to (tye)Re: Tied %SIG by tye
in thread Tied %SIG by bbfu

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.