in reply to Re: Wierd Behavior With Tie
in thread Wierd Behavior With Tie

Thank you, that fixed the issue completely, I assume because an entirely new sub is being returned each time? I guess that makes sense.

Thanks for the caching as well. A definite plus, although I'll probably adjust the subroutine database, adding a cache flag so that I can enable caching at the subroutine level. I just recently made it through Higher Order Perl, and I seem to recall there are times when caching is not in order.

Problem solved. Thanks!

Next item on the agenda. Filing a bug report. I'm using ActiveState on an XP box. Do I file the bug report with ActiveState, on CPAN, or both? I've never found a bug before, so never filed a bug report. How does one go about doing this?

P.S. Also appreciated some of the argument checking idioms. Haven't seen those before. They're very nice. Always looking for a step forward, and those will help me write better code in the future.

Replies are listed 'Best First'.
Re^3: Wierd Behavior With Tie
by Limbic~Region (Chancellor) on Jun 03, 2006 at 15:45 UTC
    rational_icthus,
    I am glad it worked for you. I don't think it is constructing and returning a new sub each time. I think Perl is over-optimizing. The trick I used was to return a closure over $self which includes the desired subref.

    You are correct, caching isn't always a solution. You might want to check out Memoize for future reference. In many cases, cache is the right solution but with limited resources you need to expire unused items from the cache and only keep the most used recent. The CPAN has all kinds of options. Just search for cache.

    The argument checking is not perfect. There are much better modules such as Params::Validate. Everyone has their own way of doing things. Figuring out what works for you and those responsible for maintaining your code is what is important.

    This problem is not restricted to ActiveState so that's not the proper course of action. If you are not familiar with perlbug then read up on it and send in a minimalistic test case.

    Cheers - L~R