Do you know where your variables are? | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
One advantage of having direct access to the data from the API (i.e. not forcing users to use the filesystem) is that it's easier to write tests.
Also, in my experience writing tests for your module generally gives you a good indication about the quality of the API: if your tests look straight-forward, the API is probably good. update: or rather, if your tests look clumsy, the API is probably bad. For your specific instance, I would probably write a test like so (method and class-names made up):
then you can expand to direct to disk methods:
I wouldn't return a hashref with all the filenames and data in it - chances are, that users who want to access the data directly aren't interested in all files, plus, if your archive is big, it would consume a lot of memory.
In reply to Re: Should Modules Do I/O?
by Joost
|
|