in reply to Re: Horrible "undef local $foo;" (was: Re: Signals and 'IGNORE')
in thread Signals and 'IGNORE'

undef local $SIG{INT} is clearer in intention than local $SIG{INT}.
Not to me it isn't. It's actually more confusing. It immediately begs the question for me: "how come this coder doesn't know that all new variables are automatically born undef?". And then it has me question the quality of the remaining code. Or even question my own knowledge, wondering, "well, maybe there is a time when I need to undef that new variable explicitly that I don't know about". It's raising more questions than it's answering.

Put another way, you do look funny when you wear both belt and suspenders, even though you make think you're just being safer or clearer about intent. Makes me wonder whether you're wearing both boxers and briefs as well.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

  • Comment on •Re: Re: Horrible "undef local $foo;" (was: Re: Signals and 'IGNORE')

Replies are listed 'Best First'.
Re: •Re: Re: Horrible "undef local $foo;" (was: Re: Signals and 'IGNORE')
by shotgunefx (Parson) on Jan 06, 2003 at 14:44 UTC
    Depends on who else you expect to read your code after. I think it's safe to say that Zaxo knows that local variables automatically are set to undef. Which I assume is exactly why he noted it as such. I would hardly call it "junk". It works and causes 0 problems with the code. It's a stylistic decision.

    I'll refrain from commenting on what I suspect you're wearing for undergarments.

    -Lee

    "To be civilized is to deny one's nature."
Re: •Re: Re: Horrible "undef local $foo;" (was: Re: Signals and 'IGNORE')
by waswas-fng (Curate) on Jan 06, 2003 at 16:07 UTC
    To me:
    # undef to restore SIGINT to normal behavior undef local $SIG{INT};
    And
    # undef to restore SIGINT to normal behavior local $SIG{INT};
    Read the same, the cake is in the comment that reminds whoever is looking at the code what is trying to be accomplished.

    -Waswas