Hi everyone,

In the test files I have that are used for testing the properties and
qualities of a data/type validator,

I make these hashes available globally, initially as undef. I have a
reset() function that defines and populates the data types (all hashes)
to a default state with default values. This reset function is called
whenever a change is made to the data between tests.

Instead of copy/pasting each test for all of the known types, I'd like
to iterate through a list of known type names, and then map the name of
the type to the hash with the same name. I think what I want is a
symbolic ref, but I can't quite figure out how to map the hash to the name.

Could someone point out the err of my ways, or offer a better solution?
In essence, here's some code that attempts to explain what I'm after:

my @types = $vardb->is_type();

my %plan_info = { this => 'that', these => 'those', };

for (@types) {

    no strict 'refs';

    if ($_ eq 'plan_info') {

        my $ref = %$_;  # I know it's wrong, it's just to
                        # hopefully explain what I'm after

        while ( my ($key, $value) = each (%$ref) ) {
            print "$key => $value\n";
        }
    }
}

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to