EXISTS within TIEHASH package. 
Author Message
 EXISTS within TIEHASH package.

Does EXISTS ever get called?

If you do a "if (defined $hash{'defined'})" to a tie'd hash, EXISTS
isn't called (of course), since $hash{'defined'} really evaluates to
$hash->FETCH("defined").  

EXISTS would be faster, but doesn't seem to be used.  Is it ever?

Brian



Fri, 18 Jul 1997 01:12:37 GMT  
 EXISTS within TIEHASH package.

Brian> Does EXISTS ever get called?

Brian> If you do a "if (defined $hash{'defined'})" to a tie'd
Brian> hash, EXISTS isn't called (of course), since
Brian> $hash{'defined'} really evaluates to
Brian> $hash->FETCH("defined").

Of course that binds to a FETCH call, since you have to fetch the value
to see whether it's defined.  If you execute a

        tie %h,'Foo';

and then say

        exists $h{'snork'}

*that* will generate a call to Foo::EXISTS.

--

speaking only for myself                        ...!decvax!orb!spider



Sun, 20 Jul 1997 16:01:49 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Q: Tie package - New or TIEHASH?

2. checking for existing within a list

3. Testing if something exists deep within a structure

4. Existing perl package for date/time reading?

5. Do any RCS parsing packages exist?

6. Checking to see if packages exist

7. Do any RCS parsing packages exist?

8. How to use packages within same file?

9. How to use packages within same file?

10. require within package

11. exporting a sub to another package within the same file

12. Passing of a file handle within a package with strict(subs)

 

 
Powered by phpBB® Forum Software