in reply to Re: Cache Subroutine Return Value
in thread Cache Subroutine Return Value

I would make the following additional change: If the open() fails, throw an exception (die), rather than returning a value which is indistinguishable from a valid first line. (An empty string is what you'd get if the file contains 0 bytes.)

Replies are listed 'Best First'.
Re^3: Cache Subroutine Return Value
by dragonchild (Archbishop) on Aug 11, 2004 at 15:06 UTC
    Huh. Never knew that. It actually returns undef, not the empty string, which is what return; will send back to the caller. Updated.

    ------
    We are the carpenters and bricklayers of the Information Age.

    Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

    I shouldn't have to say this, but any code, unless otherwise stated, is untested