in reply to Problem with Tie::RegexpHash

Having removed the cpan:// portion of the offending line, I too get that error warning. Commenting out use diagnostics; results this error warning: Use of uninitialized value in string ne at C:/Perl/site/lib/Tie/RegexpHash.pm line 58.. Removing -w results in no errors or warnings.

Added: Does this module not like warnings? Or is there a way to get it to work?

Replies are listed 'Best First'.
Re: Re: Problem with Tie::RegexpHash
by sch (Pilgrim) on Oct 10, 2002 at 17:20 UTC

    Yup, thought of that :) - but then when I have problems later on (as I always do), the first things the monks would say is use -w (well, after use strict).

    Looking at the documentation for the module, it says of the add method:

    $obj->add( $key, $value );
    Adds a new key/value pair to the hash. $key can be a Regexp or a string (which is compiled into a Regexp).
    If $key is already defined, the value will be changed. If $key matches an existing key (but is not the same), a warning will be shown if warnings are enabled.

    and I suspect that the final paragraph is coming into play, but I can't see why.

      After having read the docs for Tie::RegexpHash, I still haven't found a solution. I'd say that your best bet would be to contact the author.

        Yup, having to do that - was trying to get something working quickly and hoped someone else had come across a solution

        What I'm trying to do is a simple parser for some commands and I was thinking of using a hash with the keys being regexp's that would match commands and the value's being references to functions - if anyone knows of another way of doing it I'm always willing to change direction mid-flow :)