| 1 | use strictscip-perl cpan Tie-Hash-Regex 1.14 strict/; |
| 2 | use warningsscip-perl cpan Tie-Hash-Regex 1.14 warnings/; |
| 3 | |
| 4 | use Test::Morescip-perl cpan Tie-Hash-Regex 1.14 Test/More/; |
| 5 | |
| 6 | BEGIN { use_okscip-perl cpan Tie-Hash-Regex 1.14 main/use_ok(). 'Tie::Hash::Regex' }; |
| 7 | |
| 8 | my %hash : Regex; |
| 9 | |
| 10 | $hash{key} = 'value'; |
| 11 | $hash{key2} = 'another value'; |
| 12 | $hash{stuff} = 'something else'; |
| 13 | |
| 14 | my $x = 'f'; |
| 15 | |
| 16 | isscip-perl cpan Tie-Hash-Regex 1.14 main/is().($hash{key}, 'value'); |
| 17 | isscip-perl cpan Tie-Hash-Regex 1.14 main/is().($hash{'^s'}, 'something else'); |
| 18 | isscip-perl cpan Tie-Hash-Regex 1.14 main/is().($hash{qr'^s'}, 'something else'); |
| 19 | okscip-perl cpan Tie-Hash-Regex 1.14 main/ok().(not definedscip-perl cpan Tie-Hash-Regex 1.14 main/defined(). $hash{blah}); |
| 20 | isscip-perl cpan Tie-Hash-Regex 1.14 main/is().($hash{$x}, 'something else'); |
| 21 | |
| 22 | my @vals = tiedscip-perl cpan Tie-Hash-Regex 1.14 main/tied().(%hash)->FETCHscip-perl cpan Tie-Hash-Regex 1.14 main/FETCH().('k'); |
| 23 | isscip-perl cpan Tie-Hash-Regex 1.14 main/is().(@vals, 2); |
| 24 | deletescip-perl cpan Tie-Hash-Regex 1.14 main/delete(). $hash{stuff}; |
| 25 | isscip-perl cpan Tie-Hash-Regex 1.14 main/is().(keysscip-perl cpan Tie-Hash-Regex 1.14 main/keys(). %hash, 2); |
| 26 | |
| 27 | okscip-perl cpan Tie-Hash-Regex 1.14 main/ok().(existsscip-perl cpan Tie-Hash-Regex 1.14 main/exists(). $hash{key}); |
| 28 | okscip-perl cpan Tie-Hash-Regex 1.14 main/ok().(existsscip-perl cpan Tie-Hash-Regex 1.14 main/exists(). $hash{k}); |
| 29 | okscip-perl cpan Tie-Hash-Regex 1.14 main/ok().(existsscip-perl cpan Tie-Hash-Regex 1.14 main/exists(). $hash{qr'^k'}); |
| 30 | okscip-perl cpan Tie-Hash-Regex 1.14 main/ok().(not existsscip-perl cpan Tie-Hash-Regex 1.14 main/exists(). $hash{zz}); |
| 31 | |
| 32 | deletescip-perl cpan Tie-Hash-Regex 1.14 main/delete(). $hash{2}; |
| 33 | my @k = keysscip-perl cpan Tie-Hash-Regex 1.14 main/keys(). %hash; |
| 34 | isscip-perl cpan Tie-Hash-Regex 1.14 main/is().(@k, 1); |
| 35 | deletescip-perl cpan Tie-Hash-Regex 1.14 main/delete(). $hash{qr/^k/}; |
| 36 | okscip-perl cpan Tie-Hash-Regex 1.14 main/ok().(not keysscip-perl cpan Tie-Hash-Regex 1.14 main/keys(). %hash); |
| 37 | |
| 38 | done_testingscip-perl cpan Tie-Hash-Regex 1.14 main/done_testing().(); |